Quantcast
Channel: Liquibase Forums
Viewing all 2993 articles
Browse latest View live

Re : JIRA registration problem


Re : JIRA registration problem

$
0
0
Thanks for pointing out the jira issue. I'll look into it.

I'll also look at the javacc issue, thanks for creating that Steve.

Nathan

Extending JdbcDatabaseSnapshot 3.5.2

$
0
0
I am writing an extension for Ingres 9. The class liquibase.snapshot.JdbcDatabaseSnapshot includes some database specific code in method getUniqueConstraints (createSql). Is there a way to extend this class to replace this method?

Thanks!

How to add a complete folder to the classpath?

$
0
0
Hi everybody,

I want to add a complete folder to the liquibase classpath. In this folder, the database-driver is stored.


I neither want to copy the driver to another folder (because it is also part of the shipped product) nor I want to specify the concrete jar-file (because we might change the shipped driver-version).


  1. java -jar liquibase.jar --classpath=../../plugins/ --url="jdbc:postgresql://localhost:5432/mydb" --username="postgres" --password="myPassword" dropAll
The driver is located in the plugins-folder of my application.


But I always get the error, that no driver could be found.


Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver


SEVERE 04.11.16 11:16: liquibase: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:127)
at liquibase.integration.commandline.Main.doMigration(Main.java:958)
at liquibase.integration.commandline.Main.run(Main.java:188)
at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:247)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:151)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:85)
... 3 more
Caused by: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:199)
... 5 more



Re : How to add a complete folder to the classpath?

$
0
0
This is a general limitation of java, not liquibase. To fix this, you would need to write your own launcher - either a new version of java.exe or a wrapper script in the scripting language of your choice. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Is the Gradle plug-in advised?

$
0
0
As I'm new to Liquibase, it might be my ignorance, but I wonder whether the Liquibase plug-in is being advised. I have a hard time making it work for me. I would like to generate a change log based on an existing database schema and a set of Spring/Hibernate classes. I came past many unclear error messages, but now I'm stuck on this:

  1. INFO 11/4/16 8:44 PM: liquibase-hibernate: Reading hibernate configuration hibernate:spring:nu.yona.server.subscriptions.entities?dialect=org.hibernate.dialect.HSQLDialect
  2. INFO 11/4/16 8:44 PM: liquibase-hibernate: Found package nu.yona.server.subscriptions.entities
  3. INFO 11/4/16 8:44 PM: liquibase-hibernate: Found dialect org.hibernate.dialect.HSQLDialect
  4. Unexpected error running Liquibase: Unable to resolve persistence unit root URL

  5. SEVERE 11/4/16 8:44 PM: liquibase: Unable to resolve persistence unit root URL
  6. liquibase.exception.DatabaseException: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
Given the amount of unclear messages and the little information I could find on the internet, I started to wonder whether I'm trying something that nobody uses.

My question is actually twofold: should I move on with the Liquibase Gradle plug-in? If so, any idea what could cause the above issue?

