1、直接指定實(shí)例名
jdbcDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbcUrl=jdbc:sqlserver://192.168.xxx.xxx;instanceName=sql_03;DatabaseName=edu;integratedSecurity=false
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
jdbcUsername=sa
jdbcPassword=xxxxx
DBCP Pool settings
jdbcInitialSize=5
jdbcMaxActive=10
jdbcMaxIdle=5
jdbcMaxWait=30000
jdbcValidationQuery=select 1
2、指定端口
jdbcDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbcUrl=jdbc:sqlserver://192.168.xxx.xxx:64150;DatabaseName=edu;integratedSecurity=false
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
jdbcUsername=sa
jdbcPassword=xxx
# DBCP Pool settings
jdbcInitialSize=5
jdbcMaxActive=10
jdbcMaxIdle=5
jdbcMaxWait=30000
jdbcValidationQuery=select 1
指定的多個(gè) SQL Server 實(shí)例SQL Server 2000 和 SQL Server 2005 允許在每臺(tái)服務(wù)器上安裝多個(gè)數(shù)據(jù)庫實(shí)例。每個(gè)實(shí)例都由一個(gè)專用名稱所標(biāo)識(shí)。若要連接到指定的 SQL Server 實(shí)例,可以使用指定實(shí)例的端口號(hào)(首選),也可將實(shí)例名指定為 JDBC URL 屬性或 datasource 屬性。如果未指定實(shí)例名屬性或端口號(hào)屬性,則會(huì)創(chuàng)建與默認(rèn)實(shí)例的連接。如以下實(shí)例所示:
若要使用端口號(hào),請(qǐng)執(zhí)行下列操作:
jdbc:sqlserver://localhost:1433;integratedSecurity=true;<more properties as required>;
若要使用 JDBC URL 屬性,請(qǐng)執(zhí)行下列操作:
jdbc:sqlserver://localhost;instanceName=instance1;integratedSecurity=true;<more properties as required>;
參考資料:http://blog.csdn.net/cfhacker007/article/details/4356044
聯(lián)系客服