【发布时间】:2012-09-12 16:55:37
【问题描述】:
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://host/:port/db_name;instance=smth</property>
<property name="hibernate.connection.username">XXX</property>
<property name="hibernate.connection.password">YYY</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
使用此配置,hibernate 将我的程序连接到“master”数据库而不是“db_name”。我该如何解决这个问题?
编辑:jtds 1.2.5。
【问题讨论】:
-
只是猜测,你的应用程序真的使用了这个conf吗?你有其他的conf(文件/jndi/spring beans)吗?可能你使用了错误的 conf 名称(maven profile/files/jndi/spring beans..),但继续检查另一个?
-
Kent,它真的很有用,因为如果我在这个 conf 中更改某些内容,它会崩溃/无法连接到服务器。
-
问题已解决 - SQL Server 的配置方式无法使用名称实例。 jdbc:jtds:sqlserver://host:port/db_name(不带 ;instance=smth)工作正常
-
请将您的答案添加到答案部分并自行更正
标签: java sql-server hibernate jtds