Hi!!! i did the same but now i'm facing with this problem

19/11/2002 02:20:21 PM org.apache.jk.common.ChannelSocket processConnection
GRAVE: Error, closing connection
java.net.SocketException: Software caused connection abort: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
        at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:471)
        at
org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:409)
        at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:524)
        at
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:638)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:533)
        at java.lang.Thread.run(Thread.java:536)
        
I usually do this,

        Context ctx = null;
        ctx = new InitialContext();
        Context envCtx = (Context) ctx.lookup("java:/comp/env/");
        DataSource ds = (DataSource) envCtx.lookup("/test");
        Connection conn = ds.getConnection();

        Statement s = conn.createStatement();
        ResultSet r = s.executeQuery("SELECT * FROM TABLE");
        while (r.next())
                out.println(r.getString(1));
        r.close();
        s.close();
        conn.close();

The problem is that i cannot manage the exception because it happens
sometimes
and i don´t know why, when it happens Tomcat crashes and i´ve to restrat it.

I wonder if you´re doing the same as me, or i´m i doning something wrong?

thanks in advance

-----Mensaje original-----
De: Roberts, Eric [mailto:[EMAIL PROTECTED]]
Enviado el: Jueves, 21 de Noviembre de 2002 10:27 a.m.
Para: Tomcat Users List
Asunto: Oracle Connection Pool - Global Naming Resource - HOW TO


I had problems earlier getting a Global Naming Resource database connection
pool to work with my Oracle db. The only reply I got was that someone else
had the same problem!

I now have it working, so for those interested, here is the HOW TO:

When defining the parameters for the db pool (say TESTdb) ensure that the
maxActive parameter is not set too high, i.e. that Oracle has enough
connections available for the pool (Oracle config parameter
max_connections). Mine was set to 100 in server.xml, and when the pool tried
to establish itself, it just sat and waited for 100 connections to become
available!

Every app that wants to use the connection pool should have a Context entry
in server.xml containing a ResourceLink to the name of the pool.

<ResourceLink name="testDb" global="jdbc/TESTdb"
type="javax.sql.DataSource"/>

The application can then connect using:
      
        Context ctx = null;
        ctx = new InitialContext();
      Context envCtx = (Context) ctx.lookup("java:/comp/env/");
        DataSource ds = (DataSource) envCtx.lookup("/testDb");
        Connection conn = ds.getConnection();

No entries are required in the application web.xml to reference the
resource.

Have Fun!


--
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]>

Reply via email to