0

I have installed SQL Server 2014 in Windows 10 with database port (1433) instead of a named instance with Java8. I am trying to use the below mentioned connection string format to connect.

jdbc:sqlserver://localhost:1433;databaseName=TEST_DATABASE;userName=user;password=user

But the connection fails. The SQL JDBC driver I am using is sqljdbc42.jar. I am able to connect successfully while trying to SQL server created using instance name instead of port. The format mentioned below works fine.

jdbc:sqlserver://localhost;instanceName=COMP_SYS;databaseName=NEW_DATABASE;userName=user;password=user

Only with DB port connection is getting failed. What am I missing.

DeeJay007
  • 469
  • 4
  • 30
  • It sounds like you still installed a named instance (COMP_SYS) on port 1433 instead of a default instance. – squillman Nov 07 '18 at 16:35
  • No. I use a VM to install the SQL server. In a separate snapshot, I installed the SQL Server with a named instance and tried to connect and it was fine. In another snapshot if I use port 1433 instead of named instance, the connection is getting failed. – DeeJay007 Nov 07 '18 at 16:37
  • 2
    What's the exact error you get? – squillman Nov 07 '18 at 16:41
  • Please post the full exception stacktrace. – Mark Rotteveel Nov 07 '18 at 18:10
  • See [this question](https://stackoverflow.com/q/12297475/2144390) for ways to verify the port number that the SQL Server instance is using. – Gord Thompson Nov 07 '18 at 19:13

0 Answers0