maven怎么连接mysql数据库配置_各数据库连接配置与maven依赖安装

maven用的比较多,所以自己去捣鼓了一下:以下是关于数据库配置的一块,把相关的内容张贴出来,以备不时之需

//MySql

配置文件(maven):pom.xml

mysql

mysql-connector-java

5.0.5

配置文件:(hibernat.properties)

hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

hibernate.connection.driver_calss=mysql.jdbc.Driver

hibernate.connection.url=jdbc:mysql://localhost:3306/trails?createDatabaseIfNotExist=true&ampo;useUnicode=ture&characterEncoding=utf-8

hibernate.connection.username=root

hibernate.connection.password=****

hibernate.connection.hbm2ddl.auto=update

//Oracle

配置文件(maven)

com.oracle

ojdbc14

10.2.0.2.1

配置文件:(hibernat.properties)

hibernate.dialect=org.hibernate.dialect.Oracle9Dialect

hibernate.connection.driver_calss=oracle.jdbc.OracleDriver

hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:XE

hibernate.connection.username=system

hibernate.connection.password=****

hibernate.connection.hbm2ddl.auto=update

//SQL Server

配置文件(maven)

net.sourceforge.jtds

jtds

1.2

配置文件:(hibernat.properties)

hibernate.dialect=org.hibernate.dialect.SQLServerDialect

hibernate.connection.driver_calss=net.sourceforge.jtds.jdbc.Driver

hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/trails?createDatabaseIfNotExist=true&ampo;useUnicode=ture&characterEncoding=utf-8

hibernate.connection.username=sa

hibernate.connection.password=****

hibernate.connection.hbm2ddl.auto=update

//手动安装maven依赖包

1:将此依赖添加到项目的pom.xml

com.microsoft.sqlserver

sqljdbc4

3.0

2:在命令行中执行install命令 (有用)

mvn install:install-file -Dfile=mysql-connection-java-4.1.45-bin.jar -DgroupId=mysql-connection-java -DartifactId=mysql -Dversion=4.1.45 -Dpackaging=jar

3:将sqljdbc4-3.0.jar拷贝到此依赖安装目录

将sqljdbc4-3.0.jar拷贝到\Documents and Settings\%USER%\.m2\repository\com\microsoft\sqlserver\sqljdbc\4\3.0中即可

来源网络。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值