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

**URL:** <https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162>\
**Category:** SoapUI OS\
**Tags:** api, soapui, migrated, jdbc, mssql\
**Created:** [December 5, 2016, 4:38pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162 "2016-12-05T16:38:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 5, 2016, 4:38pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/1 "2016-12-05T16:38:34Z")

</div>

> Originally posted by **Xour** on December 05, 2016

Hello. I’m having issues connecting to a MS SQL database with JDBC. I went to the [JDBC drivers page](https://www.soapui.org/jdbc/reference/jdbc-drivers.html) 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](https://www.microsoft.com/en-us/download/details.aspx?id=11774).

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!

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 4:40am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/2 "2016-12-07T04:40:57Z")

</div>

> Originally posted by **PaulMS** on December 06, 2016

I had the same problem because the connection string example on the [JDBC Driver List](https://www.soapui.org/jdbc/reference/jdbc-drivers.html) page is wrong.

_jdbc:microsoft:sqlserver://HOSTNAME\SQLExpress:3306;databaseName=MYDB;user=USER&password=PASS_

_should be_

_jdbc:sqlserver://HOSTNAME\SQLExpress:3306;databaseName=MYDB;user=USER;password=PASS_

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 4:21pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/3 "2016-12-07T16:21:50Z")

</div>

> Originally posted by **Xour** on December 07, 2016

I realized that yesterday morning, forgot to update the thread!

Took me quite a while to figure it out haha

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 4:41pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/4 "2016-12-07T16:41:51Z")

</div>

> Originally posted by **divergentor** on December 07, 2016

Hello.

I have the same problem and I still could not solve it. Maybe you can help me.

1. I have downloaded Microsoft JDBC Driver 6.0 for SQL Server.

2. From this folder I took file sqljdbc.jar and copy paste it to the folders

C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext

and

C:\Program Files\SmartBear\SoapUI-5.2.1\lib

1. I configured my JDBC step as

Driver

MSSQL(MicrosoftDriver)/com.microsoft.sqlserver.jdbc.SQLServerDrive

Connection String

jdbc:sqlserver://localhost\sqlexpress;databaseName=DataVision;user=admin;password=admin

After check connection I see the error as you

com.eviware.soapui.support.SoapUIException: Failed to init connection for driver [MSSQL(MicrosoftDriver)/com.microsoft.sqlserver.jdbc.SQLServerDrive], connectionString [jdbc:sqlserver://localhost\sqlexpress;databaseName=DataVision;user=admin;password=admin]

this is scr with my example

 ![2016-12-07_18-38-42.png](https://canada1.discourse-cdn.com/flex049/uploads/smartbear_prod/original/1X/5fc197a2b991e9097ca0ebbb6f247ccade5d7409.png)

Could you please push me to the right may.

Thx in advance.

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 4:59pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/5 "2016-12-07T16:59:01Z")

</div>

> Originally posted by **Xour** on December 07, 2016

I’ll try for sure.

This is the current configuration for my JDBC step:

- **Driver:** com.microsoft.sqlserver.jdbc.SQLServerDriver

- **Connection String:** jdbc:sqlserver://HOSTNAME\sqlexpress;databaseName=MYDB;username=USER;password=PASS

- **Driver File:** C:\Program Files\SoapUI-5.2.1\bin\ext\sqljdbc4.jar

And that’s it!

Let me know if it works

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 10:53pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/6 "2016-12-07T22:53:51Z")

</div>

> Originally posted by **PaulMS** on December 07, 2016

The driver is missing an r at the end (again the [JDBC Driver List](https://www.soapui.org/jdbc/reference/jdbc-drivers.html#_ga=1.224454553.2023023152.1467783923) page is wrong) and you don’t need MSSQL(MicrosoftDriver)/ at the start.  
Try  
com.microsoft.sqlserver.jdbc.SQLServerDriver

Also copy sqljdbc4.jar to C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 10:54pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/7 "2016-12-07T22:54:27Z")

</div>

> Originally posted by **wujianyy** on December 07, 2016

Another solution is to use groovy script. You can use Windows Authentication to access sql server database.

Notice of extra jar and dll:

1 The files of JDBC driver(MSSQL(MicrosoftDriver)/com.microsoft.sqlserver.jdbc.SQLServerDrive) isn’t distributed with SoapUI Free version. .jar and .dll must be copied into the folder of Soapui folder.

- sqljdbc\_auth.dll must be copied to ..\SoapUI-5.2.1\bin\
- sqljdbc42.jar must be copied to ..\SoapUI-5.2.1\lib.

2 JDBC driver link [https://www.soapui.org/jdbc/reference/jdbc-drivers.html](https://www.soapui.org/jdbc/reference/jdbc-drivers.html)

3 sqljdbc42.jar can be used in jdk 1.8

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 7, 2016, 11:09pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/8 "2016-12-07T23:09:55Z")

</div>

> Originally posted by **Xour** on December 07, 2016

Why would you want to use a script instead of JDBC step? This is an honest question!

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 9, 2016, 10:29am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/9 "2016-12-09T10:29:41Z")

