休眠:SQL Server .MDF文件的connection.url [英] Hibernate: connection.url for SQL Server .MDF File
问题描述
如何为SQL Server .MDF文件休眠connection.url?我已经尝试过
How do I Hibernate connection.url for SQL Server .MDF File? I've tried
prop.setProperty("hibernate.connection.url", "jdbc:sqlserver://c:\\db.mdf");
但不起作用:(
谢谢!
推荐答案
属性hibernate.connection.url
带有您必须提供的 JDBC URL ,该URL连接到数据库.在中了解有关此内容的更多信息.文档.
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.
例如:
hibernate.connection.url = jdbc:postgresql://localhost/mydatabase
MDF 文件是数据的内部表示形式在MS SQL Server中.您应该连接到SQL Server,而不是 MDF 文件.我还发现了一个问题,它确认了您不能在MS SQL Server外部使用MDF文件.
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.
这篇关于休眠:SQL Server .MDF文件的connection.url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!