各数据库连接配置与maven依赖安装

分享一下我老师大神的人工智能教程吧。零基础,通俗易懂!风趣幽默!http://www.captainbed.net/

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

各种数据库Hibernate链接配置

Derby

db driver maven dependency
< dependency >
         < groupId >org.apache.derby</ groupId >
         < artifactId >derbyclient</ artifactId >
         < version >10.2.2.0</ version >
</ dependency >
hibernate.properties
hibernate.dialect=org.hibernate.dialect.DerbyDialect
hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver
hibernate.connection.url=jdbc:derby: //localhost/trails;create=true
hibernate.connection.username=any
hibernate.connection.password=value
hibernate.hbm2ddl.auto=update

 MySQL

MySQL throws an EOFException when the database connection has been closed after the lease has expired, but it works again on subsequent requests.

There is a reported issue with DBCP and the MySQL driver. Check the JIRA issue for more info and a possible solutionhttp://jira.codehaus.org/browse/TRAILS-85

db driver maven dependency
< dependency >
         < groupId >mysql</ groupId >
         < artifactId >mysql-connector-java</ artifactId >
         < version >5.0.5</ version >
</ dependency >
hibernate.properties
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql: //localhost/trails?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8
hibernate.connection.username=root
hibernate.connection.password=
hibernate.hbm2ddl.auto=update

H2

db driver maven dependency
< dependency >
         < groupId >com.h2database</ groupId >
         < artifactId >h2</ artifactId >
         < version >1.0.20070304</ version >
</ dependency >
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.driver_class=org.h2.Driver

猜你喜欢

转载自blog.csdn.net/qq_43724942/article/details/84297631