</div>

> Originally posted by **divergentor** on December 09, 2016

Thank you guys for help.

Now everything is ok and I can work with my local DB.

If you don’t mind I keep my steps here, maybe it can help somebody.

If you are using local DB

1. Put sqljdbc4.jar file to the directory C:\Program Files\SmartBear\SoapUI-5.2.1\lib. Do not use version sqljdbc41.jar and sqljdbc42.jar. (They do not work for some reason for me.)
2. Turn on SQL server browser
3. Go to the SQL server configuration/ choose SQL server network configuration and set TCP/IP enable
4. Restart the SQL server
5. In the test case create a JDBC step with properties  
Driver  
com.microsoft.sqlserver.jdbc.SQLServerDriver  
Connection Sting (example)  
jdbc:sqlserver://localhost\sqlexpress;databaseName=DataDB;user=admin;password=admin

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 13, 2016, 4:23pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/10 "2016-12-13T16:23:33Z")

</div>

> Originally posted by **nkpalli** on December 13, 2016

Trying to connect to SQL server Database on remote server using SOAPUI 5.2.1 version and running into issues :

pre-requisite : i have downloaded sqljdbc4.jar file and put that in local directory C:\Program Files\SmartBear\SoapUI-5.2.1\lib

1. created a JDBC step with properties

Driver : com.microsoft.sqlserver.jdbc.SQLServerDriver

Connection Sting: jdbc:sqlserver://databaseserver/instance;databaseName=test;integratedSecurity=true

here below is error message:

com.eviware.soapui.support.SoapUIException: Failed to init connection for driver [com.microsoft.sqlserver.jdbc.SQLServerDriver], connectionString [jdbc:sqlserver://databaseserver/instance;databaseName=test;integratedSecurity=true]

2)Turn on SQL server browser  
4) Go to the SQL server configuration/ choose SQL server network configuration and set TCP/IP enable  
5) Restart the SQL server  
still cannot connect . Any suggestions ?

> * * *

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 14, 2016, 1:12am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/11 "2016-12-14T01:12:42Z")

</div>

> Originally posted by **PaulMS** on December 13, 2016

The troubleshooting section indicates

Ensure that sqljdbc\_auth.dll is in the correct directory, \bin directory.

[https://smartbear-cc.force.com/portal/KbArticleViewer?name=How-to-configure-SoapUI-Pro-JDBC-Datasource-with-SQL-Server-that-uses-windows-authentication&sp=readyapi](https://smartbear-cc.force.com/portal/KbArticleViewer?name=How-to-configure-SoapUI-Pro-JDBC-Datasource-with-SQL-Server-that-uses-windows-authentication&sp=readyapi)

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [December 14, 2016, 10:27am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/12 "2016-12-14T10:27:47Z")

</div>

> Originally posted by **divergentor** on December 14, 2016

Hello, nkpalli.

Try to revert slash in your connection string.

Your connection string  
jdbc:sqlserver://databaseserver/instance;databaseName=test;integratedSecurity=true

Should be  
jdbc:sqlserver://databaseserver\instance;databaseName=test;integratedSecurity=true

And second point, maybe it doesn’t work without login and password?

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 21, 2017, 9:36pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/13 "2017-03-21T21:36:05Z")

</div>

> Originally posted by **SuperSingh** on March 21, 2017

I have followed the exact steps, but am not able to get the connection to JDBC.

(Note that DB is on a remote machine)

I am working on Soap UI Open Source.

Here is the data I provided

SQL Driver : com.microsoft.sqlserver.jdbc.SQLServerDriver

Connection String: jdbc:sqlserver://Servername\name:port;databaseName=dbname;username=username;password=password

(I tried by removing port number also)

sqljdbc\_auth.dll stored in Bin folder of SoapUI

sqljdbc4.jar stored in ext folder of SoapUI

Running this gives the following error :

