jdk17 application not able to connect to sybase - sybase

This application runs without any error with jdk8.
jdk version jdk17
jConnect dependency
<dependency>
<groupId>com.sybase.jconnect</groupId>
<artifactId>jconn4</artifactId>
<version>7.07-27307</version>
</dependency>
oracle dependency
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8_g</artifactId>
<version>12.2.0.1</version>
</dependency>
Error : Could not load JDBC driver class [com.sybase.jdbc4.jdbc.SybDriver]
I tried by upgrading jConnect jar to 16.039-27463 and ojdbc to ojdbc10 version 19.3 but of no use.
Did anyone face this before and how got it fixed.

Related

spring boot configuration with MS SQL Server 2016

I am trying to connect to Microsoft SQL Server 2016 from spring boot application. SQL server is configured using windows authentication.
Following are the configuration
application.properties file
spring.datasource.url=jdbc:sqlserver://K877DTRV:1433;databaseName=testdb;integratedSecurity=true
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.initialize=true
pom.xml
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
java version is 1.8.spring boot version is 2.0.3.RELEASE
I am getting the below error while starting the tomcat
Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Should I do any additional configurations?
Note: I am using Windows Authentication.
Can anyone please help ?
Setting a version to the pom entry for mssql-jdbc worked like a charm
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.4.0.jre8</version><!--$NO-MVN-MAN-VER$-->
</dependency>

cxf-codegen-plugin illegal configuration-file syntax

I am trying to update some web services code developed for Java 6 to Java 8. The modules use the maven cxf-codegen-plugin. The Java 6 version used cxf version 2.2.2. I was able to get it working with Java 7 by updating cxf to 2.7.9 but haven't be able to build under Java 8. I tried updating cxf to 3.0.3 but still get this error:
XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sum.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.xml.xpath.XPathFactory: jar:file:/c:/Documents%20and%20Settings/Kevin/.m2/repository/saxon/saxon-xpath/8.9.0.3/saxon-xpath-8.9.0.3.jar!META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax
I am using jdk 1.8.0_31, maven 3.0.3 and cxf 3.0.3.
The problem comes from an incompatible version of saxon-he. It can easily be solved by adding a fixed version to the classpath oth the maven plugin (as dependency):
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-version}</version>
<dependencies>
<dependency>
<groupId>org.daisy.libs</groupId>
<artifactId>saxon-he</artifactId>
<version>9.5.1.5</version>
</dependency>
</dependencies>
<executions>

Flyway Unable to instantiate jdbc driver

Just starting out with Flyway and Spring 3.0. So far, all I did was add the Flyway dependency and plugin to my pom.xml. Next, I tried running mvn flyway:status in the command line. However, it complains that it is unable to instantiate the jdbc driver (I'm using postgres).
Does anybody know what might be causing this? I'm using Springsource Tool Suite to develop my app. The postgres driver is located under WEB-INF/lib/postgresql-9.1-902.jdbc4.jar
Any help is greatly appreciated! Thanks!
For the Maven plugin to work you must:
Add this dependency to your project (or just the plugin):
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
and configure the plugin like this:
<plugin>
<groupId>com.googlecode.flyway</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://...</url>
<user>...</user>
<password>...</password>
</configuration>
</plugin>
You also have to provide the Postgresql jdbc drivers as a maven dependency:
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-902.jdbc4</version>
</dependency>

Error when doing "mvn gae:run" using Spring Roo on Google App Engine with GWT

There seems to be a problem with Spring Roo, GAE, and GWT.
Here is a simple roo script.
project --topLevelPackage com.my.gae --projectName gaetest --java 6
persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
entity jpa --class ~.domain.Person
field string --fieldName name
web gwt setup
web gwt all --proxyPackage ~.proxy --requestPackage ~.request
web gwt gae update
logging setup --level DEBUG
roo script <path-to-above-script>
Fix a bug in the pom by adding <scope>runtime</scope> to the datanucleus-core dependency
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.7</version>
<scope>runtime</scope>
</dependency>
3. mvn gae:run
There will be many errors.
[INFO] Checking rule
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/req
uest/ApplicationRequestFactory.java'
[INFO] [ERROR] Line 11: No source code is available for type com.my.gae.request.PersonRequest; did you
forget to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationDetailsActivities_Roo_Gwt.java'
[INFO] [ERROR] Line 29: No source code is available for type com.my.gae.proxy.PersonProxy; did you for
get to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationMasterActivities_Roo_Gwt.java'
I am using 1.2.1.RELEASE [rev 6eae723] of Roo.
Is there a workaround or perhaps I have made an error ?
I was getting several errors as well when trying to create GWT application for the Google App Engine using Spring Roo 1.2.1. I created my project using the SpringSource Tool Suite (STS). Took me forever, but I finally got it working by making some changes to my pom.xml.
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.0.7</version>
</dependency>
I also enabled Datanucleus Support (right click on project, Datanucleus -> Add Data Nucleus Support), then enhanced the classes manually (right click on project, Datanucleus -> Run Enhancer Tool). These Datanucleus steps failed without the preceding pom.xml changes.
The application launches fine. However, now I can't get the RequestValidationTool to work.

Setting up maven dependency for SQL Server

I am developing a portlet where I have Hibernate access to SQL Server database. I set up maven dependencies for it and try to find out SQL Server connector on the same way I know MySql has it.
Still my Google-search gives only Mysql if I search for SQL Server connector. What is the right maven dependency value?
Download the driver JAR from the link provided by Olaf and add it to your local Maven repository with;
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
Then add it to your project with;
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
Answer for the "new" and "cool" Microsoft.
Yay, SQL Server driver now under MIT license on
GitHub: https://github.com/Microsoft/mssql-jdbc
Maven Central: http://search.maven.org/#search%7Cga%7C1%7Cmssql-jdbc
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
Answer for the "old" Microsoft:
For my use-case (integration testing) it was sufficient to use a system scope for the JDBC driver's dependency as such:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>3.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/sqljdbc4.jar</systemPath>
<optional>true</optional>
</dependency>
That way, I could put the JDBC driver into local version control. No need to have each developer manually set stuff up in their own repositories.
I took inspiration from this answer to another Stack Overflow question and I've also blogged about it here.
There is also an alternative: you could use the open-source jTDS driver for MS-SQL Server, which is compatible although not made by Microsoft.
For that driver, there is a maven artifact that you can use:
http://jtds.sourceforge.net/
From http://mvnrepository.com/artifact/net.sourceforge.jtds/jtds :
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
UPDATE nov 2016, Microsoft now published its MSSQL JDBC driver on github and it's also available on maven now:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
I believe you are looking for the Microsoft SQL Server JDBC driver: http://msdn.microsoft.com/en-us/sqlserver/aa937724
Be careful with the answers above. sqljdbc4.jar is not distributed with under a public license which is why it is difficult to include it in a jar for runtime and distribution. See my answer below for more details and a much better solution. Your life will become much easier as mine did once I found this answer.
https://stackoverflow.com/a/30111956/3368958
Even after installing the sqlserver jar, my maven was trying to fetch the dependecy from maven repository. I then, provided my pom the repository of my local machine and it works fine after that...might be of help for someone.
<repository>
<id>local</id>
<name>local</name>
<url>file://C:/Users/mywindows/.m2/repository</url>
</repository>
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>sqljdbc4-chs</artifactId>
<version>4.0.2206.100</version>
</dependency>
This worked for me(if you use maven)
https://search.maven.org/artifact/com.hynnet/sqljdbc4-chs/4.0.2206.100/jar
It looks like Microsoft has published some their drivers to maven central:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>

Resources