惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
IT之家
IT之家
博客园_首页
博客园 - 【当耐特】
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
GbyAI
GbyAI
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
H
Help Net Security
T
Tailwind CSS Blog
B
Blog RSS Feed
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
博客园 - 叶小钗
雷峰网
雷峰网
量子位

博客园 - 龙少爷

将博客搬至CSDN 偶遇 Lc.exe已退出代码为-1 安装CentOS时,显示 NET:Registered protocol family 2 Nunit2.6.2调试.net4类库 清除SqlServer2008的日志 DomainDataSource的自动刷新 使用WCF RIA服务支持ASP.NET验证 使用dataInput:DescriptionViewer对输入的数据进行校验 android程序连接后端web service时,提示:Permission denied 设置XP系统的自动登录 chrome浏览器的迅雷插件 cmd中更换用户权限 使用WCF Ria取得子表的数据,一直为null SilverLight中使用WCF Ria出现的问题empty domain service class linq的表关系解决办法 将固定字符分隔的内容转换为数组 Flex中TabBar与ViewStack 使用ApdComPort 拖动控件
在Java中使用Hibernate,使用不同数据库服务名
龙少爷 · 2011-05-29 · via 博客园 - 龙少爷

在使用Hibernate连接数据库时,如果使用指定的服务名,使用如下配置:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
        <property name="hibernate.connection.password"></property>
        <property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost:1433/TTA;INSTANCE=SQL2000</property>
        <property name="hibernate.connection.username">sa</property>
        <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="hibernate.current_session_context_class">thread</property>
    </session-factory>
</hibernate-configuration>
如果不指定服务名,将"hibernate.connection.url"行改为:
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost/TTA</property>