Service Virtualization

Expand all | Collapse all

JDBC connection with SQL Server

Jump to Best Answer
  • 1.  JDBC connection with SQL Server

    Posted 06-19-2017 04:40 AM

    Dear all - I'm trying to connect Devtest 10.1 with MS SQL Server, however unable to identify the Port.

    We have set up Devtest on one machine and SQL Server Developer edition on anther machine.

    I'm able to ping the server. Can someone please help me - how to identify the port details here.

     

    Driver                     com.microsoft.sqlserver.jdbc.SQLServerDriver

    Connect string       jdbc:sqlserver://<ServerName>:<Port>

     

    When I try to connect - I'm getting the below error:

    There was a SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host <ServerName>, port <Port> 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.".

    Stack Trace:

    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
    at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241)
    at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2243)
    at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:491)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1309)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
    at com.itko.lisa.jdbc.JDBCNode.getConnection(JDBCNode.java:627)
    at com.itko.lisa.jdbc.JDBCNode.executeSQL(JDBCNode.java:370)
    at com.itko.lisa.jdbc.JDBCNodeEditor.doExec(JDBCNodeEditor.java:483)
    at com.itko.lisa.jdbc.JDBCNodeEditor$6.doCallback(JDBCNodeEditor.java:417)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Thread.java:745)



  • 2.  Re: JDBC connection with SQL Server
    Best Answer

    Posted 06-19-2017 11:32 AM

    What port number did you use?  

    And, is your OJDBC.jar in DevTest compatible with the version of SQL Server you are using?  DevTest ships with ojdbc7-12.1.0.2.jar. It is located in LISA_HOME\lib\shared.  Ensure that version is recommended and compatible.  If not, obtain the correct jar and rename this one.  Then, restart all of the DevTest servers.

     

    The port that DevTest connects to on the SQL Server instance is generally provided the DBA or the person that installed the database server. The default port is usually 1433, but some organizations change the default port.

     

    If you have access to the machine that is running SQL Server, you might get the PID associated with SQL Server and use netstat -oan to see if you can determine the port that way.  



  • 3.  Re: JDBC connection with SQL Server

    Posted 06-23-2017 06:04 AM

    Hey Joel, Sorry for a delayed response, I was stuck with some other work.

     

    I used the default port 1433 to connect. I checked ojdbc7-12.1.0.2.jar as well. However later found the issue was - TCP/IP port, it wasn't enabled at server side.

     

    Finally this is resolved. 

     

    TGIF



  • 4.  Re: JDBC connection with SQL Server

    Posted 10-22-2018 06:27 AM

    Hi Ritu

       I am facing the same issue can you mention how to enable TCP/IP port.