How to connect to Microsoft SQL server 2014 local DB from Open source soap UI version?

Originally posted by Vighnesh on January 06, 2017

Hello,

I’m trying to connect to Microsoft sql server 2014 local Db from Soap UI open version, However it’s not working.

Below are the details :-

SQL server 2014 Express Local DB

ServerName - (localdb)\mssqllocaldb

Instance Name - LOCALDB#DCD9BDD9

Credentials - Windows Authentication

I’m using below Driver and Connection String in Soap UI JDBC step.

Driver - com.microsoft.sqlserver.jdbc.SQLServerDriver

Connection String - jdbc:sqlserver://(localdb)\mssqllocaldb\LOCALDB#DCD9BDD9;databaseName=test;integratedSecurity=true

I’m getting below error

Can’t get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host (localdb)mssqllocaldb, named instance localdb#dcd9bdd9 failed. Error: “java.net.UnknownHostException: (localdb)mssqllocaldb”. Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.

Could you please help me out what’s going wrong with my connection string or with driver?

Originally posted by Julio on January 06, 2017

Spoiler (Highlight to read)

I suspect it is the instance name - can you use the server name and the port instead. That worked for me.i.e.

The web (https://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx) recommended:
jdbc:sqlserver://SERVERNAME;instanceName=INSTANCENAME;databaseName=DB;user=test;password=PASS_VALUE

But use

use jdbc:sqlserver://SERVERNAME:PORT;databaseName=DB;user=test;password=PASS_VALUE

i.e. your instance should be using a port other than the default 1433.

Originally posted by Vighnesh on January 07, 2017

Hi Julio,

Thanks for your reply.

However my server name is = “(localdb)\mssqllocaldb” and as its Microsoft sql server 2014 local db its not running on any port. Please correct me if I’m wrong. Right now I’m not able to find out my local db port number on which it is running so, I taken another way which is of instance name.

Could you please give me clear idea how I can create my connection string using my server name , instance name and windows authentication?

I tried with the port number 1433 and even with other port numbers it giving me below exception -

Can’t get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host mssqllocaldb, port 1434 has failed. Error: “null. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.”.

I checked the TCP/IP connection all the things are working fine however still I’m not able to connect to my database.

Originally posted by Julio on January 08, 2017

Can you find the port number that your instance is running from one of the following?

http://stackoverflow.com/questions/12297475/how-to-find-sql-server-running-port

then configure your server in SoapUI to use the IP address and port.

Originally posted by PaulMS on January 08, 2017

Check this article if you are using Windows authentication.

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

How to configure SoapUI Pro JDBC Datasource with SQL Server that uses windows authentication

Also, TCP/IP is disabled by default in Microsoft SQL Server 2014

Follow the steps to enable the TCP/IP protocol

Originally posted by andrewsaunders on March 24, 2017

I’m having similar trouble with a serverName/instanceName scenario connecting to a MS SQL database. Going via the ready api GUI, it appears to strip off the slash from the name. I’ve tried shortcutting by inserting the connection string directly into the settings.xml, but no luck.

I’ve also tried added the instance name as a property to the connection string, also no luck.

Crucially - I had to bypass the Database setup UI and author a connection string directly that EXLUDES the port number ( ms sql with intances don’t utilise port numbers as areference point). The ReadyAPI GUI appears to default to 1433 if you leave the port field blank…I inserted a connection string directly into a JDBC Request test step instead of creating a Database reference object.

Originally posted by Vighnesh on April 06, 2017

Hi All,

I was able to connect to Microsoft SQL server local db 2014 using open source soap UI version with below configurations

Driver - com.microsoft.sqlserver.jdbc.SQLServerDriver

Connection String - jdbc:jtds:sqlserver://./DatabaseName;instance = “your dabase base instance name”;namedPipe = true

You will get the instance name by typing " sqllocaldb info MSSQLLocalDb " in command prompt. Please use Instance Pipe name in connection string.