c3p0

Configure spring to connect to mysql over ssl

拥有回忆 提交于 2019-11-30 10:11:27
I am connecting to MySQL over SSL from my Java application. I have configured MYSQL to support SSL and generated client certificates. I have imported server CA certificate and client certificate into keystore. This is how my code currently looks like String url = "jdbc:mysql://127.0.0.1:3306/MySampleDb? verifyServerCertificate =true&useSSL=true&requireSSL=true" System.setProperty("javax.net.ssl.keyStore","/home/cert/keystore"); System.setProperty("javax.net.ssl.keyStorePassword","password"); System.setProperty("javax.net.ssl.trustStore","/home/cert/truststore"); System.setProperty("javax.net

Reproduce com.mysql.jdbc.exceptions.jdbc4.CommunicationsException with a setup of Spring, hibernate and C3P0

若如初见. 提交于 2019-11-30 08:35:31
I got this error from the production code: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was36940 seconds ago.The last packet sent successfully to the server was 36940 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. And now I'm trying to reproduce

How to shutdown connection pool on context unload?

与世无争的帅哥 提交于 2019-11-30 08:28:42
问题 after developing several webapps that all had a similar setup with spring, hibernate and c3p0 as connectionpool I wanted to investigate a problem that i noticed everytime: Connectionpool keeps the connections until you shutdown tomcat (or your application server). Today i create the most basic project I could with these four dependencies: org.springframework:spring-web org.springframework:spring-orm org.hibernate:hibernate-core c3p0:c3p0 (plus the specific JDBC driver). My web.xml only

MSSQL JDBC driver won't connect to mirror failoverPartner on first connect

孤街浪徒 提交于 2019-11-30 07:15:35
I'm using C3P0 and the MS SQL JDBC 4 driver to automatically failover to a new database mirror when the database goes away. If it first connects to the principal DB, then the failover works and it switches seamlessly to the mirror DB. However, if the principal DB is down when the application starts, and the mirror DB is available to connect (tested with MSSQL Studio), then the application fails to start and fails to connect to the backup mirror. Here is the connection URL: jdbc:sqlserver://PRINCIPALDB;databaseName=app_space;port=99999;failoverPartner=MIRRORDB I have c3p0

Hibernate的批量插入实战

旧巷老猫 提交于 2019-11-30 04:25:48
一 配置 <?xml version="1.0" encoding="GBK"?> <!-- 指定Hibernate配置文件的DTD信息 --> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <!-- hibernate-configuration是配置文件的根元素 --> <hibernate-configuration> <session-factory> <!-- 指定连接数据库所用的驱动 --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <!-- 指定连接数据库的url,其中hibernate是本应用连接的数据库名 --> <property name="connection.url">jdbc:mysql://localhost/hibernate</property> <!-- 指定连接数据库的用户名 --> <property name="connection.username">root<

Hibernate批量更新实战

旧城冷巷雨未停 提交于 2019-11-30 04:25:47
一 配置 <?xml version="1.0" encoding="GBK"?> <!-- 指定Hibernate配置文件的DTD信息 --> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <!-- hibernate-configuration是配置文件的根元素 --> <hibernate-configuration> <session-factory> <!-- 指定连接数据库所用的驱动 --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <!-- 指定连接数据库的url,其中hibernate是本应用连接的数据库名 --> <property name="connection.url">jdbc:mysql://localhost/hibernate</property> <!-- 指定连接数据库的用户名 --> <property name="connection.username">root<

Hibernate的DML风格的批量更新

给你一囗甜甜゛ 提交于 2019-11-30 04:25:46
一 配置 <?xml version="1.0" encoding="GBK"?> <!-- 指定Hibernate配置文件的DTD信息 --> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <!-- hibernate-configuration是配置文件的根元素 --> <hibernate-configuration> <session-factory> <!-- 指定连接数据库所用的驱动 --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <!-- 指定连接数据库的url,其中hibernate是本应用连接的数据库名 --> <property name="connection.url">jdbc:mysql://localhost/hibernate</property> <!-- 指定连接数据库的用户名 --> <property name="connection.username">root<

Hibernate的DML风格的批量删除

纵然是瞬间 提交于 2019-11-30 04:25:41
一 配置 <?xml version="1.0" encoding="GBK"?> <!-- 指定Hibernate配置文件的DTD信息 --> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <!-- hibernate-configuration是配置文件的根元素 --> <hibernate-configuration> <session-factory> <!-- 指定连接数据库所用的驱动 --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <!-- 指定连接数据库的url,其中hibernate是本应用连接的数据库名 --> <property name="connection.url">jdbc:mysql://localhost/hibernate</property> <!-- 指定连接数据库的用户名 --> <property name="connection.username">root<

Multiple applications having c3p0 configuration gives warning

Deadly 提交于 2019-11-30 03:59:05
Hi I have two web application under one tomcat. Both are using hibernate 3.2.1 and c3p0 0.9.1.2. While the second application gets deployed, I always get the following warning message. Tomcat: apache-tomcat-6.0.28 WARN 2010-11-06 19:04:37,270 A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were closed prior to undeployment. This may lead to resource leaks over time. Please take care to close all PooledDataSources. Please help in this regard. Thanks in advance Goura To avoid the C3P0Registry from being

The use of c3p0.idle_test_period.

∥☆過路亽.° 提交于 2019-11-30 03:40:36
I'm new to c3op, and confused about the use of : c3p0.idle_test_period In this link : HowTo configure the C3P0 connection pool idleTestPeriod : Must be set in hibernate.cfg.xml (or hibernate.properties), Hibernate default: 0, If this is a number greater than 0, c3p0 will test all idle, pooled but unchecked-out connections, every this number of seconds. What is the purpose of this kind of test (idel, pooled connections), and the relationship between c3p0.idle_test_period and c3p0.timeout? The database server may close a connection on its side after a certain amount of time - causing some error