hey thanks man, i did multiple projects with h2 integration after 6 months gap I forgot what I have done, wasted 2 hrs issue with inserting data. thanks man you saved my life.
Hey! data.sql can be used for inserting data to your database, schema must be already created. In case when you don't want to use default schema creation mechanism, you can create your own schema using schema.sql. Import.sql is specific for hibernate implementation and allows to load sql scripts. First two are spring specific and the last one is hibernate specific.
can you import from a CSV using data.sql ? If so, how do I indicate the CSV path? Will this work? COPY table_schema.table FROM '~/src/main/resources/database/csv/table.csv' WITH (FORMAT csv);
hey thanks man, i did multiple projects with h2 integration after 6 months gap I forgot what I have done, wasted 2 hrs issue with inserting data. thanks man you saved my life.
I am glad that video helped you! Keep Coding!
Thank you! Very helpful! My only regret is I have not found your channel sooner
Great to hear that!
Thanks a lot, man! It was really helpful.
You're welcome!
thanks for video! helped me with property "spring.datasource.data" to validate data.sql
Great to hear that! You are welcome!
very good video! mega helpful
If we have 2 schema how can we set the schema and data?
Bro one doubt no need to set spring.datasource.initializationmode?
Depends, by default it is set to embedded.
@@CodeForgeYT Thanks
what is the difference between data.sql and import.sql?
Hey! data.sql can be used for inserting data to your database, schema must be already created. In case when you don't want to use default schema creation mechanism, you can create your own schema using schema.sql. Import.sql is specific for hibernate implementation and allows to load sql scripts. First two are spring specific and the last one is hibernate specific.
i followed all the steps but my schema.sql file still not executed. could you help me please
?
Hi! Check if it is in correct location, otherwise spring will be not able to find it.
@@CodeForgeYT I am facing same issue and file is at right location.
I am facing same issue and file is at right location.
resolved it , jdbc url was wrong so had to remove DB_CLOSE_DELAY=-1 and it worked
update the classpath to spring.sql.init.schema-locations=classpath:db/schema.sql
can you import from a CSV using data.sql ? If so, how do I indicate the CSV path?
Will this work?
COPY table_schema.table FROM '~/src/main/resources/database/csv/table.csv' WITH (FORMAT csv);