How to set instance name with jdbc

后端 未结 2 1083
野的像风
野的像风 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
    

提交回复
热议问题