In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Detailed explanation of C3P0 connection Pool configuration in data layer spring-dao.xml configuration File
First put the relevant code of the two configuration files bean, the following article will have a detailed explanation of the configuration properties
You can add and modify the configuration yourself.
General single database connection pool configuration spring-dao.xml part (C3P0 connection pool part): jdbc.properties configuration Set: ip address of jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql:// 's own server: 3306/o2o?useUnicode=true&characterEncoding=utf8 jdbc.username=root jdbc.password=123123123C3P0 Mysql master-slave configuration
Need to be used in conjunction with https://blog.51cto.com/12133802/2418323
Need to be used in conjunction with https://blog.51cto.com/12133802/2418323
Need to be used in conjunction with https://blog.51cto.com/12133802/2418323
Say the important words three times!
Spring-dao.xml part (C3P0 connection pool part): Mybatis-conf.xml configuration: jdbc.properties configuration: jdbc.driver=com.mysql.jdbc.Driver jdbc.master.url=jdbc:mysql:// master server IP address: 3306/o2o?useUnicode=true&characterEncoding=utf8 jdbc.slave.url=jdbc:mysql:// Main server IP address: 3306/o2o?useUnicode=true&characterEncoding=utf8 jdbc.username=root jdbc.password=123123123 next is the C3P0 configuration details of the basic configuration: driverclass: database driver class mysql driver: com.mysql.jdbc.Driver oraclel driver: oracle.jdbc.driver.OracleDriver sqlserver driver: com.microsoft.sqlserver.jdbc.SQLServerDriverjdbcUrl: database connection Mysql connection: jdbc:mysql://IP: Port / database name Example: jdbc:mysql://127.0.0.1:3306/mydb?useUnicode=true&characterEncoding=utf-8 oracle connection: jdbc.url=jdbc:oracle:thin:@IP: Port: instance name (sid) example: jdbc:oracle:thin:@127.0.0.1:1521:orcl sqlserver connection: jdbc:sqlserver://IP: Port InstanceName=sqlserver2005 (version); DatabaseName=easysite_2005 (database name) example: jdbc:sqlserver://127.0.0.1:1433;instanceName=sqlserver2005 DatabaseName=easysite_2005 user: login database account password: login database password private configuration: c3p0.logreIncrement20 default value is: 3 when connections in the connection pool are exhausted, c3p0 obtains the number of connections at the same time c3p0.minPoolSize=20 default value is: 3 minimum number of connections retained in connection pool c3p0.maxPoolSize=100 default value is: 15 maximum number of connections retained in connection pool c3p0.initialPoolSize=20 default value is: 3 number of connections obtained during initialization The value should be c3p0.maxIdleTime = 60 between minPoolSize and maxPoolSize. The default value is 0 maximum idle time. If it is not used in how many seconds, the connection will be discarded. If 0, the c3p0.maxStatements=0 is never discarded. The default value is the size of the 0c3p0 global PreparedStatements cache. If both maxStatements and maxStatementsPerConnection are 0, the cache does not take effect, and as long as one is not 0, the statement's cache takes effect c3p0.numHelperThreads = 10. The default value is: 3c3p0 is asynchronous, and slow JDBC operations are done through the helper process. Extending these operations can effectively improve performance by multithreading multiple operations to be performed at the same time the c3p0.acquireRetryAttempts=5 default is: 30 defines the number of repeated attempts after getting a new connection from the database failed. Less than or equal to 0 means infinite c3p0.acquireRetryDelay=300 defaults to: 1000 milliseconds (ms) the interval between retries c3p0.checkoutTimeout=3000 gets a connection timeout c3p0.idleConnectionTestPeriod=60 defaults to: 0 how many seconds to check for idle connections in all connection pools c3p0.automaticTestTable=sys_connectiontest defaults to: nullc3p0 will build an empty table called reconfiguration items and test it with its own query statement. If this parameter is defined, the property preferredTestQuery will be ignored. You cannot do anything on this Test table. It will only be used for c3p0 testing. Since the database user of the operating platform does not have the right to create the table, you need to issue the sql creation table c3p0.testConnectionOnCheckin = true. The default value is: if false is set to true, it will verify the validity of the connection while c3p0.unreturnedConnectionTimeout=15 the timeout setting of a checkout connection. Once a checkout connection times out, it will physically close instead of returning to the pool. It is mainly to prevent the connection from being used for a long time and not to be released. This setting is also relatively dangerous.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.