Spring boot 1.5.2 Hibernate does not support SQLite3? - java

I've searched lot in the Internet but cannot find a solution to make Spring Hibernate works with SQlite (e.g: this answers https://stackoverflow.com/a/24233241/2028440 told to make a custom SQLite package and it is not ideally, I'd expect to have a .jar file as a dependency from Maven repository for SQL dialect).
I also tried this jar library https://github.com/EnigmaBridge/hibernate4-sqlite-dialect in POM as:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.16.1</version>
</dependency>
<dependency>
<groupId>com.enigmabridge</groupId>
<artifactId>hibernate4-sqlite-dialect.git</artifactId>
<version>0.1.0</version>
</dependency>
and in application.properties:
spring.datasource.url = jdbc:sqlite:test.db
spring.datasource.driver-class-name = org.sqlite.JDBC
spring.jpa.properties.hibernate.dialect = com.enigmabridge.hibernate.dialect.SQLiteDialect
However, I got the error when running the web application from Spring boot hibernate
Caused by:
org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [com.enigmabridge.hibernate.dialect.SQLiteDialect] as strategy [org.hibernate.dialect.Dialect]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:113) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:162) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:126) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
If anyone has some suggestions, please help, thanks!

Related

How to set up IRIS database with Quarkus

I'm trying to use Intersystems IRIS Database with
Quarkus, but I'm getting problems making it work
does anyone knows how to set up the Intersystems IRIS Database
on Quarkus ?
I did that on my pom.xml and also I added the jar
hibernate-iris-1.0.0.jar and intersystems-jdbc-3.2.0.jar but it's not working
<dependency>
<groupId>com.intersystems</groupId>
<artifactId>intersystems-jdbc</artifactId>
<version>3.2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/intersystems-jdbc-3.2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-iris</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/hibernate-iris-1.0.0.jar</systemPath>
</dependency>
This is my application.properties
quarkus:
datasource:
db-kind: other
username: _system
password: *****
jdbc:
url: jdbc:IRIS://localhost:1972/USER
driver: com.intersystems.jdbc.IRISDriver
hibernate-orm:
dialect: org.hibernate.dialect.InterSystemsIRISDialect
jdbc:
timezone: UTC
I found the solution, to set up Intersystems IRIS on Quarkus you need to add manually the jar file, and also you need to set up the pom.xml also some setup from Intersystems was made as a java class. you can see the solution looking at my project on GitHub
this is the link: https://github.com/JoseAdemar/quarkus-project-with-intersystems-ris-database

Oracle 10.2.0.4.0 and ojdbc11-21.1.0.0.jar || Failed to obtain JDBC Connection; nested exception is ja │ │ ORA-01882: timezone region not found

I am having a springboot application where I am trying to connect to very old Oracle version 10.2.0.4.0 datasource.
My pom.xml has:
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>21.1.0.0</version>
</dependency>
And my dockerfile has the similar above settings. While deploying code on the pod level, I get an exception that:
Failed to obtain JDBC Connection; nested exception is ja │ │ ORA-01882: timezone region not found
Oracle 10.2.0.4.0 has a Timezone 4. And my springboot application ojdbc driver is not compatible with the older oracle datasource.
I googled and found that I can use below dependency for this Oracle 10.2.0.4.0 version.
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
ojdbc14 is the correct jar file to be pulled either by Maven which fails : no artifacts found.
When I tried to download ojdbc14.jar and tried manual settings in pom.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc14.jar</systemPath>
</dependency>
Then I get an error while deployment at pod level which says that no suitable driver found.
Now I am stuck, on how to solve this problem.
Refer to the correct central maven repository for Oracle JDBC driver.
The other repository that you are using for 10.2.0.4 is not from Oracle and is very old and not supported.

Not able to connect spring jpa with Oracle