For your infomation: this is the Gradle file that I use:
  1. description = 'Database initializer'

  2. buildscript {
  3. repositories {
  4. mavenCentral()
  5. }
  6. dependencies {
  7. classpath("org.springframework.boot:spring-boot-gradle-plugin:$project.ext.springBootVersion")
  8. classpath("io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE")
  9. classpath('se.transmode.gradle:gradle-docker:1.2')
  10. classpath 'net.researchgate:gradle-release:2.3.4'
  11. classpath 'org.liquibase:liquibase-gradle-plugin:1.2.1'
  12. classpath("org.hsqldb:hsqldb:2.3.3")
  13. classpath("org.liquibase.ext:liquibase-hibernate4:3.6")
  14. classpath("org.springframework.boot:spring-boot-starter-data-jpa:1.4.1.RELEASE")
  15. classpath("org.springframework.batch:spring-batch-core:3.0.7.RELEASE")
  16. }
  17. }

  18. apply plugin: 'java'
  19. apply plugin: 'idea'
  20. apply plugin: 'spring-boot'
  21. apply plugin: 'io.spring.dependency-management'
  22. apply plugin: 'docker'
  23. apply plugin: 'net.researchgate.release'
  24. apply plugin: 'liquibase'

  25. jar {
  26. baseName = 'DatabaseInitializer'
  27. }

  28. release {
  29. failOnCommitNeeded = true
  30. tagTemplate = 'adminservice-${version}'
  31. git {
  32. requireBranch = 'yd-40-changes-for-building|master'
  33. }
  34. }

  35. dependencies {
  36. compile project(":core")
  37. compile("org.springframework.boot:spring-boot-starter-data-jpa:1.4.1.RELEASE")
  38. compile("org.springframework.batch:spring-batch-core:3.0.7.RELEASE")
  39. }

  40. group = 'yonadev'

  41. task buildDocker(type: Docker, dependsOn: bootRepackage) {
  42. tag = "${project.group}/yonahsqldb"
  43. push = true
  44. applicationName = jar.baseName
  45. dockerfile = file('src/main/docker/Dockerfile')
  46. doFirst {
  47. copy {
  48. from bootRepackage
  49. into stageDir
  50. rename "${jar.baseName}-${jar.version}-${bootRepackage.classifier}", "${jar.baseName}"
  51. }
  52. copy {
  53. from 'data'
  54. into "$stageDir/data"
  55. }
  56. }
  57. }

  58. bootRun {
  59. enableAssertions=true

  60. systemProperties = [
  61. 'spring.datasource.url': "jdbc:hsqldb:file:../YonaDB",
  62. 'spring.batch.initializer.enabled': "true",
  63. 'spring.jpa.hibernate.ddl-auto': "update"
  64. ]
  65. }

  66. bootRepackage {
  67.         classifier = "full"
  68. }

  69. liquibase {
  70. activities {
  71. main {
  72. changeLogFile 'changelog.groovy'
  73. url 'jdbc:hsqldb:hsql://yonadbserver/xdb'
  74. referenceUrl 'hibernate:spring:nu.yona.server.subscriptions.entities?dialect=org.hibernate.dialect.HSQLDialect'
  75. username 'sa'
  76. password ''
  77. changeLogParameters([ myToken: 'myvalue',
  78. second: 'secondValue'])
  79. }
  80. }

  81. // runList = project.ext.runList
  82. runList = 'main'
  83. }

Re : How to add a complete folder to the classpath?

