TestContainer Oracle - oracle

according to https://www.testcontainers.org/modules/databases/jdbc/#database-containers-launched-via-jdbc-url-scheme , i'm trying to create an Oracle Container with Quarkus using jdbc url scheme.
After provided a valid docker image ("store/oracle/database-instantclient:12.2.0.1") and set this properties:
"%test":
quarkus:
datasource:
jdbc:
driver: org.testcontainers.jdbc.ContainerDatabaseDriver
url: jdbc:tc:oracle:///databasename
db-kind: other
i get this error:
Container is started (JDBC URL: jdbc:oracle:thin:system/oracle#localhost:32827:xe)
2020-11-09 17:33:06,719 INFO [🐳 .2.0.1]] (Agroal_13889837441) Container store/oracle/database-instantclient:12.2.0.1 started in PT4M7.8483772S
2020-11-09 17:33:06,738 WARN [io.agr.pool] (Agroal_13889837441) Datasource '<default>': Could not create new connection
2020-11-09 17:33:06,805 ERROR [io.qua.application] (main) Failed to start application (with profile test): org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database: Could not create new connection
--------------------------------------------------------------------------
SQL State : null
Error Code : 0
Message : Could not create new connection
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:65)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80)
at org.flywaydb.core.Flyway.execute(Flyway.java:453)
at org.flywaydb.core.Flyway.migrate(Flyway.java:158)
Can someone help me?

If I remember correctly, Flyway community editions (that ships with Quarkus) does not have support for Oracle. You need to use the Enterprise edition.
You need to replace the Quarkus Flyway dependency. Just exclude the one included and add the enterprise one (either in Maven or Gradle).

Related

Spring Boot App using MYSQL not starting - url attribute is not specified

I was following some tutorials and docs on how to connect Spring Boot apps with MySQL database but it gives me a start up error all the time even tho I have the url specified in the app.properties file.
spring.datasource.url=jdbc:mysql://localhost:3306/cryptodb01
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
spring.jackson.serialization.indent-output=true
I am getting this error everytime I try to run the app:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
My dependencies are these

liquibase.exception.DatabaseException: Syntax error in SQL statement " CREATE EXTENSION[*] UUID-OSSP;

Im using postgres with liquibase on cloud and h2db on my local machine. When i write sql queries for generating uuid, i get the error during build:
liquibase.exception.DatabaseException: Syntax error in SQL statement " CREATE EXTENSION[*] UUID-OSSP;
So i removed ossp extension and used gen_random_uuid() instead. And i get the below eror:
Caused by: liquibase.exception.LiquibaseException:
liquibase.exception.MigrationFailedException: Migration failed for change set db/scripts/123_Somescripts.sql::raw::includeAll:
Reason: liquibase.exception.DatabaseException: Syntax error in SQL statement "
I start getting this error during build when i include H2 DB dependency. Otherwise the build works fine.
BUT, even if build works fine, i get the error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Process finished with exit code 0
I configured postgres db in appication-local.yml, and activated local profile but build still fails.

No suitable driver found for jdbc:mysql in Kafka Connect