Can’t get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.

Appreciate any help !

Thanks

Predator

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 22, 2017, 12:57am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/14 "2017-03-22T00:57:33Z")

</div>

> Originally posted by **PaulMS** on March 21, 2017

What SQL version number can you see if you connect to the database server in SQL server management?

Did you download the latest Microsoft JDBC Driver 6.0 for SQL Server?

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 22, 2017, 1:38am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/15 "2017-03-22T01:38:07Z")

</div>

> Originally posted by **nkpalli** on March 21, 2017

To get my JDBC step to work I had to follow these steps. we are on SQL server 2014

1. Download Sqljdbc4.jar and placed it under C:\Program Files (x86)\SmartBear\soapUI-5.2.1\lib

In JDBC steps

1. Add JDBC step

Driver = com.microsoft.sqlserver.jdbc.SQLServerDriver

ConnectionString : jdbc:sqlserver://databaseserver\instance:port;databaseName=dbname;user=dbuser;password=dbpassword

1. For integrated authentication to work you’ll need sqljdbc\_auth.dll matching your environment  
(32bit / 64bit) in your library path . Download and place it under C:\Program Files (x86)\SmartBear\soapUI-5.2.1\lib

In JDBC request set

Driver = com.microsoft.sqlserver.jdbc.SQLServerDriver

ConnectionString :jdbc:sqlserver://Databaseservername\Instance:port;databaseName=Simpson;integratedSecurity=true

Make sure you have Installed JRE ( jre1.8.0\_121) and put it in java\_home in user\_variables

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 22, 2017, 7:54pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/16 "2017-03-22T19:54:41Z")

</div>

> Originally posted by **SuperSingh** on March 22, 2017

Thank You Paul MS & nkpalli.

Truly Appreciate your support here !

The issue was with placing the files in correct folders (sqljdbc & auth.dll files).

But I am facing another issue now ☹

When I provide connection string with username & password combination, Soap UI throws the following error :

“Can’t get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ‘username’.”

And when I provide connection string with the Integrated Security setup, the followihng error comes up.

"Can’t get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. "

Note :

I have sqljdbc4.jar & sqljdbc\_auth.dll file in SoapUI-5.2.1\lib folder .

I have mysql-connector-java-5.1.41-bin and sqljdbc4.jar in ext folder

Please let me know if I am missing anything.

Appreciate your help !

Thanks

Predator

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 22, 2017, 10:53pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/17 "2017-03-22T22:53:47Z")

</div>

> Originally posted by **PaulMS** on March 22, 2017

Hi

Integrated security works when I have copied sqljdbc\_auth.dll to SoapUI\bin folder and sqljdbc4.jar to SoapUI\bin\ext

I do not have mysql-connector-java

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 23, 2017, 2:03pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/18 "2017-03-23T14:03:54Z")

</div>

> Originally posted by **SuperSingh** on March 23, 2017

Thanks PaulMS for reply !

But on keeping the files(.dll & .jar files) per the folder setup you shared, SoapUI crashes on clicking Test Connection button, ☹

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 24, 2017, 3:42am UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/19 "2017-03-24T03:42:23Z")

</div>

> Originally posted by **PaulMS** on March 23, 2017

Download [Microsoft JDBC Driver 4.0 for SQL Server](https://www.microsoft.com/en-us/download/details.aspx?id=54629).

Unzip the sqljdbc\_4.0.2206.100\_enu.exe file contents to a new folder.

Copy sqljdbc4.jar (but not sqljdbc.jar) to SoapUI-5.2.1\bin\ext

Make sure you copy the correct sqljdbc\_auth.dll from either x64 (for 64 bit) or x86 folder to SoapUI-5.2.1\bin

This has always worked for me using Win7, but if Test Connection still fails then try removing any other files except sqljdbc4.jar from SoapUI-5.2.1\bin\ext

---

<div class="post-metadata">

**Author:** ![system](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@system](https://community.smartbear.com/u/system)\
**Post date:** [March 24, 2017, 5:49pm UTC](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162/20 "2017-03-24T17:49:27Z")

</div>

> Originally posted by **SuperSingh** on March 24, 2017

Wooopie …It worked !!!

Thanks a ton to all 🙂

Can’t believe my eyes, when I got the pop-up - “The Connection Successfully Tested” 😛

Thanks,

Predator

[Next page](https://community.smartbear.com/t/solved-jdbc-cannot-connect-to-a-ms-sql-database/162.md?page=2)
