YEs... I don't have problems with database connections! Look what's my really problem:
<Resource name="jdbc/ehr" auth="Container" type="oracle.jdbc.pool.OracleDataSource" driverClassName=" oracle.jdbc.OracleDriver" factory="oracle.jdbc.pool.OracleDataSourceFactory" url="jdbc:oracle:thin:@192.168.1.244:1521:MIGRA03" user="alert_viewer" password="alert" initialSize="5" maxActive="50" maxIdle="10" minIdle="5" maxWait="-1" defaultAutoCommit="false" /> <%@ page import="oracle.jdbc.pool.OracleDataSource" %> <%@ page import="javax.naming.Context" %> <%@ page import="javax.naming.InitialContext" %> <%@ page import="java.io.Serializable" %> <%@ page import="java.sql.Connection" %> <%@ page import="java.sql.SQLException" %> <%@ page import="java.sql.ResultSet" %> <%@ page import="java.sql.Statement" %> <%@ page import="java.util.Properties" %> <% out.println("TESTE"); String message = new String(); Connection conn = null; ResultSet rst = null; Statement stmt = null; Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup("java:/comp/env"); OracleDataSource ds = (OracleDataSource) envContext.lookup ("jdbc/ehr"); if(ds.getConnectionCachingEnabled()) { out.println("Cache Enabled"); } else { out.println("Cache disabled"); } if (envContext == null) throw new Exception("Error: No Context"); if (ds == null) throw new Exception("Error: No DataSource"); if (ds != null) conn = ds.getConnection(); if (conn != null) { message = "Got Connection " + conn.toString() + ", "; stmt = conn.createStatement(); rst = stmt.executeQuery("SELECT 'Success obtaining connection' FROM DUAL"); out.println(message); } if (rst.next()) message = rst.getString(1); rst.close(); rst = null; stmt.close(); stmt = null; //conn.close(); // Return to connection pool //conn = null; // Make sure we don't close it twice %> I got the following result: *Cache disabled *Got Connection [EMAIL PROTECTED], And database sessions increase highly. Thanks On Jan 11, 2008 4:21 PM, Martin Gainty <[EMAIL PROTECTED]> wrote: > did you verify the listener on port 1521 is listening? > > netstat -a | grep 1521 > > M-- > ----- Original Message ----- > From: "Andrew Hole" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <users@tomcat.apache.org> > Sent: Friday, January 11, 2008 11:08 AM > Subject: Re: Datasource Property Parameters (Oracle) JNDI > > > > I already change from ehr to jdbc/ehr but the problem of pooling > remaining. > > Initial sessions are not created. > > Please, help me. > > > > Thanks a lot > > > > > > On Jan 11, 2008 3:45 PM, Andrew Hole <[EMAIL PROTECTED]> wrote: > > > > > I get the following error when i change from ehr to jdbc/ehr: > > > > > > 2008-01-11 15:42:57,471 FATAL Thread-1 DatasourceConnectionProvider - > > > Could not find datasource: java:/comp/env/ehr > > > javax.naming.NameNotFoundException : Name ehr is not bound in this > Context > > > at org.apache.naming.NamingContext.lookup(NamingContext.java:769) > > > at org.apache.naming.NamingContext.lookup(NamingContext.java:139) > > > at org.apache.naming.NamingContext.lookup (NamingContext.java:780) > > > at org.apache.naming.NamingContext.lookup(NamingContext.java:139) > > > at org.apache.naming.NamingContext.lookup(NamingContext.java:780) > > > at org.apache.naming.NamingContext.lookup(NamingContext.java :152) > > > Thanks > > > > > > > > > On Jan 11, 2008 3:31 PM, Martin Gainty <[EMAIL PROTECTED]> wrote: > > > > > > > Andrew- > > > > > > > > is there a specific reason why you are using name="ehr" instead of > > > > specifying name="jdbc/ehr" > > > > > > > > M- > > > > ----- Original Message ----- > > > > From: "Andrew Hole" <[EMAIL PROTECTED]> > > > > To: "Tomcat Users List" <users@tomcat.apache.org > > > > > Sent: Friday, January 11, 2008 10:14 AM > > > > Subject: Re: Datasource Property Parameters (Oracle) JNDI > > > > > > > > > > > > > Well, REsource A works nice. When I startup Tomcat, are created 5 > new > > > > > database connections. > > > > > Resource B allows connections to be created, but without pooling. > > > > > > > > > > I'm without ideas! Please, could u help me? > > > > > > > > > > ---->>> Resource A > > > > > <Resource name="ehr" auth="Container" > > > > > type="javax.sql.DataSource" driverClassName=" > > > > > oracle.jdbc.driver.OracleDriver" > > > > > url="jdbc:oracle:thin:@192.168.1.244:1521:MIGRA03" > > > > > username="alert_viewer" password="alert" > initialSize="5" > > > > > maxActive="50" maxIdle="10" minIdle="5" > > > > > maxWait="-1" defaultAutoCommit="false" /> > > > > > > > > > > ---->>> Resource B > > > > > <Resource name="ehr" auth="Container" > > > > > * type="oracle.jdbc.pool.OracleDataSource" * * > > > > > driverClassName="oracle.jdbc.OracleDriver"* > > > > > *factory="oracle.jdbc.pool.OracleDataSourceFactory" * > > > > > url="jdbc:oracle:thin:@192.168.1.244:1521:MIGRA03" > > > > > *user*="alert_viewer" password="alert" > initialSize="5" > > > > > maxActive="50" maxIdle="10" minIdle="5" > > > > > maxWait="-1" defaultAutoCommit="false" /> > > > > > > > > > > > > > > > > > > > > On Jan 11, 2008 2:40 PM, Caldarale, Charles R > <[EMAIL PROTECTED] > > > > > > > > > > wrote: > > > > > > > From: Andrew Hole [mailto:[EMAIL PROTECTED] > > > > > > > Subject: Re: Datasource Property Parameters (Oracle) JNDI > > > > > > > > > > > > > > I don't see examples with initial size of pool! Exists some > > > > default > > > > > > > value for pool initial size?? > > > > > > > > > > > > To quote from the doc: > > > > > > "See the DBCP documentation for a complete list of configuration > > > > > > parameters." > > > > > > http://commons.apache.org/dbcp/configuration.html > > > > > > > > > > > > > > > > > > - Chuck > > > > > > > > > > > > > > > > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE > > > > PROPRIETARY > > > > > > MATERIAL and is thus for use only by the intended recipient. If > you > > > > > > received this in error, please contact the sender and delete the > > > > e-mail > > > > > > and its attachments from all computers. > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > To start a new topic, e-mail: users@tomcat.apache.org > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To start a new topic, e-mail: users@tomcat.apache.org > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >