Hi,
I'm using Gradle 2.7 and Derby 10.12.1.1. I would like to use Derby to
construct an in-memory database for which I can run unit tests. I'm not sure
the right way to set this up but here is what I'm trying. I thought including
";create=true" in the URL would automatically launch the server but I guess not
because I'm getting a "Error connecting to server localhost on port 1,527 with
message Connection refused" error when my LIquibase plugin attempts to write to
the db. Below is what I'm including in my build.gradle script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'mysql:mysql-connector-java:5.1.36'
classpath 'org.apache.derby:derby:10.12.1.1'
classpath 'org.apache.derby:derbyclient:10.12.1.1'
classpath 'org.flywaydb:flyway-gradle-plugin:3.2.1'
}
}
plugins {
id "org.liquibase.gradle" version "1.1.1"
}
...
flyway {
url = 'jdbc:derby://localhost:1527/test;create=true'
user = 'sa'
}
liquibase {
activities {
main {
File propsFile = new File(liquibasePropertiesFile)
Properties properties = new Properties()
properties.load(new FileInputStream(propsFile))
changeLogFile 'src/main/resources/db.changelog-master.xml'
url properties['url']
username properties['username']
password properties['password']
}
test {
File propsFile = new File(liquibasePropertiesFile)
Properties properties = new Properties()
properties.load(new FileInputStream(propsFile))
changeLogFile 'src/main/resources/db.changelog-master.xml'
url 'jdbc:derby://localhost:1527/test;create=true'
username 'sa'
}
runList = 'main,test'
}
}
Here is the exception I'm getting in LIquibase ...
Unexpected error running Liquibase:
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error
connecting to server localhost on port 1,527 with message Connection refused.
SEVERE 10/26/15 1:34 PM: liquibase:
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error
connecting to server localhost on port 1,527 with message Connection refused.
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException:
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error
connecting to server localhost on port 1,527 with message Connection refused.
at
liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:69)
at liquibase.integration.commandline.Main.doMigration(Main.java:884)
at liquibase.integration.commandline.Main.run(Main.java:175)
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:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:43)
at
org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.liquibase.gradle.LiquibaseTask.runLiquibase(LiquibaseTask.groovy:97)
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:497)