connection-pooling

Configure hibernate to connect to database via JNDI Datasource

匆匆过客 提交于 2019-11-26 19:39:05
Hi all I'm using Hibernate+Struts2+Tomcat6+Mysql as my J2EE framework. I've been using hibernate's built-in connection pooling mechanism but it turned out to be problematic where mysql closes it's connections after 8 hours. Anyway I googled around a little bit and found that I should get my connections through JNDI datasource but I couldn't reach a good and complete tutorial on this. What steps should I take to do so? please provide me enough of details, I'm kinda new on this. here is my hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-/

What is the benefit of Connection and Statement Pooling?

丶灬走出姿态 提交于 2019-11-26 19:37:44
问题 Can someone explain what is Connection and Statement Pooling and what is the benefit over unpooled DataSources? I am trying to understand when it is a good idea to use a technology like c3p0 or proxool in a project. I need first to understand what they do and when it interesting to use them. Thank you very much. 回答1: The Happy Connection It's so easy to create a new connection every time. One line: that's all it takes. Nothing much to think about. Great life. Hold on. Do you eat on a plate?

What does sp_reset_connection do?

爷,独闯天下 提交于 2019-11-26 18:44:37
sp_reset_connection seems to be called by SQL Server connection pooling, to ensure that connections reused from the pool have most of their settings reset. Does anyone know exactly what it does and doesn't do though? eg I see from this post that it doesn't reset the transaction isolation level Chris Klepeis Data access API's layers like ODBC, OLE-DB and SqlClient call the (internal) stored procedure sp_reset_connection when re-using a connection from a connection pool. It does this to reset the state of the connection before it gets re-used. There does not appear to be official documentation

HikariCP: What database level timeouts should be considered to set maxLifetime for Oracle 11g

梦想与她 提交于 2019-11-26 18:34:32
问题 In the documentation for HikariCP, it is mentioned that We strongly recommend setting this value, and it should be at least 30 seconds less than any database-level connection timeout. What are those database-level connection timeouts that should be taken into account for Oracle11.2 database? And how could I find those timeouts (queries to execute)? 回答1: Short answer: none (by default). For the record (to include details here in case the link changes), we're talking about property maxLifetime

How to access MySQL from multiple threads concurrently

限于喜欢 提交于 2019-11-26 17:58:56
问题 We're doing a small benchmark of MySQL where we want to see how it performs for our data. Part of that test is to see how it works when multiple concurrent threads hammers the server with various queries. The MySQL documentation (5.0) isn't really clear about multi threaded clients. I should point out that I do link against the thread safe library ( libmysqlclient_r.so ) I'm using prepared statements and do both read (SELECT) and write (UPDATE, INSERT, DELETE). Should I open one connection

Need Code to create Connection Pool in java

我们两清 提交于 2019-11-26 17:57:42
问题 Need code to create the connection pool in java? How does we make sure that connection pool doesn't return the same object which is already in use? How happens if client closed the connection after taking it out from Connection pool? Update 1: I want to create this in Simple Java terms and want to see how it works in Multithreading Env. I mean which methods would be synchronized and which are not. Also will this class would be a public class? If yes then any one can access this class and

Spring JDBC connection pool best practices

允我心安 提交于 2019-11-26 17:36:00
问题 I have a basic Spring JDBC application with a pretty basic configuration: <bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@1.1.1.1:1521:XXX"/> <property name="username" value="username"/> <property name="password" value="password"/> </bean> <bean id="dbThing" class="com.DbThing"> <property name="dataSource" ref="myDataSource"/> </bean> I

HikariCP: What database level timeouts should be considered to set maxLifetime for Oracle 11g

只愿长相守 提交于 2019-11-26 17:26:12
问题 In the documentation for HikariCP, it is mentioned that We strongly recommend setting this value, and it should be at least 30 seconds less than any database-level connection timeout. What are those database-level connection timeouts that should be taken into account for Oracle11.2 database? And how could I find those timeouts (queries to execute)? 回答1: Short answer: none (by default). For the record (to include details here in case the link changes), we're talking about property maxLifetime

DBCP - validationQuery for different Databases

时光总嘲笑我的痴心妄想 提交于 2019-11-26 16:59:55
I use DBCP pool and I want use testOnBorrow and testOnReturn to test if connection is still valid. Unfortunately I have to set property validationQuery to make it work. Question: What value should be in validationQuery? I know, that: validationQuery must be an SQL SELECT statement, that returns at least one row. Problem is that we use various databases (DB2, Oracle, hsqldb). bugs_ There is not only one validationQuery for all databases. On each database you have to use different validationQuery. After few hours of googling and testing I have collected this table: Database validationQuery notes

php connection pooling mysql

左心房为你撑大大i 提交于 2019-11-26 16:03:15
问题 I am planning to use MYSQL. Is there a connection pooling extension available? Or what is the normal practice for connection? Is this the one used in every where... mysqli_connect("localhost", "xxx", "xxx", "test"); Do people use just normal mysql_connect or pconnect ..? How better is pconnect and what setting should I do for PConnect? 回答1: have you ever used mysql_pconnect() ? mysql_pconnect() acts very much like mysql_connect() with two major differences. First, when connecting, the