数据库连接的url和驱动器

各种数据库连接的url和驱动器

 

URL:   
1.Oracle:"jdbc:oracle:thin:@localhost:1521:orcl"
2.Access:"jdbc:odbc:HANFENG"
3.SQL Server:"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs","sa",""
4.DB2:"jdbc:db2://localhost:5000/sample"
5.Informix:"jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver"
6.Sybase:"jdbc:sybase:Tds:localhost:5007/tsdata"
7.MySQL:"jdbc:mysql://localho st/softforum?user=soft&password=soft1234&useUnicode=true&characte rEncoding=8859_1"
驱动器:
Oracle: oracle.jdbc.driver.OracleDriver
Access: sun.jdbc.odbc.JdbcOdbcDriver
SQL Server: com.microsoft.jdbc.sqlserver.SQLServerDriver
DB2: com.ibm.db2.jdbc.app.DB2Driver
Informix: com.informix.jdbc.IfxDriver
Sybase: com.sybase.jdbc.SybDriver
MySQL: org.gjt.mm.mysql.Driver
com.mysql.jdbc.Driver   
 

Hibernate 不同数据库的连接及SQL方言

RDBMS方言
DB2org.hibernate.dialect.DB2Dialect
DB2 AS/400org.hibernate.dialect.DB2400Dialect
DB2 OS390org.hibernate.dialect.DB2390Dialect
PostgreSQLorg.hibernate.dialect.PostgreSQLDialect
MySQLorg.hibernate.dialect.MySQLDialect
MySQL with InnoDBorg.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAMorg.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version)org.hibernate.dialect.OracleDialect
Oracle 9i/10gorg.hibernate.dialect.Oracle9Dialect
Sybaseorg.hibernate.dialect.SybaseDialect
Sybase Anywhereorg.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Serverorg.hibernate.dialect.SQLServerDialect
SAP DBorg.hibernate.dialect.SAPDBDialect
Informixorg.hibernate.dialect.InformixDialect
HypersonicSQLorg.hibernate.dialect.HSQLDialect
Ingresorg.hibernate.dialect.IngresDialect
Progressorg.hibernate.dialect.ProgressDialect
Mckoi SQLorg.hibernate.dialect.MckoiDialect
Interbaseorg.hibernate.dialect.InterbaseDialect
Pointbaseorg.hibernate.dialect.PointbaseDialect
FrontBaseorg.hibernate.dialect.FrontbaseDialect
Firebirdorg.hibernate.dialect.FirebirdDialect

 

 

在hibernate.cfg.xml中配置如下

  <property name="hibernate.connection.url">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs</property>
  <property name="hibernate.connection.username">sa</property>
  <property name="hibernate.connection.password">221383</property>
  <property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
  <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>

 

在hibernate.properties中配置如下

## Oracle

hibernate.dialect org.hibernate.dialect.OracleDialect
hibernate.dialect org.hibernate.dialect.Oracle9Dialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.username ora
hibernate.connection.password ora
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值