java.lang.Object | |
↳ | org.springframework.jdbc.datasource.init.ResourceDatabasePopulator |
Populates a database from SQL scripts defined in external resources.
Call addScript(Resource)
to add a SQL script location.
Call setSqlScriptEncoding(String)
to set the encoding for all added scripts.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a script to execute to populate the database.
| |||||||||||
Populate the database using the JDBC connection provided.
| |||||||||||
Set the line prefix that identifies comments in the SQL script.
| |||||||||||
Flag to indicate that all failures in SQL should be logged but not cause a failure.
| |||||||||||
Flag to indicate that a failed SQL
DROP statement can be ignored. | |||||||||||
Set the scripts to execute to populate the database.
| |||||||||||
Specify the encoding for SQL scripts, if different from the platform encoding.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Add a script to execute to populate the database.
script | the path to a SQL script |
---|
Populate the database using the JDBC connection provided.
connection | the JDBC connection to use to populate the db; already configured and ready to use |
---|
SQLException |
---|
Set the line prefix that identifies comments in the SQL script. Default is "--".
Flag to indicate that all failures in SQL should be logged but not cause a failure. Defaults to false.
Flag to indicate that a failed SQL DROP
statement can be ignored.
This is useful for non-embedded databases whose SQL dialect does not support an
IF EXISTS
clause in a DROP
. The default is false so that if the
populator runs accidentally, it will fail fast when the script starts with a DROP
.
Set the scripts to execute to populate the database.
scripts | the scripts to execute |
---|
Specify the encoding for SQL scripts, if different from the platform encoding.
Note setting this property has no effect on added scripts that are already
encoded resources
.