How to set instance name with jdbc

后端 未结 2 1058
野的像风
野的像风 2021-01-27 18:57

I am trying to connect a MS SQL server with jdbc driver. I am getting below error;

Verify the connection properties. Make sure that an instance of SQL Server is          


        
相关标签:
2条回答
  • 2021-01-27 19:45

    The SQL Server instance MYINSTANCE is probably not listening on port 1433. Normally, a connection URL will include an instance name or a port number, not both. When both are supplied, one must take precedence.

    If specifying both with Port: 1433 for HeidiSQL allows you to connect then it seems that HeidiSQL is giving precedence to the instance name. The SQL Server JDBC driver does the opposite: when presented with both an instance name and a port number it will give precedence to the port number.

    So, you should be able to connect using a URL like this:

    jdbc:sqlserver://50.50.50.50;instanceName=MYINSTANCE
    
    0 讨论(0)
  • 2021-01-27 19:53

    Check if there is no rule blocking TCP connection on cmd do the

    telnet 127.0.0.1 1433
    

    and also check in your SQL server configuration the TCP port is correct or not.

    0 讨论(0)
提交回复
热议问题