如何写jdbc.properties

如题所述

第1个回答  2016-04-23
1.连接DB2
[html] view plain copy
jdbc.driverClassName=com.ibm.db2.jcc.DB2Driver
jdbc.url=jdbc:db2://10.25.77.143:50001/efmpx
#jdbc.url=jdbc:db2://10.25.33.150:50001/dsoa
#jdbc.url=jdbc:db2://10.12.200.23:50001/dsoa
#jdbc.url=jdbc:db2://127.0.0.1:50000/LOCAL1
jdbc.username=spesdba
jdbc.password=password
jdbc.maxActive=50
jdbc.validationQuery=SELECT 1 FROM iplat.TED10

2.连接ORACLE

[html] view plain copy
#jdbc.driver = oracle.jdbc.driver.OracleDriver
#jdbc.url = jdbc:oracle:thin:@localhost:1521:yfbceg
#jdbc.username = ecan
#jdbc.password = ecan
#jdbc.maxActive= 50

3.连接SQL Server

[html] view plain copy
#jdbc.driver = com.inet.tds.TdsDriver
#jdbc.url = jdbc:inetdae7:localhost:1433?charset=GBK
#jdbc.username = ecan
#jdbc.password = ecan
#jdbc.maxActive= 50

4.连接MySQL

[html] view plain copy
#jdbc.driver = com.mysql.jdbc.Driver
#jdbc.url = jdbc:mysql://localhost/ecan?useUnicode=true&characterEncoding=gbk
#jdbc.username = ecan
#jdbc.password = ecan
#jdbc.maxActive= 50

5.连接HSQL

[html] view plain copy
#jdbc.driver = org.hsqldb.jdbcDriver
#jdbc.url = jdbc:hsqldb:hsql://localhost
#jdbc.username = ecan
#jdbc.password = ecan
#jdbc.maxActive= 50

6.连接postgresql
[html] view plain copy
#jdbc.driver = org.postgresql.Driver
#jdbc.url = jdbc:postgresql://localhost/acl?charSet=ISO-8859-1
#jdbc.username = ecan
#jdbc.password = ecan
#jdbc.maxActive= 50

附一:JDBC应用步骤

[html] view plain copy
1,注册加载一个driver驱动
2,创建数据库连接(Connection)
3,创建一个Statement(发送sql)
4,执行sql语句
5,处理sql结果(select语句)
6,关闭Statement
7,关闭连接Connection。本回答被网友采纳
相似回答