My liquibase commands for oracle database are failing when mongo-driver and liquibase-extension jars are present on the LIQUIBASE_HOME/lib folder. They run fine if I remove mongo related jars.
Could please look into this and suggest the resoulution.
Below jars were present on my LIQUIBASE_HOME/lib folder while running it for Oracle database.
liquibase-mongodb-4.3.1.jar
mongo-java-driver-3.9.1.jar
ojdbc8-12.2.0.1.0.jar
I ran the following command. I ran it without classpath and driver as well and got the same output.
liquibase --driver=oracle.jdbc.driver.OracleDriver --classpath=C:\apps\liquibase-4.3.1\lib\ojdbc8-12.2.0.1.0.jar --url=jdbc:oracle:thin:@blrdev000330.bpc.broadcom.net:1521:EE --username=system --password=oracle --logLevel=debug history
Please find below debug logs.
[2021-04-01 12:33:02] FINE [liquibase.servicelocator] Loaded liquibase.license.LicenseService instance liquibase.pro.license.keymgr.DaticalTrueLicenseService
[2021-04-01 12:33:02] INFO [liquibase.integration] No Liquibase Pro license key supplied. Please set liquibaseProLicenseKey on command line or in liquibase.properties to use Liquibase Pro features.
Liquibase Community 4.3.1 by Datical
####################################################
####################################################
Starting Liquibase at 12:33:02 (version 4.3.1 #26 built at 2021-02-12 17:41+0000)
[2021-04-01 12:33:02] FINE [liquibase.integration] Liquibase Hub URL: https://hub.liquibase.com
[2021-04-01 12:33:02] FINE [liquibase.integration] Liquibase Hub Mode: all
[2021-04-01 12:33:02] FINE [liquibase.resource] Adding path C:\Users\ashwanipratap. to resourceAccessor liquibase.resource.FileSystemResourceAccessor
[2021-04-01 12:33:02] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.CockroachDatabase
[2021-04-01 12:33:02] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.DB2Database
[2021-04-01 12:33:02] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.Db2zDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.DerbyDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.Firebird3Database
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.FirebirdDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.H2Database
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.HsqlDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.InformixDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.Ingres9Database
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MSSQLDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MariaDBDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MockDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MySQLDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.OracleDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.PostgresDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.SQLiteDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.SybaseASADatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.SybaseDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.UnsupportedDatabase
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.ext.mongodb.database.MongoLiquibaseDatabase
[2021-04-01 12:33:03] FINE [liquibase.database] Properties:
[2021-04-01 12:33:03] FINE [liquibase.database] Key:âuserâ Value:âsystemâ
[2021-04-01 12:33:03] FINE [liquibase.database] Key:âpasswordâ Value:â**********â
[2021-04-01 12:33:03] FINE [liquibase.database] Connecting to the URL:âjdbc:oracle:thin:@blrdev000330.bpc.broadcom.net:1521:EEâ using driver:âoracle.jdbc.driver.OracleDriverâ
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance liquibase.database.jvm.JdbcConnection
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance com.datical.liquibase.ext.database.jvm.ProJdbcConnection
[2021-04-01 12:33:03] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance liquibase.ext.mongodb.database.MongoConnection
Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Could not open connection to database: UNKNOWN
For more information, please use the --logLevel flag
[2021-04-01 12:33:03] SEVERE [liquibase.integration] Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Could not open connection to database: UNKNOWN
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Could not open connection to database: UNKNOWN
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:131)
at liquibase.integration.commandline.Main.doMigration(Main.java:1412)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:364)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.integration.commandline.Main$1.run(Main.java:363)
at liquibase.integration.commandline.Main$1.run(Main.java:193)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:145)
at liquibase.integration.commandline.Main.run(Main.java:193)
at liquibase.integration.commandline.Main.main(Main.java:156)
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Could not open connection to database: UNKNOWN
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:217)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:176)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:141)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:96)
⌠12 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Could not open connection to database: UNKNOWN
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:36)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:214)
⌠15 more
Caused by: liquibase.exception.DatabaseException: Could not open connection to database: UNKNOWN
at liquibase.ext.mongodb.database.MongoConnection.open(MongoConnection.java:104)
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:33)
⌠16 more
Caused by: java.lang.IllegalArgumentException: The connection string contains invalid user information. If the username or password contains a colon ( or an at-sign (@) then it must be urlencoded
at com.mongodb.ConnectionString.(ConnectionString.java:309)
at liquibase.ext.mongodb.database.MongoConnection.open(MongoConnection.java:96)
⌠17 more
Now talking about the logs, if you are trying to connect to Oracle database Iâm curious about how MongoDB logs/exception logs are coming in picture
Could you please check on this point once?
Talking about the exception message : The connection string contains invalid user information. If the username or password contains a colon (:) or an at-sign (@) then it must be urlencoded
This exception is thrown when we try connecting to MongoDB database and the connection string or the username or the password contains : or @. In such a case, itâs a good practice to encode these values and then use them.
This could be the last thing to try out once.
I hope something out from the above mentioned points works out.
Sorry I got the question wrong earlier. Thanks for the clear explanation itâs clear now.
Would you mind trying out with some newer or older version (I would suggest to try with both to have clear idea) of Liquibase once? It could be the case of bug in specific version only. This will give us a confirmation to help improvise liquibase.
We understand that there is a internal Executor which you had to implement and inject with priority.
Have you raised this issue with liquibase to map MongoExecutor(NoSqlExecutor) to LiquibaseMongoDatabase only.
The above Liquibase CLI is explicitly specifying the Oracle driver ( --driver ) and explicitly specifying the Oracle ojdbc jar ( --classpath ):
So in this case, the user has explicitly provided which driver and which classpath should be used. In this case, Liquibase doesnât need to guess/figure out which configuration should be used - as it is explicitly specified by the command line arguments.
Should we use a different folder ( other than lib ) for storing all the required drivers?
We would like to have a single folder location for storing all required drivers - so users can easily extend the Liquibase integration (by adding more drivers to this folder) without any need to update the integration source code.
Having a single location for all drivers is working fine with all other drivers except for MongoDB driver.
Once the MongoDB driver is present at the lib folder - Liquibase is picking it although the specified driver and classpath are specifying Oracle.
Hi @ofer.yaniv even if specified --driver=oracle.jdbc.driver.OracleDriver, looks it get confused on the Liquibase DatabaseConnection implementation it has to use.
Executor is the next thing I suppose has to fail after the DatabaseConnection priority fixed.
For now yes the single option is to have separate folder to be used with Mongo. Indeed the target is to be able to combine any.
Yes, it was communicated to liquibase and the issue raised by @Ashwani_Pratap will properly cover that.
Could you please try to reproduce the issue and confirm that you are indeed experiencing the same?
We would like to know whether we are missing something at the CLI execution or not.
When we remove the mongodb jar file from the lib folder - the exact same CLI command is running successfully.