/**
* <strong>BasicDataSource does NOT support this method. </strong>
*
* @param user Database user on whose behalf the Connection
* is being made
* @param pass The database user's password
*
* @throws UnsupportedOperationException
* @throws SQLException if a database access error occurs
* @return nothing - always throws UnsupportedOperationException
*/
@Override
public Connection getConnection(String user, String pass) throws SQLException {
// This method isn't supported by the PoolingDataSource returned by
// the createDataSource
throw new UnsupportedOperationException("Not supported by BasicDataSource");
}
public void run(DataSource dataSource) {
String username = migrationConfig.getDbUsername();
String password = migrationConfig.getDbPassword();
if (username == null) {
throw new IllegalStateException("No DB migration user specified (to run the db migration) ?");
}
try {
Connection connection = dataSource.getConnection(username, password); // <---------------------
logger.debug("using db user [{}] to run migrations ...", username);
run(connection);
} catch (SQLException e) {
throw new IllegalArgumentException("Error trying to connect to database using DB Migration user [" + username + "]", e);
}
}
--
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
MigrationConfig config = new MigrationConfig();
config.setMigrationPath("filesystem:dbmigration");
config.setDbSchema("testmigration");
config.setCreateSchemaIfNotExists(true);
MigrationRunner runner = new MigrationRunner(config);
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUsername("postgres");
dataSource.setUsername("postgres");
dataSource.setUrl("jdbc:postgresql://localhost:5432/customer");
dataSource.setDriverClassName("org.postgresql.Driver");
runner.run(dataSource);
2016-12-21 18:39:28 [main] INFO o.a.d.runner.MigrationSchema - Migration Schema: testmigration
2016-12-21 18:39:28 [main] INFO o.a.d.runner.MigrationSchema - Creating Schema: testmigration
2016-12-21 18:39:28 [main] INFO o.a.d.runner.MigrationSchema - Setting Schema: testmigration
2016-12-21 18:39:28 [main] ERROR java.lang.RuntimeException - org.postgresql.util.PSQLException: ERROR: syntax error at or near "testmigration"
Position: 12
java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: syntax error at or near "testmigration"
Position: 12
at org.avaje.dbmigration.MigrationRunner.run(MigrationRunner.java:84)
at org.avaje.dbmigration.MigrationRunner.run(MigrationRunner.java:43)
at com.sollar.customer.RunMigrations.run(RunMigrations.java:27)
at com.sollar.customer.RunMigrations.main(RunMigrations.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "testmigration"
Position: 12
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:645)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:495)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:488)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:198)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:198)
at org.avaje.dbmigration.runner.MigrationSchema.setSchema(MigrationSchema.java:83)
at org.avaje.dbmigration.runner.MigrationSchema.createAndSetIfNeeded(MigrationSchema.java:45)
at org.avaje.dbmigration.MigrationRunner.run(MigrationRunner.java:76)
... 8 common frames omitted
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+unsubscribe@googlegroups.com.