$
0
0
Thanks for your answer. I never tried it in java, but I thougt, it is possible to add ./my/folder/* to the classpath?!?

However, I solve it within the script.

Best way to create masterdata per tenant / multi-tenancy?

$
0
0
Hello together,

what is the recommended way of liquibase to handle multi-tenant applications with identical database schema but with different masterdata per tenant?

I was thinking of using contexts, but I am wondering if there is any recommended way of doing it? Especially if I consider, that tentant system may also have altering on the database schema.

best wishes

Re : Is the Gradle plug-in advised?

$
0
0
I am not sure of the state of the gradle plugin - but you may get better response to this question on Stack Overflow than in this forum. It has been my experience that there are more people answering questions on S.O. than here. 

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Is the Gradle plug-in advised?

$
0
0
Thank you Steve!
As I guessed so too, I posted it there yesterday. I didn't ask the advise question there, as S.O. doesn't like opinion questions. The underwhelming response answers that question anyway.

Regards,
Bert

Unable to delete changelog files after liquibase operation

$
0
0
I am working with liquibase to update database with temp changlog files and delete then after liquibase operation like executeUpdate.
But file delete operation is failing after liquibase operation, stating "File is opened with other process".

Please let me know does liquibase open lock on file and does not release them till process is executed.

Thanks in advance.

Re : Is the Gradle plug-in advised?

includeAll does not work when running with the maven plugin

$
0
0
Hi everybody,

I have a problem with 'includeAll' when running liquibase via liquibase-maven-plugin 3.5.3.

An example is attached as zip-file shows exactly our use case.It can be executed with the command mvn liquibase:update

It produces the following error:
  1. [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project liquibase-test: Error setting up or running Liquibase: liquibase.exception.SetupException: Cannot find base path 'changelogFiles/master-file.xml' -> [Help

  2. org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project liquibase-test: Error setting up or running Liquibase: liquibase.exception.SetupException: Cannot find base path 'changelogFiles/master-file.xml'
  3.         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
  4.         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
  5.         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
  6.         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
  7.         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
  8.         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
  9.         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
  10.         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
  11.         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
  12.         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
  13.         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
  14.         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
  15.         at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
  16.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  17.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  18.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  19.         at java.lang.reflect.Method.invoke(Method.java:498)
  20.         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
  21.         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
  22.         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
  23.         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
  24. Caused by: org.apache.maven.plugin.MojoExecutionException: Error setting up or running Liquibase: liquibase.exception.SetupException: Cannot find base path 'changelogFiles/master-file.xml'
  25.         at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:398)
  26.         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
  27.         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
  28.         ... 20 more
  29. Caused by: liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Cannot find base path 'changelogFiles/master-file.xml'
  30.         at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27)
  31.         at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:229)
  32.         at liquibase.Liquibase.update(Liquibase.java:202)
  33.         at liquibase.Liquibase.update(Liquibase.java:192)
  34.         at liquibase.Liquibase.update(Liquibase.java:335)
  35.         at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:33)
  36.         at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:30)
  37.         at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:394)
  38.         ... 22 more
  39. Caused by: liquibase.exception.SetupException: Cannot find base path 'changelogFiles/master-file.xml'
  40.         at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:448)
  41.         at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:352)
  42.         at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:282)
  43.         at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25)
  44.         ... 29 more
  45. Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot find base path 'changelogFiles/master-file.xml'
  46.         at liquibase.resource.AbstractResourceAccessor.convertToPath(AbstractResourceAccessor.java:145)
  47.         at liquibase.resource.ClassLoaderResourceAccessor.list(ClassLoaderResourceAccessor.java:61)
  48.         at org.liquibase.maven.plugins.MavenResourceAccessor.list(MavenResourceAccessor.java:29)
  49.         at liquibase.resource.CompositeResourceAccessor.list(CompositeResourceAccessor.java:40)
  50.         at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:425)
We tried some debugging and found out, that the error is thrown when trying to access to the file system via MavenResourceAccessor to target/classes/...

For us it sounds like a bug, but maybe we misunderstand something and it is a feature. Can anyone please help us with that problem.

Running liquibase via commandline would be a workaround for us, but this would lead in higher maintenance-effort for us. So we would prefer to execute it via maven directly in our build.

Re : Best way to create masterdata per tenant / multi-tenancy?

$
0
0
Hi,

I'd also appreciate advice on how to handle this kind of applications, I'm dealing with the same issue.

Thanks in advance.

LiquiBase is throwing UnexpectedLiquibaseException: Cannot find LockService

$
0
0

I am trying to get LiquiBase to work with InstallAnywhere. InstallAnywhere is executing LiquiBase via an ANT target.

It work fine if the ANT target is executed via command line. When I use InstallAnywhere I get the error below. I can't seem to get InstallAnywhere to spit out verbose logging. InstallAnywhere is using ANT 1.71 jars. I used ANT 1.71 via command line, it worked without any issues.

LiquiBase version is 3.4.2 and 3.5.3


WARNING 11/4/16 11:28 AM: liquibase: Unknown database: Microsoft SQL Server build exception C:\ProgramFiles\MyApp\database\sql\build.xml:301: liquibase.exception.UnexpectedLiquibaseException: Cannot find LockService for unsupported at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at com.zerog.ia.installer.util.AntUtility.go(Unknown Source) at com.zerog.ia.installer.actions.AntRunner.installSelf(Unknown Source) at com.zerog.ia.installer.InstallablePiece.install(Unknown Source) at com.zerog.ia.installer.actions.InstallDirectory.install(Unknown Source) at com.zerog.ia.installer.actions.InstallDirectory.install(Unknown Source) at com.zerog.ia.installer.InstallablePiece.install(Unknown Source) at com.zerog.ia.installer.GhostDirectory.install(Unknown Source) at com.zerog.ia.installer.InstallablePiece.install(Unknown Source) at com.zerog.ia.installer.Installer.install(Unknown Source) at com.zerog.ia.installer.actions.InstallProgressAction.ae(Unknown Source) at com.zerog.ia.installer.actions.ProgressPanelAction$1.run(Unknown Source) Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot find LockService for unsupported at liquibase.lockservice.LockServiceFactory.getLockService(LockServiceFactory.java:79) at liquibase.Liquibase.update(Liquibase.java:195) at liquibase.Liquibase.update(Liquibase.java:192) at liquibase.Liquibase.update(Liquibase.java:327) at liquibase.integration.ant.DatabaseUpdateTask.executeWithLiquibaseClassloader(DatabaseUpdateTask.java:35) at liquibase.integration.ant.BaseLiquibaseTask.execute(BaseLiquibaseTask.java:81) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor110.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) ... 16 more
 
Based on the error liquibase: Unknown database: Microsoft SQL Server. LiquiBase can tell that my connection is a MS SQL Server. I took a look at the code, DatabaseFactory looks for classes that extends/implements Database.class. The classes are then stored in theimplementedDatabase map. If that map is correctly populated, it should've found it via the MSSQLDatabase.isCorrectDatabaseImplementation() method because it is trying to match on Microsoft SQL Server for the conn.getDatabaseproductName().

So I am not sure why I am getting this error.  Again it works via command line ANT task, but not via the InstallAnywhere ANT task.  It seems like it finds all the appropriate jars.


Thanks again



DatabaseFactory.getImplementedDatabases()

$
0
0

I think your code is fine because based on the short name there is only one of each.  But if for some reason you have multiple class with the same short name, the code will just return the first one.  Not sure if that is by design.

  1.   public List<Database> getImplementedDatabases()
  2.   {
  3.     List<Database> returnList = new ArrayList();
  4.     for (SortedSet<Database> set : this.implementedDatabases.values()) {
  5.       returnList.add(set.iterator().next());
  6.     }
  7.     return returnList;
  8.   }

What if your set has more than one?  Maybe,
  
   resultList.addAll(set);



Looking for feedback on cross-database support

$
0
0
I'm trying to better understand how the Liquibase cross-database support is used. If you are using the same changelog file across multiple databases, can you comment on what has worked well and what could be improved? 

Has it helped? Or been more trouble than it's worth?

Nathan

endDelimiter="GO;" stops working since 3.5.xxx

$
0
0
Hi
We are using liquibase with MS SQL, a lot of changesets have been already written. And for some reason we are using endDelimiter="GO;" in almost all changesets (please don't ask me why, I haven't an answer )
I've noticed that since liquibase 3.5.xxx such a delimiter doesn't work anymore: liquibase send the query without ";" but with GO, and we catch an error.
Why the Liquibase behavior with delimiter was changed in newest version, is it a bug or you do such a change for some reason? 

Re : Multiple inserts in sqlFile do not fail as expected

$
0
0
Guys I know how to solve this problem
JDBC driver has a very interesting feature: when you execute command containing multiple statements, driver returns only the result of the first statement (resultset for SELECT statement and true/false for other types of statements). If you want to know the results of other statements you should use getMoreResults method of Statement, Resultset or Connection class. And if the error occurs, this method throws an exception. And you should use this method in a cycle until it stops to return new results.
I saw the liquibase code, there is no such an approach implemented. So, my suggestion is to implement this one. I could do it myself via the pull request
I've tested such a way of getting errors against SQL Server JDBC driver and it works out just fine

Re : endDelimiter="GO;" stops working since 3.5.xxx

$
0
0
Some more information: I perform some investigation, it looks like since 3.5.xxx the method which parse string and splits it up to the sql expressions was changed dramatically, no it parse string word by word and work with composite delimiters(that make up more than 1 word) incorrectly
That's why such a delimiter like "\nGO\n" (which need just to make sure that GO isn't a part of any other keyword will not work as well
Viewing all 2993 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>