65536是2的几次方:关于Hibernate连接数据库

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/09 06:53:06
看了Hibernate.properties。有地方不明白。
用Hibernate连接SQL Server时候
## MS SQL Server
#hibernate.dialect org.hibernate.dialect.SQLServerDialect
#hibernate.connection.username sa
#hibernate.connection.password sa
那么Driver_class和database URL都不要填写的吗?
要是要填写的话该怎么写呢!

这样才是正确的,你那个是依赖JDBC的链接,所以不需要URL和class:

hibernate.properties
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver
hibernate.connection.url=jbdc:microsoft:sqlserver://localhost:2000/SAMPLEDB
hibernate.connection.username=sa
hibernate.connection.password=123456

要的,没有地址怎么可以呢!
hibernate.show_sql=true // 是否显示SQL语言
hibernate.dialect=org.hibernate.dialect.MySQLDialect //指定连接语言
hibernate.connection.driver_class=com.mysql.jdbc.Driver //指定驱动
hibernate.connection.url=jdbc:mysql://localhost/schoolPro //指定数据库地址
hibernate.connection.username sa //用户名字
hibernate.connection.password sa //密码

最后4行为必须配置!你也还可以加入别的设置,比如连接数的最大和最小数等