connect-standalone.properties
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
bootstrap.servers=10.33.62.20:9092,10.33.62.110:9092,10.33.62.200:9092
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=true
value.converter.schemas.enable=true
offset.storage.file.filename=/tmp/connect.offsets
offset.flush.interval.ms=10000
plugin.path=/grid/1/mukul/confluent-5.0.0/share/java
source-sqlite.properties
name=test-source-sqlite-jdbc-autoincrement
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=5
connection.url=jdbc:mysql://10.32.177.178:3306/test&user=xxxx&password=xxxxx
table.whitelist=banner_hourly_statistics_v2
group.id=test-mysql-kafka
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
config.storage.topic=demo-1-distributed-config
offset.storage.topic=demo-1-distributed-offset
status.storage.topic=demo-1-distributed-status
bootstrap.servers=10.33.62.20:9092,10.33.62.110:9092,10.33.62.200:9092
mode=bulk
#incrementing.column.name=id
topic.prefix=test-sqlite-jdbc-
CMD: connect-standalone /grid/1/mukul/confluent-5.0.0/etc/kafka/connect-standalone.properties /grid/1/mukul/confluent-5.0.0/etc/kafka-connect-jdbc/source-quickstart-sqlite.properties
In the startup logs, it clearly shows loading JDBC Connectors:
[2018-08-09 06:59:30,072] INFO Loading plugin from: /grid/1/mukul/confluent-5.0.0/share/java/kafka-connect-jdbc (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:218)
[2018-08-09 06:59:30,133] INFO Registered loader: PluginClassLoader{pluginLocation=file:/grid/1/mukul/confluent-5.0.0/share/java/kafka-connect-jdbc/} (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:241)
[2018-08-09 06:59:30,133] INFO Added plugin 'io.confluent.connect.jdbc.JdbcSinkConnector' (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:170)
[2018-08-09 06:59:30,133] INFO Added plugin 'io.confluent.connect.jdbc.JdbcSourceConnector' (org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader:170)
But it fails with following exception:
Invalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://10.32.177.178:3306/test&user=xxxx&password=xxxx for configuration Couldn't open connection to jdbc:mysql://10.32.177.178:3306/test&user=xxxx&password=xxx
Invalid value java.sql.SQLException: No suitable driver found for jdbc:mysql://10.32.177.178:3306/test&user=xxxx&password=xxxx for configuration Couldn't open connection to jdbc:mysql://10.32.177.178:3306/test&user=xxxx&password=xxxx
You can also find the above list of errors at the endpoint `/{connectorType}/config/validate`
at org.apache.kafka.connect.util.ConvertingFutureCallback.result(ConvertingFutureCallback.java:79)
at org.apache.kafka.connect.util.ConvertingFutureCallback.get(ConvertingFutureCallback.java:66)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:110)
Tried changing the plugin directories too but it didn't work. Tried moving the confluent share/* to /usr/share/java too but it also didn't work.
Download the JAR from the URL: https://dev.mysql.com/downloads/connector/j/5.1.html
Place inside the Plugin dir
Run the connect
It will take start pulling data from MySql.
May be a little late. I had the same issue of "No Driver found.." when I connect DB2 using kafka jdbc connector.
1st Possible Solution:
I resolved it by placing the DB2 driver at the exact location where jdbc-connector is.
With in Kafka connect:
find / -name kafka-connect-jdbc\*.jar
Once you found the location from the above command, copy DB2 jar at that location:
cp {your DB2 jar location}/db2.jar {copy the location from 'find' command}
Example
cp /Download/db2.jar /Users/share/java/kafka-connect-java/
Restart kafka-connect, it will pick up the DB2 drivers
2nd Possible Solution:
Download the jt400 jar (jdk-8) and put it next to the other jdbc drivers (DB2, SQL etc)
Happy coding :)

OrientDB 2.2.3 in OSGI environment

I have a pretty small OSGI application running in Apache Karaf, and it work fine on OrientDB version 2.1.11. But I've faced with following error when tried to start it on new 2.2.3 version:
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database 'remote:/localhost/testdb'
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.<init>(OPartitionedDatabasePool.java:118)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.<init>(OPartitionedDatabasePool.java:114)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.initQueue(OPartitionedDatabasePool.java:442)
This error occures on application install time when it's trying to initialise DB connection pool. After some debugging I found that the root problem is in method registerEngines() of class com.orientechnologies.orient.core.Orient where OrientDB classloader tries to find all implmentations of OEngine interface:
Iterator<OEngine> engines = OClassLoaderHelper.lookupProviderWithOrientClassLoader(OEngine.class, classLoader);
This call returns only 2 implementations, plocal and memory (located in the same bundle as registerEngines() - orientdb-core). The remote engine (com.orientechnologies.orient.client.remote.OEngineRemote) is located in orientdb-client bundle and OrientDB classloader can't find it.
Here is code fragment that creates DB connection poll and produces described error:
log.info("Creating OrientDB connection pool");
OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_ENABLED.setValue(true);
OPartitionedDatabasePool connectionPool = new OPartitionedDatabasePool(url, user, password);
log.info(String.format("Created OrientDB connection pool: url=%s", url));

Error:Unable to connect to database. Driver class not found: com.ibm.db2.jcc.D B2Driver

I am trying to connect to a DB2 database that I just created. I have CLASSPATH pointing to the two necessary jar files: C:\Program Files (x86)\IBM\SQLLIB\java\db2jcc.jar;C:\Program Files (x86)\IBM\SQLLIB\java\db2jcc_license_cu.jar
My connection configuration file looks like
database.driverClassName=com.ibm.db2.jcc.DB2Driver
database.url=jdbc:db2:test
database.userName=test
database.schemaNames=test
database.password=test
database.driverLocation='C:\Program Files (x86)\IBM\SQLLIB\java\db2jcc.jar'
When I try to connect I get the error:
Creating data source. Driver: com.ibm.db2.jcc.DB2Driver, url: jdbc:db2:test, us
er: test, password: test
# Error:Unable to connect to database. Driver class not found: com.ibm.db2.jcc.D
B2Driver
# Cause:com.ibm.db2.jcc.DB2Driver
I am fairly new to this so I would appreciate any help on what I am doing wrong.
Thanks

Resources