1

How do I Hibernate connection.url for SQL Server .MDF File? I've tried

prop.setProperty("hibernate.connection.url", "jdbc:sqlserver://c:\\db.mdf");

but don't work :(

Thx!

CodeMouse92
  • 6,840
  • 14
  • 73
  • 130

1 Answers1

0

The property hibernate.connection.url takes the JDBC URL that you have to provide which connects to a database. Read more about it in the documentation.

Eg:

hibernate.connection.url = jdbc:postgresql://localhost/mydatabase

MDF file is an internal representation of data in MS SQL Server. You should be connecting to a SQL Server and not the MDF file. I have also found a question confirming that you can not use a MDF file out side the MS SQL Server.

Community
  • 1
  • 1
ManuPK
  • 11,623
  • 10
  • 57
  • 76
  • How do I use the SQLite .DB file in Hibernate, I thought I could use the SQL Server .MDF file. Thanks for the reply! – Adriel Café Nov 19 '11 at 22:00
  • You are going in wrong direction again. In hibernate you need to connect to the **database server** be it MySQL, SQL Lite or MS SQL Server and not the **physical data file** of the server. – ManuPK Nov 20 '11 at 05:20