I spent a good part of my evening setting up a Glassfish 5.0.1 server configuring a JDBC Connection Pool and deploying an application. The issue I keep running into: Unable to Connect to JDBC Connection Pool from Glassfish and GlassFish connection pool
In Glassfish for MySQL everywhere states to use the Resource Type: javax.sql.DataSource and Datasource Classname: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
The above never worked no matter where I put the MySQL Connector jar glassfish/lib or domain/domain1/bin/lib. All times I deleted the pool I had, cleared the cache and restarted the servers.
I ended up switching to java.sql.Driver and Driver Classname: com.mysql.jdbc.Driver
Question are how do I make the Datasource work?
Also, what is the difference between Driver and Datasource?
Edit
Same issue with Payara-5. I am putting the jar in lib/ext but the Driver failed in the same way and was resolved with it there.
Ping Connection Pool failed for MySQLConnPool2. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.
In the 5.0 to 8.0 release notes there is a reference to a change in the package name from com.mysql.jdbc to com.mysql.cj. Looking at mysql-connector-java-8.0.12.jar, there appears to be an undocumented change in the package for the data source to com.mysql.cj.jdbc.MysqlDataSource.
I have tested using com.mysql.cj.jdbc.MysqlDataSource in Payara 5 from the admin console, and it works :-)
I had the same problems at glassfish 5.0 with mysql-connector-8.0.16.jar. A look in the documentation of glassfish we had to place the mysql-connector-5.1.47-bin.jar into the domains/domain1/lib directory. The connector of 8.0 has no *-bin.jar file. So I tried to place the *5.1.47-bin.jar into the domain1/lib directory. After the restart of my glassfish server, I tried to define a new Connection-Pool for MySQL with a javax.sql.XADataSource and the DataSourceName com.mysql.jdbc.jdbc2.optional.MysqlXADataSource. After setting the properties as described in glassfish documentation MySQL Server Database Type 4 Driver I got a successfull ping
Related
I have configured a sybase datasource on websphere applicaiton server 9 installed on Linux,and trying to test it. But it fails with below exception
>DSConfigurati W DSRA8201W: DataSource Configuration: DSRA8040I: Failed to
>connect to the DataSource jdbc/gbs. Encountered java.sql.SQLException: JZ006:
>Caught IOException: java.io.IOException: JZ0TS: Truncation error trying to
>send GBSëüÃÂâóýÃÂòîêðûL. DSRA0010E: SQL State = JZ006,
during data source configuration ,I have added couple of custom properties for data source and they are
> networkProtocol : Tds
> connectionProperties:
>SELECT_OPENS_CURSOR=true;applicationName=GBS«¼Æ¢ó½Ç²îª°»L
I just searched the Sybase error code JZ0TS in here infocenter.sybase.com/help/index.jsp?topic=/…, but that really dint help me .
What I observed is the custom property value GBS«¼Æ¢ó½Ç²îª°»L is getting changed to GBSëüÃÂâóýÃÂòîêðûL , during connectivity testing. How to avoid this.
Can any one help me on this.
The Environment I have used for this are ...
Websphere Application Server 9.0.0.10
Sybase Jconnect 3 jar and the
OS where the WAS 9.x installed is Linux.
I have tried the same test datasource connection verificaiton on Websphere application server version 9 installed on Windows 10 , it worked fine , without any issues.
Am trying to connect MS SQL server through java web applications.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection= DriverManager.getConnection("jdbc:sqlserver://localhost;databaseName=XXX;integratedSecurity=true");
I have copied "sqljdbc_auth.dll" to $Tomcat_home/bin and copied jar into $Tomcat_home/lib folder.
I Have multiple web apps in same tomcat instance.
The first webApp loads and successfully establishes the connection with MS SQL.
But the remaining apps fail to connect to MS SQL prompting:
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:41d72756-1383-427e-8c4f-c3075ae1559a
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2400)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:68)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3132)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43)
Note: Tomcat runs as windows service. And MSSQL is configured to windows authentication.
edit:
I understand that the native library (DLL) can only be loaded into the JVM once, hence the error, but I after looking around the net I still have no solution.
sqljdbc_auth.dll is need to use windows authentication or Kerberos authentication.
Get the dll from Microsoft and install it either by:
drop on application library folder
drop on the java bin folder.
Not recommended if you want to package the applications with all the
dependencies. Also, it requires to find what java version is being
used and from what path.
drop the library on some folder and then add the path in the command line:
java -Djava.library.path=<library path>...
The mssql-jdbc driver and the sqljdbc_auth.dll should be:
on the same folder
both from the same version
for the same architecture (x86/x64) JVM is running.
Check also the jdbc comparability matrix with java versions.
The JDBC driver supports the use of Type 2 integrated authentication on Windows operating systems through the integratedSecurity connection string property. To use integrated authentication, copy the sqljdbc_auth.dll file to a directory on the Windows system path on the computer where the JDBC driver is installed.
Alternatively you can set the java.libary.path system property to specify the directory of the sqljdbc_auth.dll. For example, if the JDBC driver is installed in the default directory, you can specify the location of the DLL by using the following virtual machine (VM) argument when the Java application is started:
-Djava.library.path=c:/sqljdbc_<version>/enu/auth/x86
or
-Djava.library.path=c:/sqljdbc_<version>/enu/auth/x64
Please read more about in the original documentation:
https://learn.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017
In order to be able to connect with the JDBC, you need to define the connection as follows:
"jdbc:sqlserver://*******
;authenticationScheme=NTLM;integratedSecurity=true;domain=******
****;databasename=**********;encrypt =
true;trustServerCertificate=true;user=*******;password=*******;"
Use the following dependency:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.0.jre8</version>
</dependency>
I am trying to configure activiti to communicate ms-sql 2014 with windows authentication instead of with username/password in connection url.
What i have done ?
downloaded JDBC Driver, put sqljdbc4-3-0.jar in JAVA_HOME and in the web-info\lib
put sqljdbc_auth.dll (64bit) in C:\Windows\System32
set integrated security in db.properties as following:
db.properties (C:\Workflow\apache-tomcat-7.0.62\webapps\activiti-explorer\WEB-INF\classes):
db=mssql
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://127.0.0.1:1433;databaseName=activiti;integratedSecurity=true;
When using regular authentication (I remove the integratedSecurity=true and add user=XXX and password=XXX it works!)
When I open log the last line is:
DEBUG org.springframework.jdbc.datasource.SimpleDriverDataSource: Creating new JDBC Driver Connection to [jdbc:sqlserver://localhost;databaseName=activiti;integratedSecurity=true;]
Then the java application shutsdown and i see hs_err_pid4232.log as attached with exception:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000061a3cf13, pid=4232, tid=8080
What can cause this not to work ?
I want thinking maybe it did not load the DLL/JARS it should be in order to use JDBC driver ? the sql server config looks like this:
The log of process crush is at: http://pastebin.com/xpW5yvEP
This error screams "trouble with the authentication dll". Try these steps:
Download latest sqljdbc, unzip it locally from here: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
put the .jar in your classpath and the .dll in your library path. Try using a "real" path by adding -Djava.library.path=PATH/TO/DLL into your startup.
run java -fullversion to make sure you have the right .dll (32 bit vs 64 bit) installed there.
run program again.
I have installed Hadoop & connected with Hadoop locally successful. I can connect the Sqoop via REST api and via cli interface.
But once I want to start creating a job for important data from MySQL. It shows
Connection configuration Warning message: Can't connect to the
database with given credentials: No suitable driver found for
jdbc:mysql://127.0.0.1:3306/for
Error message: Can't load specified driver
after google its solution, I has already
put the mysql-connector.jar to sqoop web lib folder
create a lib folder under the sqoop folder and put the mysql-connector.jar in it
I also have restarted or even reboot my VM. It still says cannot load specified driver.
Is there any config files I have missed to set? Thank you!
My ENV:
VirtualBox + Vagrant + Ubuntu 12.04
JDK (Sun Distrubution 1.7_update 51)
Hadoop 2.2.0 (complied version)
Sqoop 1.99.3 (complied version)
Thank again!
check your 'JDBC Driver Class' of the connection you just created in sqoop,it should be setted
as com.mysql.jdbc.Driver.
If still not work,put mysql-connector-java-3.1.12-bin.jar into $SQOOP_HOME/server/lib
I've inherited a project (and I have absolutly no experience of Java) and I'm rather stuck.
We have a server running redhat, which I needed to update one of the jar files. So I simply copied up the updated file and restarted the service for that file. However this process has worked on our other server I did that too but on this one it comes up with the below in the log file.
Exception: com.mysql.jdbc.Driver
SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbanme
The jar files are uploaded to a folder in the root of the website and within that jar folder is a lib folder where mysql-connector-java-5.1.6-bin.jar is located.
Does anyone know what I could be missing as I'm a newbie to linux aswell.
Thanks in advance
java.sql.SQLException: No suitable driver found
This exception can have 2 causes:
The JDBC driver is not loaded at all.
URL does not match any of the loaded JDBC drivers.
Since the driver seems to be loaded , it look like that the URL is not valid on that machine:
jdbc:mysql://localhost:3306/dbname
Do you have mysql running and listening on port 3306 on that machine. Also make sure you hte schema dbname there.
You need only set that:
[jdbc:mysql://localhost/dbanme]
instead of
[jdbc:mysql://localhost:3306/dbanme]
Because java compiler default understand a port 3306, so no need to fill "3306" after "localhost:"