commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 12400] New: - same connections
Date Sun, 08 Sep 2002 15:23:17 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12400>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12400

same connections

           Summary: same connections
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Dbcp
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: jihh@neusoft.com


I use blow code in a jsp file, and I get some same connection.

System.setProperty("jdbc.drivers", "oracle.jdbc.dirver.OracleDriver");
ObjectPool connectionPool =
	new GenericObjectPool(null, 70, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 
		      60000, 10);
ConnectionFactory connectionFactory =
	new DriverManagerConnectionFactory
("jdbc:oracle:thin:@192.168.3.226:1521:pacs", 
				   username, password);
PoolableConnectionFactory poolableConnectionFactory =
	new PoolableConnectionFactory(connectionFactory, connectionPool, null, 
null, false, true);

PoolingDriver driver = new PoolingDriver();
driver.registerPool("neusoftim", connectionPool);

Connection[] conn = new Connection[25];
for (int i = 0; i < 25; i++)
{
        try
        {
                conn[i] = DriverManager.getConnection
(com.neusoft.im.IMConstants.DATABASE_URL);
                out.println("hashcode of " + conn[i] + " is " + conn[i].hashCode
());
        }
        catch (Exception e)
        {
                Log.error("ERROR for connection" + i, e);
                out.println(e);
                out.flush();
        }
}

for (int i = 0; i < 25; i++)
{
      out.println("Close " + i + ":");
      try {conn[i].close();} catch (Exception e) {out.println(e);}
}

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message