Search code examples
sql-serverjpajdbcderby

SQL Server Express with Derby JDBC


I'm trying to connect to my existing SQL Express database, but I can't seem to figure out how to create the persistence unit in Netbeans.

Currently, when I try to create a persistence unit, I select "New Database connection". I select a Derby JAR as driver, then I have to enter the database, username and password to generate a JDBC url. The database doesn't have a username or password.
I think this is my database: .\sqlexpress;Database=MyDatabase.
But somehow whenever I click "Test Connection", it fails. I have no idea what I'm doing wrong. Am I missing something obvious in the database string?


Solution

  • For MS SQL server use jtds driver http://jtds.sourceforge.net/. Add new driver when creating PU. If your MS SQL server is running on localhost with default port then host is localhost and port 1433. Make sure your server is running.