connection-pooling

Tomcat: javax.naming.NoInitialContextException

穿精又带淫゛_ 提交于 2019-12-07 17:25:17
问题 I have a webservice with Java Servlets on a Tomcat server. In my Servlet I use a database pool like this: envContext = new InitialContext(); DataSource ds = (DataSource) envContext.lookup( "java:/comp/env/jdbc/Database" ); con = ds.getConnection(); For initialisation I have this in my web.xml: <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/Database</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> Then there is

closing SQLDataReaders - how to tell if they are closed?

二次信任 提交于 2019-12-07 16:33:18
问题 I'm finding that I'm having some website connection pool issues and I'm in the process of tracking them down. I know one thing to look for is to make sure that any SQLDataReaders get closed and I've gone though and made sure they are. One question that popped up in my head was about methods that return SQLDataReaders and how they get closed (or not). So here's how I have things setup and some example methods: public static SqlDataReader ExecuteReader(SqlCommand cmd) { SqlConnection c = new

JDBC Connection Pooling in a Tomcat Cluster Environment

烈酒焚心 提交于 2019-12-07 13:10:07
问题 I'm relatively very new to this, but I have a Tomcat cluster set up (using mod_proxy from httpd) with session replication (separate redis server) for fault-tolerance. I have a couple of questions about this setup: My application (spring/hibernate) has a different database per user. So the problem here is that the data source (using spring along with hibernate for persistence) is created at Tomcat level. Thus, whatever connection pooling I do will be at server level. As per the cluster

HBase HTablePool: correct usage

扶醉桌前 提交于 2019-12-07 07:58:18
问题 What is the correct usage pattern of HTablePool? I mean, assume that I have my DAO which is initialised with an instance of HTablePool. This DAO is a member instance of a Stateless Session Bean so it is reused between invocations. What is the correct usage beween the following? private HTableInterface aTable; public XYZDAO(final HTablePool pool) { this.aTable = pool.getTable(...); } public void doSomething(...) { aTable.get(...) } or HTablePool should be used like a Datasource and therefore

Connection Pooling

南楼画角 提交于 2019-12-07 07:43:19
问题 I have the following code, If I use conn == null in finally do I still use connection pooling? I know it is a good practice to close your connection but how about disposing the whole connection object? public void ExecuteNonQuery(SqlCommand Cmd) { //========== Connection ==========// SqlConnection Conn = new SqlConnection(strConStr); try { //========== Open Connection ==========// Conn.Open(); //========== Execute Command ==========// Cmd.Connection = Conn; Cmd.CommandTimeout = 180; Cmd

APPARENT DEADLOCK c3p0 0.9.5.1 spring

懵懂的女人 提交于 2019-12-07 06:15:21
问题 We are facing APPARENT DEADLOCK while using c3p0 0.9.5.1 ( which is latest version of c3p0). following is the connection pool config we are using. p:driverClass="${app.jdbc.driverClassReplica}" p:jdbcUrl="jdbc:mysql://database,database/dbname" p:acquireIncrement="5" p:idleConnectionTestPeriod="300" p:maxPoolSize="100" p:maxStatements="2000" p:minPoolSize="10" p:maxIdleTime="1800" p:maxConnectionAge="3600" p:maxIdleTimeExcessConnections="20" p:numHelperThreads="15" p:preferredTestQuery="SELECT

What is the relationship between a SPID and a Connection in SQL server?

谁说我不能喝 提交于 2019-12-07 05:51:19
问题 Can a SPID be used by two connections, while both connections are open? If a connection is returned to a connection pool, will it hold on to the SPID? 回答1: Can a SPID be used by two connections, while both connections are open? No, each open connection will have its own SPID. If a connection is returned to a connection pool, will it hold on to the SPID? Yes, as long as the connection is open, it will be associated with one SPID. You can test this yourself by querying sys.sysprocesses .

where to store database string connection in java web app?

ε祈祈猫儿з 提交于 2019-12-07 05:38:33
问题 I'm about to begin my first project with java Let me tell how I used to handle these things... So far now, I've been workin on asp with a com+ componente made with VB6. The component is registered via the com+ administration console with a domain user, something lile my_company_domain\my_app_account The components reads the configuration from an udl file, configured to access the DB with integrated security. I invoke the componente from asp with server.createobject, the component runs with

Why we should close the connection in JDBC? If we don't do it, what will happen

感情迁移 提交于 2019-12-07 04:06:21
问题 Communicate with the database in java, we often follow these steps: load a driver get a connection create a Statement or PreparedStatement get the ResultSet close the connection I am confused that we should close connection, all say that create a connection is expensive, so why we can't do like this: static { try { connection = DriverManager.getConnection(connectorURL, user, password); } catch (SQLException e) { e.printStackTrace(); } } We just create a connection as a singleton, and use it

Why do connections persist when I undeploy a webapp using the Tomcat 7 JDBC connection pool?

自作多情 提交于 2019-12-07 02:59:33
问题 I've got a minimal Spring webapp deployed to Tomcat 7.0.22 - it consists of a couple of pages, a controller, a service, and a DAO which has one method that runs a SELECT query. The webapp is configured to use the new Tomcat JDBC connection pool - here is the resource configuration in the webapp's context.xml: <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@blah blah" factory="org.apache.tomcat.jdbc.pool