tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dantas, Thiago" <thiago.dan...@hp.com>
Subject Take my e-mail out of this current
Date Fri, 20 Jul 2007 16:35:12 GMT

Dears,

Please take my e-mail out from this current.

Thanks



________________________________

 

 	 

Thiago Dantas
Procurement
Global Procurement 

55 11 4197-4592
thiago.dantas@hp.com 
http://www.hp.com.br 

________________________________

Esta mensagem (incluindo qualquer anexo) e os arquivos nela contidos é confidencial e legalmente
protegida, somente podendo ser usada pelo indivíduo ou entidade a quem foi endereçada. Caso
você a tenha recebido por engano, deverá devolvê-la ao remetente e, posteriormente, apagá-la,
pois, a disseminação, encaminhamento, uso, impressão ou cópia do conteúdo desta mensagem
são expressamente proibidos. 

This message (including any attachments) contains confidential information intended for a
specific individual and purpose, and is protected by law. If you are not the intended recipient,
you should delete this message. Any disclosure, copying, or distribution of this message,
or the taking of any action based on it, is strictly rohibited. 


-----Original Message-----
From: vrablik@gmail.com [mailto:vrablik@gmail.com] On Behalf Of Zdenek Vráblík
Sent: Friday, July 20, 2007 12:48 PM
To: Tomcat Users List
Subject: Re: OracleConnectionPoolDataSource

Hi,

> 4. I use OracleConnectionPoolDataSource because with
> javax.sql.DataSource it doesn't close correctly close connections from
> pool and server got to hang up.

Have you got any exception?

> 5. con variable is of type Connection. I found this in an example in
> google. May it be of type PooledConnection? If so, can I use pc variable
> instead of con?

I am using interface OracleConnection becouse sam libraries needs this
interface instead of  Connection interface

> 6. I've putted user="test" password="test" in context but it still
> doesn't work if I don't put user and password in getPooledConnection.
>
> Currently context.xml is this:
>
> <Context debug="0" reloadable="true">
>   <Resource
>     name="jdbc/test" auth="Container"
>     type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>     factory="oracle.jdbc.pool.OracleDataSourceFactory"
>     maxActive="5" maxIdle="-1" maxWait="-1"
>     removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
>     driverClassName="oracle.jdbc.OracleDriver"
>     url="jdbc:oracle:thin:@192.168.1.47:1521:GLOBALDB" />

This is my resource:

<Resource name="IC"
          auth="Container"
          type="oracle.jdbc.pool.OracleDataSource"
          factory="oracle.jdbc.pool.OracleDataSourceFactory"
          user="IC"
          password="IC"
          driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@192.168.100.119:1521:orcl"
          maxActive="20" maxIdle="10" maxwait="-1"/>
> </Context>
>
> And code that gets the connection is this:
>
>     Context initCtx = null;
>     PooledConnection pc = null;
>     Connection con = null;
>
>     public void init()
>     {
>       if(pc == null)
>       {
>         try
>         {
>           initCtx = new InitialContext();
>           Context ctx = (Context) initCtx.lookup("java:/comp/env");
>           OracleConnectionPoolDataSource fuenteDatos =
> (OracleConnectionPoolDataSource) ctx.lookup("/jdbc/ganaderia");
>           pc = fuenteDatos.getPooledConnection(dbUser, dbPassword);
>         }
>         catch(Exception e)
>         {
>           String mensaje = getMessage(e);
>           sc.log(mensaje);
>         }
>       }
>       initConnection();
>     }
>
>     void initConnection()
>     {
>         try
>         {
>             con = pc.getConnection();
>         }
>         catch(Exception e)
>         {
>             sc.log(getMessage(e));
>         }
>     }
>
>     public void finishConnection()
>     {
>         try
>         {
>             if(con != null)
>             {
>                 con.close();
>                 con = null;
>             }
>         }
>         catch(Exception e)
>         {
>             sc.log(getMessage(e));
>             con = null;
>         }
>     }
>
>     public void finish()
>     {
>         try
>         {
>             finishConnection();
>             if(pc != null)
>                 pc.close();
>         }
>         catch(Exception e)
>         {
>             sc.log(getMessage(e));
>         }
>     }
>
and this is my java code I use
try
    {
    // Look up the data source on the JNDI tree
    DataSource ds = (DataSource) ctxt.lookup("java:/comp/env/" + poolName);


    if (ds instanceof OracleDataSource)
      {
      log.debug("oracleDatasource found");
      }

    conn       = ds.getConnection();

    if (conn instanceof OracleConnection)
      {
      log.debug( "OracleConnection - delegated" );
      }
    }
  catch ( Exception ex )
    {
    log.error( classId  + "Error getting Oracle Connection.", ex );
    throw ex;
    }

What jdbc driver do you use?

And one question. Are you going to use any user transaction manager? :)
I use simpleJTA, but I have tested it only in developement...

Regards,
Zdenek

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message