Ask a Question

[Solved] [JDBC] Cannot connect to a MS SQL database

SOLVED
Xour
Occasional Contributor

[Solved] [JDBC] Cannot connect to a MS SQL database

Hello. I'm having issues connecting to a MS SQL database with JDBC. I went to the JDBC drivers page and saw that there isn't a download link for MS SQL driver. So I went to the Microsoft website and downloaded the Microsoft JDBC Drivers 6.0, 4.2, 4.1, and 4.0 for SQL Server.

 

I extracted the file and added both sqljdbc.jar and sqljdbc4.jar (individually) but whenever I try to test the connection I get the following error message:

 

com.eviware.soapui.support.SoapUIException: Failed to init connection for driver [com.microsoft.sqlserver.jdbc.SQLServerDriver], connectionString [jdbc:microsoft:sqlserver://HOSTNAME\SQLExpress:3306;databaseName=MYDB;user=USER&password=PASS]

 

I checked the SoapUI log and the drivers are being loaded. For example:

 

Mon Dec 05 08:08:21 PST 2016:INFO:Adding [C:\Program Files\SoapUI-5.2.1\bin\ext\sqljdbc.jar] to extensions classpath

 

According to the error log, it seems that the driver loaded isn't the correct one:

 

Mon Dec 05 08:35:48 PST 2016:ERROR:java.sql.SQLException: No suitable driver

 

Obviously I'm doing something wrong here. Can someone help to me to understand where I'm making the mistake? If it helps, the db connection works (checked with MS SQL Server Manager) and I was able to connect to a MySQL db using SoapUI (different db though).

 

Thanks for reading and I appreciate any advice you may have!

20 REPLIES 20

Thanks for the answer @PaulMS, worked like a charm!

 

Copied sqljdbc41.jar and sqljdbc_auth.dll(x64 version for me) in the folder C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext

Restarted SOAPUI(v5.2.1) and voila "The Connection Successfully Tested" pops up on my screen.

cancel
Showing results for 
Search instead for 
Did you mean: