Ask a Question

Cant get JDBC connection to microsoft sqlserver to work

SOLVED
lvogelaar
New Contributor

Cant get JDBC connection to microsoft sqlserver to work

Hello,

 

I'm having issues getting a jdbc connection to work. I've tried several things regarding to other topics but no success so far.

 

So, I'm using ReadyApi 2.2

 

bin\ext folder contains sqljdbc42.jar

bin folder contains sqljdbc_auth.dll

 

Logs at startup:

INFO:Adding [D:\ReadyAPI-2.2.0\bin\ext\sqljdbc42.jar] to extensions classpath

 

connection string template:

jdbc:sqlserver://<HOST:127.0.0.1>:<PORT:1433>;databaseName=<DB>;user=<USER>;password=<PASSWORD>

 

So, when testing the connection I receive the following error message:

 

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'xxx'. ClientConnectionId:4f556d5b-b629-4fde-b1e2-aff498d076ca

 

The logs state:

The JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] is already registered.

 

I'm not using windows authentication:

JDBC:SQLSERVER://serverxxx:1433;databaseName=dbo.xxx;user=xxx;password=PASS_VALUE

where my password is entered in the next field Password.

 

Before upgrading to 2.2 the error message was: java.sql.SQLException: Incorrect URL: 

 

I can login with the specified credentials on the SQL server.

 

Any suggestions?

 

Thanks, Lars

 

 

 

6 REPLIES 6
testhrishi
Frequent Contributor

Try adding sqljdbc4.jar and sqljdbc.jar files in addition to the sqljdbc42.jar that you have

Hello,

 

I've first tried adding the sqljdbc4.jar to bin\ext which gives the same result. Then also the sqljdbc.jar which results in the following error:

 

java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.8 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

 

documentation:

sqljdbc.jar class library requires a Java Runtime Environment (JRE) of version 5.0. Using sqljdbc.jar on JRE 6.0 or JRE 7.0 will throw an exception when connecting to a database.

testhrishi
Frequent Contributor

Sorry I use com.mysql.jdbc.Driver. So you may have other issue with MS drivers

nmrao
Champion Level 3

Alternative library available if you want to try.

Download jtds-1.3.1.jar
And place it under READYAPI_HOME/bin/ext directory and restart.

Use driver class as : net.sourceforge.jtds.jdbc.Driver

Use connection string as :
jdbc:jtds:sqlserver://${dbServer}:${port}/${dbName};domain=${domain}

NOTE: replace the above place holder values.


Regards,
Rao.

Hi Rao,

 

Finally I've managed to get it to work! Thanks for the solution!

nmrao
Champion Level 3

Glad to know that it helped.


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: