Re: JDBC Connnection Pool for Oracle
Why don't you use oracle's own pool implementation? I used it once, is quite good. On Thu, 2002-09-26 at 19:55, Zeeshan wrote: Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDriver/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Zeeshan: To correct this issue, everyewhere you have oracle.jdbc.pool.OracleDataSource, replace it with javax.sql.DataSource Thanks, ej Felipe Schnack [EMAIL PROTECTED] on 09/27/2002 09:19:53 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To:Tomcat Users List [EMAIL PROTECTED] cc: Subject:Re: JDBC Connnection Pool for Oracle Why don't you use oracle's own pool implementation? I used it once, is quite good. On Thu, 2002-09-26 at 19:55, Zeeshan wrote: Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type =oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDriver/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin: @localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] ** Confidentiality Notice: This email message, including any attachments, contains or may contain confidential information intended only for the addressee. If you are not an intended recipient of this message, be advised that any reading, dissemination, forwarding, printing, copying or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by reply message and delete this email message and any attachments from your system. ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Check out - http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg56314.html Specifically, you should be using oracle.jdbc.pool.OracleConnectionCacheImpl as the classname. I found I have to use the same class name in web.xml to get everything to work properly. I'm using this on several applications without problems. Ryan [EMAIL PROTECTED] 09/26/02 04:55PM Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDriver/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref
Re: JDBC Connnection Pool for Oracle
First, Thanx to all of you for your replies :) Actually I was using javax.sql.DataSource before I tried oracle.jdbc.pool.OracleDataSource. I gave it another try by replacing oracle.jdbc.pool.OracleDataSource with javax.sql.DataSource in my server.xml and web.xml, ubt getting the same error: I am now going to try things in Ryan's email. Will update soon. Thanx Zeeshan - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 7:13 AM Subject: Re: JDBC Connnection Pool for Oracle Zeeshan: To correct this issue, everyewhere you have oracle.jdbc.pool.OracleDataSource, replace it with javax.sql.DataSource Thanks, ej Felipe Schnack [EMAIL PROTECTED] on 09/27/2002 09:19:53 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To:Tomcat Users List [EMAIL PROTECTED] cc: Subject:Re: JDBC Connnection Pool for Oracle Why don't you use oracle's own pool implementation? I used it once, is quite good. On Thu, 2002-09-26 at 19:55, Zeeshan wrote: Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type =oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDrive r/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin: @localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] ** Confidentiality Notice: This email message, including any attachments, contains or may contain confidential information intended only for the addressee. If you are not an intended recipient of this message, be advised that any reading, dissemination, forwarding, printing, copying or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by reply message and delete this email message and any attachments from your system. ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Hi Felipe, Do you have any details or nay link about it? Zeeshan - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 5:19 AM Subject: Re: JDBC Connnection Pool for Oracle Why don't you use oracle's own pool implementation? I used it once, is quite good. On Thu, 2002-09-26 at 19:55, Zeeshan wrote: Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDrive r/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Sorry... i forgot, but I found samples using google, and I don't have the sources for that project. Anyway, as far as I remember you can solve this using oracle.jdbc.pool.OracleDataSource directly in your java code. This is the connection pooling mechanism. On Fri, 2002-09-27 at 13:13, Zeeshan wrote: Hi Felipe, Do you have any details or nay link about it? Zeeshan - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 5:19 AM Subject: Re: JDBC Connnection Pool for Oracle Why don't you use oracle's own pool implementation? I used it once, is quite good. On Thu, 2002-09-26 at 19:55, Zeeshan wrote: Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDrive r/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Felipe, Actually that's what I am using currently, but it doesnt seem to do any connection pooling: Here is my existing code, but it is not doing any connection pooling. oracleDataSource = new OracleDataSource(); // Set Oracle DataSource oracleDataSource.setURL(getDbUrl()); oracleDataSource.setUser(getDbUser()); oracleDataSource.setPassword(getDbPassword()); connection = oracleDataSource.getConnection(); Am I doing anything wrong here? It has been working fine, just not doing any connection pooling. Thanx Zeeshan - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 9:26 AM Subject: Re: JDBC Connnection Pool for Oracle Sorry... i forgot, but I found samples using google, and I don't have the sources for that project. Anyway, as far as I remember you can solve this using oracle.jdbc.pool.OracleDataSource directly in your java code. This is the connection pooling mechanism. On Fri, 2002-09-27 at 13:13, Zeeshan wrote: Hi Felipe, Do you have any details or nay link about it? Zeeshan - Original Message - From: Felipe Schnack [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 5:19 AM Subject: Re: JDBC Connnection Pool for Oracle Why don't you use oracle's own pool implementation? I used it once, is quite good. On Thu, 2002-09-26 at 19:55, Zeeshan wrote: Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDrive r/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Ryan, I couldn't get JNDI to work and still getting that naming exception. However, by oracle.jdbc.pool.OracleConnectionCacheImpl connection pooling is working now :) Thanx a lot to all of you. Zeeshan - Original Message - From: Ryan Cornia [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 27, 2002 8:18 AM Subject: Re: JDBC Connnection Pool for Oracle Check out - http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg56314.html Specifically, you should be using oracle.jdbc.pool.OracleConnectionCacheImpl as the classname. I found I have to use the same class name in web.xml to get everything to work properly. I'm using this on several applications without problems. Ryan [EMAIL PROTECTED] 09/26/02 04:55PM Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDrive r/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:@localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
Zeechan, I use this in my code and it works fine doing both pooling and connection cache. Read more about it at the Oracle docs. import oracle.jdbc.pool.*; oracle.jdbc.pool.OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource(); ocpds.setURL(hotstring); // jdbc:oracle:oci8:@SID or jdbc:oracle:thin:@HOST:SID ocpds.setUser(user); //scott ocpds.setPassword(password); //tiger oracle.jdbc.pool.OracleConnectionCacheImpl occi = new OracleConnectionCacheImpl(ocpds); //set the caching size from 3 to 10 growing in a DYNAMIC SCHEME (create connections as needed and closes then as they become uneeded ) occi.setMaxLimit(10); occi.setMinLimit(3); occi.setCacheScheme(OracleConnectionCacheImpl.DYNAMIC_SCHEME); another option if you don't want to stick with Oracle your project's entire life is using com.javaexchange.dbConnectionBroker.DbConnectionBroker, you can find examples at http://www.javaexchange.com , but is simple as follows: // The below statement sets up a Broker with a minimun pool size of 2 connections // and a maximum of 10. The log file will be created in // /tmp/DBConnectionBroker.log and the pool connections will be // restarted once a day. DBConnectionBroker broker = new DBConnectionBroker(dbDriver, dbURL, userId, password,2,10, //tmp//DBConnectionBroker.log,1.0); Connection conn = broker.getConnection(); hope it helps Regards miagi -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connnection Pool for Oracle
miagi, Yes, that's what I m doing now and it is working fine. I gave up on using JNDI and now I realize that I don't really need to use JNDI. I will also try your second alternative using dbConnectionBroker. This way i can use it for nay database. Thanx a lot. Zeeshan - Original Message - From: Luciano Kiniti Issoe [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 12:06 PM Subject: Re: JDBC Connnection Pool for Oracle Zeechan, I use this in my code and it works fine doing both pooling and connection cache. Read more about it at the Oracle docs. import oracle.jdbc.pool.*; oracle.jdbc.pool.OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource(); ocpds.setURL(hotstring); // jdbc:oracle:oci8:@SID or jdbc:oracle:thin:@HOST:SID ocpds.setUser(user); //scott ocpds.setPassword(password); //tiger oracle.jdbc.pool.OracleConnectionCacheImpl occi = new OracleConnectionCacheImpl(ocpds); //set the caching size from 3 to 10 growing in a DYNAMIC SCHEME (create connections as needed and closes then as they become uneeded ) occi.setMaxLimit(10); occi.setMinLimit(3); occi.setCacheScheme(OracleConnectionCacheImpl.DYNAMIC_SCHEME); another option if you don't want to stick with Oracle your project's entire life is using com.javaexchange.dbConnectionBroker.DbConnectionBroker, you can find examples at http://www.javaexchange.com , but is simple as follows: // The below statement sets up a Broker with a minimun pool size of 2 connections // and a maximum of 10. The log file will be created in // /tmp/DBConnectionBroker.log and the pool connections will be // restarted once a day. DBConnectionBroker broker = new DBConnectionBroker(dbDriver, dbURL, userId, password,2,10, //tmp//DBConnectionBroker.log,1.0); Connection conn = broker.getConnection(); hope it helps Regards miagi -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Re: JDBC Connnection Pool for Oracle
What's dbConnectionBroker? At 2002-09-27 15:36:00 you wrote: miagi, Yes, that's what I m doing now and it is working fine. I gave up on using JNDI and now I realize that I don't really need to use JNDI. I will also try your second alternative using dbConnectionBroker. This way i can use it for nay database. Thanx a lot. Zeeshan - Original Message - From: Luciano Kiniti Issoe [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, September 27, 2002 12:06 PM Subject: Re: JDBC Connnection Pool for Oracle Zeechan, I use this in my code and it works fine doing both pooling and connection cache. Read more about it at the Oracle docs. import oracle.jdbc.pool.*; oracle.jdbc.pool.OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource(); ocpds.setURL(hotstring); // jdbc:oracle:oci8:@SID or jdbc:oracle:thin:@HOST:SID ocpds.setUser(user); //scott ocpds.setPassword(password); //tiger oracle.jdbc.pool.OracleConnectionCacheImpl occi = new OracleConnectionCacheImpl(ocpds); //set the caching size from 3 to 10 growing in a DYNAMIC SCHEME (create connections as needed and closes then as they become uneeded ) occi.setMaxLimit(10); occi.setMinLimit(3); occi.setCacheScheme(OracleConnectionCacheImpl.DYNAMIC_SCHEME); another option if you don't want to stick with Oracle your project's entire life is using com.javaexchange.dbConnectionBroker.DbConnectionBroker, you can find examples at http://www.javaexchange.com , but is simple as follows: // The below statement sets up a Broker with a minimun pool size of 2 connections // and a maximum of 10. The log file will be created in // /tmp/DBConnectionBroker.log and the pool connections will be // restarted once a day. DBConnectionBroker broker = new DBConnectionBroker(dbDriver, dbURL, userId, password,2,10, //tmp//DBConnectionBroker.log,1.0); Connection conn = broker.getConnection(); hope it helps Regards miagi -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
JDBC Connnection Pool for Oracle
Hello :) I am using Tomcat 4.0.4 with JDK1.4 I am getting the followig exception while creating the DataSource: javax.naming.NamingException: Cannot create resource instance Following is my code, server.xml and web.xml entries. I will really appreciate if anyone can help me out here. Thanx in advance Zeeshan Java Code ctx = (Context) new InitialContext().lookup(java:comp/env); if (ctx!=null) { dataSource = (javax.sql.DataSource) ctx.lookup(jdbc/datasource); connection = dataSource.getConnection(); } Server.xml Resource name=jdbc/datasource auth=Container type=oracle.jdbc.pool.OracleDataSource/ ResourceParams name=jdbc/datasource parameternameusername/namevaluetest/value/parameter parameternamepassword/namevaluetest/value/parameter parameternamedriverClassName/namevalueoracle.jdbc.driver.OracleDriver/value/parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverName/name valuejdbc:oracle:thin:localhost:1521:ORACLE/value /parameter parameter nameurl/namevaluejdbc:oracle:thin:localhost:1521:ORACLE/value /parameter parameternamemaxActive/namevalue100/value/parameter parameternamemaxIdle/namevalue3/value/parameter parameternamemaxWait/namevalue100/value/parameter /ResourceParams Web.xml === resource-ref descriptionResource reference to java.sql.Connection factory defined in server.xml /description res-ref-namejdbc/datasource/res-ref-name res-typeoracle.jdbc.pool.OracleDataSource/res-type res-authContainer/res-auth /resource-ref