oracle jdbc urljdbc:oracle:driver_type:[username/password]@database_specifier drive_type有thin和oci 如: jdbc:oracle:thin:@localhost:1521:my_db mysql JDBC URL格式及其參數(shù)說明 mysql JDBC URL格式如下: 常用的幾個較為重要的參數(shù):
對應中文環(huán)境,通常mysql連接URL可以設置為:
jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false 在使用數(shù)據(jù)庫連接池的情況下,最好設置如下兩個參數(shù): autoReconnect=true&failOverReadOnly=false 需要注意的是,在xml配置文件中,url中的&符號需要轉(zhuǎn)義成&。比如在tomcat的server.xml中配置數(shù)據(jù)庫連接池時,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> <!-- 首頁 企業(yè)管理知識 --> <!-- <bean id="enterpriseKnowledgeAction" class="shina.index.enterpriseKnowledge.EnterpriseKnowledgeAction" scope="session" /> <bean id="enterpriseKnowledgeService" class="shina.index.enterpriseKnowledge.EnterpriseKnowledgeService" /> --> </beans> |
|
來自: squarecome > 《我的圖書館》