Hi,
Sorry for my late answer, I was out of the office.
The workarround is writing a class that registers the connection pool in the initial
context:
Context ic = new InitialContext();
OracleConnectionPoolDataSource cpds = new OracleConnectionPoolDataSource();
ic.rebind("toto", cpds);
then configure it to be started automatically in the application web.xml:
<servlet>
<servlet-name>myConnexionPool</servlet-name>
<servlet-class>ConnexionPoolClass</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
then call it from your program:
try {
Context ic = new InitialContext();
OracleConnectionPoolDataSource cpds =
(OracleConnectionPoolDataSource)ic.lookup("toto");
pooledConnection = cpds.getPooledConnection();
}
catch(Exception e) {
System.out.println(e) ;
}
try {
connection = pooledConnection.getConnection();
statement = connection.createStatement();
} catch (SQLException se) {
System.out.println("SQL Exception: "+ se);
}
this works fine ;-)
Amine
----- Original Message -----
From: "Niclas Rothman" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Wednesday, December 19, 2001 4:42 PM
Subject: SV: JNDI resource for connection pooling
> Amin!
>
> I�ve experienced the same problem as you but I�m trying with a MS Sql
> Server.
> Could you maybe send me or the list the code for the workaround?
>
>
> Niclas
>
>
> -----Oprindelig meddelelse-----
> Fra: Amine AMAR [mailto:[EMAIL PROTECTED]]
> Sendt: 19. december 2001 17:50
> Til: Tomcat Users List
> Emne: Re: JNDI resource for connection pooling
>
>
> Hi Rich,
>
> I still have no clean working solution.
>
> for the server.xml stuff, I have no clue why we should put config there. The
> docs says so, so I did give it a try. I have a
> workaround for my problem which is to write the registration in a stand
> alone class with the init() method registring the connection
> pooling class in JNDI. and have this class loaded at tomcat startup. the
> class works fine. I'm working on making it load at startup.
> I'll keep you posted when it works.
>
> Regards,
>
> Amine
>
>
>
> ----- Original Message -----
> From: "Rich Baldwin" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>; "Amine AMAR"
> <[EMAIL PROTECTED]>
> Sent: Wednesday, December 19, 2001 2:11 PM
> Subject: Re: JNDI resource for connection pooling
>
>
> > Amine
> >
> > Been playing around w/ the same thing as you. Have you figured it out
> yet? I
> > am a bit baffled by the role of setting the context in server.xml.
> Without making
> > any changes to server.xml, I downloaded and installed poolman and can run
> the
> > database client, querying any of my oracle tables. However in my
> servlets, I keep
> > getting a error when attempting to connect: res-ref-name is not bound in
> this context.
> > This all worked fine under tomcat 3.2. Why do I have to define a context
> in server.xml 4.0
> > and I didn't in server.xml 3.2? Poolman seems to work fine w/o one.
> Anybody got an anwser?
> >
> > Thanks, Rich
> >
> > Amine AMAR wrote:
> >
> > > Hi all,
> > >
> > > I have a problem, please can anyone help?
> > >
> > > I'm trying to create an Oracle pooled connection as a JNDI resource.
> > > I made the required configuration:
> > > WEB-INF\web.xml file:
> > > <web-app>
> > > <resource-ref>
> > > <res-ref-name>jdbc/toto</res-ref-name>
> > > <res-type>oracle.jdbc.pool.OracleConnectionPoolDataSource</res-type>
> > > <res-auth>Container</res-auth>
> > > </resource-ref>
> > > </web-app>
> > >
> > > %TOMCAT_HOME%\conf\server.xml
> > > <Context path="/titi" docBase="c:\www\titi" debug="0" reloadable="true">
> > > <Resource name="jdbc/toto" auth="Container"
> type="oracle.jdbc.pool.OracleConnectionPoolDataSource"/>
> > > <ResourceParams name="jdbc/toto">
> > > <parameter>
> > > <name>user</name>
> > > <value>tutu</value>
> > > </parameter>
> > > <parameter>
> > > <name>password</name>
> > > <value>tutu</value>
> > > </parameter>
> > > <parameter>
> > > <name>url</name>
> > > <value>jdbc:oracle:thin:@host:port:db</value>
> > > </parameter>
> > > </ResourceParams>
> > > </Context>
> > >
> > > When I register the resource from a program, everything works fine, when
> I try to register the pooled connection thru JNDI I get
> the following error:
> > > javax.naming.NamingException: Cannot create resource instance
> > >
> > > the list bindings and related methods give the following:
> > > toto: org.apache.naming.ResourceRef: Reference Class Name:
> oracle.jdbc.pool.OracleConnectionPoolDataSource
> > > Type: scope
> > > Content: Shareable
> > > Type: auth
> > > Content: Container
> > > Type: user
> > > Content: tutu
> > > Type: url
> > > Content: jdbc:oracle:thin:@host:port:db
> > > Type: password
> > > Content: tutu
> > >
> > > Does anybody have a clue?
> > >
> > > PS: sorry for my long message, I've been working on this for quite a
> while now :)
> > >
> > > Amine
> >
> >
>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>