Ask a Question

Error when connecting MSSQL server using JDBC Request

SOLVED
VishKini
Occasional Contributor

Error when connecting MSSQL server using JDBC Request

Hello,

 

This is my first time trying to use a JDBC request to connect to SQL DB.When i am trying to connect i am getting an error as below.

 

Can't get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 127.0.0.1, port xxxx has failed. Error: "Connection refused: connect. 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 have checked with my network team and there are no blocks reported.

 

Can anyone help me in resolving this error?

4 REPLIES 4
richie
Community Hero

@VishKini ,

 

ok - first thing - I always have trouble connecting to SQLServer - whats the connection type you're using?  SQL? Mixed mode?  Windows Auth?  

 

what driver - JNDI or JDBC?

 

Try the SQL mode option - I couldnt connect with anything else when I last tried this.

 

the exception indicates you are trying to connect to a SQLServer instance local to the machine that ReadyAPI! is running is - is that correct?  (due to 127.0.0.1) if thats the case - change authentication to SQL only - that works everytime as far as I can tell

 

otherwise we're going to need your full logging (both ReadyAPI! and SQLServer) to try and sort this out  - but "connection refused" typically means a problem with your authentication/authorisation

 

ta

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
VishKini
Occasional Contributor

 
 
 

@richie :

 

Thank you for your reply. 

 

I am using Windows Auth (JDBC driver). I have tried sql and win authentication,but none works. 

 

The SQL server is hosted on a different machine and the server auth is set to SQL and Windows auth .

 

I know what mistake i did. In the Host name i didnt give the sql server name and was trying with localhost (which was wrong). Gave the sql server name and re-tried, but i get the below error. I have RWE access

VishKini_0-1597927071422.png

 

Have you any control of the auth type specified in sqlserver? I couldnt connect using windows auth nor mixed mode (which is what you mention).
If you can change to SQL auth, that'll save a lot of headache.

If not have a look at the following links where this issue was solved (albeit on older versions of sqlserver and readyapi!)

https://community.smartbear.com/t5/SoapUI-Pro/Getting-Error-at-JDBC-Request-Can-t-get-the-Connection...

https://community.smartbear.com/t5/SoapUI-Open-Source/Solved-JDBC-Cannot-connect-to-a-MS-SQL-databas...

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
VishKini
Occasional Contributor

Thanks @richie !

 

It was an authentication problem, which i got it fixed with the help of dba team.

 

Thank you !

cancel
Showing results for 
Search instead for 
Did you mean: