1

I have a local MS SQL Server Express 2016 running on 1433. I can connect to it via MS SQL Management Studio and HeidiSQL just fine.

In Eclipse Neon I created a new JPA project. I want to create entities from my DB. So I click on JPA Tools -> Generate Entities from Tables.... In the following dialog window I click on the Add connections... icon. By searching the internet I found two different approaches for continuing from here:

a) Connection Profile Type: SQL Server
b) Connection Profile Type: Generic JDBC

a) In the following window I add a new driver, specify the path to my sqljdbc42.jar and set all the properties (Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver). The weird thing, when I chose this driver, in the Properties section nothing shows up and I get the following error:

SQL Server error

b) Similar to a) I add a new driver, specify the path to the jar file and set all the properties. This time I get one step further: I can press the Test Connection button. If I do so however, the window freezes for a few seconds and then shows a Ping failed! error.

Ping failed!

I guess the URL is wrong so I tried a lot of different variations but none of them worked. Here are a few of them (but I tried many more):

jdbc:sqlserver://MyPcName\SQLEXPRESS:1433 jdbc:sqlserver://MyPcName\SQLEXPRESS jdbc:sqlserver://MyPcName\SQLEXPRESS:1433 jdbc:sqlserver://MyPcName\SQLEXPRESS jdbc:sqlserver://localhost:1433 jdbc:sqlserver://MyPcName\SQLEXPRESS:1433;DatabaseName=MyDb

As mentioned above, connecting via Management Studio or HeidiSQL works (with the username test and no password). And while it should not matter since the server is running locally I tried turning of the firewall and it did not help either.

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Tim Pohlmann
  • 4,140
  • 3
  • 32
  • 61
  • for my case, it was actually the sqlserver driver I was using has a higher JRE version my environment. After switching to another driver with lower JRE, then I ping succeeded – DriLLFreAK100 Jan 04 '19 at 04:55

1 Answers1

0

I still don't know why a) does not work but I figured out my issue with b). MS SQL Management Studio and HeidiSQL did connect to the database via named-pipe instead of tcp and the tcp connection was not actually setup. Following the steps in this answer solved it:
https://stackoverflow.com/a/24299346/4961688

Community
  • 1
  • 1
Tim Pohlmann
  • 4,140
  • 3
  • 32
  • 61