Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
public static void main(String[] args) throws Exception {
//execute("jdbc:postgresql://localhost:5432/JAVA_Test", "Admin", "123456", "org.postgresql.Driver");
execute("jdbc:jtds:sqlserver://localhost:5432/Liquibase_JAVA", "sa", "123456!", "net.sourceforge.jtds.jdbc.Driver");
public static void execute(String url, String userName, String password, String driver) throws Exception {
DatabaseConnection dbConnection = new DatabaseConnection(url, driver, userName, password);
Connection conn = dbConnection.getConnection();
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(conn));
String changeLog = "/job_executor/liquibasechangelog/databaseChangeLog.xml";
Liquibase liquibase = new Liquibase(changeLog, new FileSystemResourceAccessor(), database);
liquibase.update(null);
conn.close();
I have my changeLogFile inside my project. It's kind of weird that i'm getting an error changeLogFile.xml does not exists.
Can anyone help me with this, THanks
–
Most likely your change log file is not there:
/job_executor/liquibasechangelog/databaseChangeLog.xml
but there:
job_executor/liquibasechangelog/databaseChangeLog.xml
Please notice the / missing in the second path so it will be relative, not absolute.
–
I have fixed it, by adding the liquibasechangelog folder (where my xml files resides) to the build path and then by referring it just by the file name instead of path to the file name
just like this
String changeLog = "databaseChangeLog.xml";
THanks @DavidX @MichalRorat
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.