oracle jdbc urljdbc:oracle:driver_type:[username/password]@database_specifier drive_type有thin和oci 如: jdbc:oracle:thin:@localhost:1521:my_db mysql JDBC URL格式及其参数说明 mysql JDBC URL格式如下: 常用的几个较为重要的参数:
对应中文环境,通常mysql连接URL可以设置为:
jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false 在使用数据库连接池的情况下,最好设置如下两个参数: autoReconnect=true&failOverReadOnly=false 需要注意的是,在xml配置文件中,url中的&符号需要转义成&。比如在tomcat的server.xml中配置数据库连接池时,mysql jdbc url样例如下: jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www./schema/beans" xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://www./schema/beans http://www./schema/beans/spring-beans-2.0.xsd" default-autowire="autodetect"> <!-- --> <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"> <property name="driver" value="oracle.jdbc.driver.OracleDriver" /> <property name="driverUrl" value="jdbc:oracle:thin:shina/shina@192.168.0.136:1521:orcl" /> <property name="alias" value="proxool" /> <property name="user" value="shina"/> <property name="password" value="shina"/> <property name="minimumConnectionCount" value="200" /> <property name="maximumConnectionCount" value="1000" /> <property name="maximumActiveTime" value="980000" /> </bean> <!-- <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"> <property name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /> <property name="driverUrl" value="jdbc:sqlserver://192.168.0.254:1433;databaseName=shina;user=sa;password=1234" /> <property name="alias" value="proxool" /> <property name="user" value="sa"/> <property name="password" value="1234"/> <property name="minimumConnectionCount" value="200" /> <property name="maximumConnectionCount" value="1000" /> <property name="maximumActiveTime" value="980000" /> </bean> --> <!-- <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"> <property name="driver" value="com.mysql.jdbc.Driver" /> <property name="driverUrl" value="jdbc:mysql://localhost:3306/qiche315_test?user=root&password=root&useUnicode=true&characterEncoding=utf8&autoReconnect=true" /> <property name="user" value="root" /> <property name="password" value="root" /> <property name="minimumConnectionCount" value="2" /> <property name="maximumConnectionCount" value="10" /> </bean> --> <!-- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/qiche315_test" /> <property name="user" value="root" /> <property name="password" value="root" /> <property name="minPoolSize" value="2" /> <property name="maxPoolSize" value="10" /> <property name="maxIdleTime"><value>1800</value></property> <property name="acquireIncrement"><value>2</value></property> <property name="maxStatements"><value>0</value></property> <property name="initialPoolSize"><value>2</value></property> <property name="idleConnectionTestPeriod"><value>1800</value></property> <property name="acquireRetryAttempts"><value>30</value></property> <property name="breakAfterAcquireFailure"><value>true</value></property> <property name="testConnectionOnCheckout"><value>false</value></property> </bean> --> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <constructor-arg ref="dataSource" /> </bean> <!-- 首页 企业管理知识 --> <!-- <bean id="enterpriseKnowledgeAction" class="shina.index.enterpriseKnowledge.EnterpriseKnowledgeAction" scope="session" /> <bean id="enterpriseKnowledgeService" class="shina.index.enterpriseKnowledge.EnterpriseKnowledgeService" /> --> </beans> |
|
来自: squarecome > 《我的图书馆》