Hi I am using below configuration still I am getting error.
spring.datasource.url=jdbc:oracle:thin#sca00tof.us.dell.com:1521:mfg1229
spring.datasource.username=apps
spring.datasource.password=xxxx
spring.datasource.driver-class=oracle.jdbc.driver.OracleDriver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=Oracle12cDialect
below dependency i used in pom.xml
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
still I am getting below error.
Caused by: java.lang.ClassNotFoundException: Could not load requested class : Oracle12cDialect
at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:210) ~[hibernate-core-5.4.23.Final.jar:5.4.23.Final]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Clas?s.forName(Class.java:427) ~[na:na]
enter code here
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:130) ~[hibernate-core-5.4.23.Final.jar:5.4.23.Final]
... 28 common frames omitted
WHat is the problem in my configuration. instead of driver-class i also checked with driver-class-name
I checked OracleDialect, Oracle10gDialect and Oracle12cDialect . for all the 3 i am getting same error.
there is nothing like "Oracle12cDialect" dialect. you need to write in proper way. :--
in your property file it is:
spring.jpa.properties.hibernate.dialect=Oracle12cDialect
spring.datasource.driver-class=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin#sca00tof.us.dell.com:1521:mfg1229
but it should be:--
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle12cDialect
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin#//sca00tof.us.dell.com:1521/mfg1229
if does not work then please change to:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
The dialect for Oracle12c can be use with hibernate 5.x.
You should add this to your classpath:
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.24.Final</version>
</dependency>
Please note that you need the dialect for the coreesponding Version of Oracle DB.
How ever I can't see the exact framework you are using. Please check that the obove dependency is part of your classpath. This may come with other dependencies such as JPA oder spring-data.
Also please note that your jdbc string seems to be wrong.
It should look like this:
url="jdbc:oracle:thin:#sca00tof.us.dell.com:1521:mfg1229"
See here for details: URL string format for connecting to Oracle database with JDBC

Importing a new cassandra related POM dependency in project resulting in run time errors

I'm getting the following errors :
Caused by: javax.persistence.PersistenceException: Failed to load provider from META-INF/services
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:115)
at javax.persistence.Persistence$PersistenceUtilImpl.isLoaded(Persistence.java:278)
at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:62)
at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:94)
at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:757)
... 96 more
Caused by: java.lang.ClassNotFoundException: me.prettyprint.hom.CassandraPersistenceProvider
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.geronimo.osgi.locator.ProviderLocator.loadClass(ProviderLocator.java:195)
at org.apache.geronimo.osgi.locator.ProviderLocator.locateServiceClasses(ProviderLocator.java:524)
at org.apache.geronimo.osgi.locator.ProviderLocator.getServices(ProviderLocator.java:315)
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:108)
... 101 more
I have imported a pom dependeny in my project, the new pom dependeny inturn has some cassandra related dependeny shown below :
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>3.0.0</version>
</dependency>
The cassandra project works good in stand alone. Can someone help me with this
Your project is complaining ClassNotFoundException:me.prettyprint.hom.CassandraPersistenceProvider which belongs to Cassandra hector client.
I am guessing your project was using hector core which is no longer active hector client github page. You have to migrate all dependencies to datastax's cassandra drivers and remove all hector-client related dependencies. check it here

Spring Boot Unable to load class: com.microsoft.sqlserver.jdbc.SQLServerDriver

I've created a new Spring Boot project. I'm trying to setup a DataSource to use MSSQL. However I seem to be getting the error "Unable to load class: com.microsoft.sqlserver.jdbc.SQLServerDriver"
I've placed the file jdbcsql4.jar in a folder in my project /lib/jdbcsq4.jar
In my pom.xml file I've added the following:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>system</scope>
<optional>true</optional>
<systemPath>${basedir}/lib/sqljdbc4.jar</systemPath>
</dependency>
I have an application.properties file, and I'm defining the database credentials like this:
secondary.datasource.url = jdbc:sqlserver://1.1.1.1:50109
secondary.datasource.username = sa
secondary.datasource.password = mypassword
secondary.datasource.driver-class-name = com.microsoft.sqlserver.jdbc.SQLServerDriver
Can anyone possibly indicate where I may be going wrong?
I managed to solve this issue by following the instructions in this link http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/
EDIT:
The original link above no longer exists, but here's a similar link.
http://biercoff.com/add-microsoft-sql-jdbc-driver-to-maven/
For the ppl who facing these issue.
Add dependency in POM.
Microsoft finally made the driver available on the Maven Central Repository.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
you can check here.
Microsoft link

Categories

Resources