tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uma Gudi <uma.g...@tcs.com>
Subject RE: Oracle connection pooling
Date Sat, 14 Feb 2009 07:30:29 GMT
Hi Eric,

        I am executing as Stand-alone(my .class file out the tomcat), Is 
it possible to lookup for JNDI, As Tomcat running in the same machine.
Thanks and Regards
Uma Maheswara Rao Gudi
Tata Consultancy Services
Mailto: uma.gudi@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



"Hamacher, Eric" <Eric_Hamacher@gallup.com> 
02/13/2009 11:14 PM
Please respond to
"Tomcat Users List" <users@tomcat.apache.org>


To
Tomcat Users List <users@tomcat.apache.org>
cc

Subject
RE: Oracle connection pooling






I was just putting some fake values there.

But I got around the problem (although I can't remember how)  Now I put:

<Resource name="jdbc/GFDataSource" auth="Container"
                type="oracle.jdbc.pool.OracleDataSource"
                        factory="oracle.jdbc.pool.OracleDataSourceFactory"
                        connectionCachingEnabled="true"
                    maxActive="30"
                    maxIdle="2"
                    maxWait="1000"
                    username="username"
                    password="password"
                    driverClassName="oracle.jdbc.driver.OracleDriver"
                    url="jdbc:oracle:thin:@server:port:SID"/>

into META-INF/context.xml.  The type "javax.sql.DataSource" didn't work. 
Now when I call getConnection() on the OracleDataSource I get:

java.sql.SQLException: User credentials doesn't match the existing ones
        at 
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
        at 
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
        at 
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240)
        at 
oracle.jdbc.pool.OracleImplicitConnectionCache.validateUser(OracleImplicitConnectionCache.java:258)
        at 
oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:314)
        at 
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:286)
        at 
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:179)
        at 
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:159)

This looks like an Oracle problem.

Thanks for all your help!!

J.  ERIC  HAMACHER
Software Application Developer
608.664.3859
8476 Greenway Boulevard
Suite 100
Middleton, WI  53562
USA
GALLUP Technology

Achiever | Learner | Restorative | Intellection | Deliberative

-----Original Message-----
From: Propes, Barry L [mailto:barry.l.propes@citi.com]
Sent: Thursday, February 12, 2009 4:27 PM
To: 'Tomcat Users List'
Subject: RE: Oracle connection pooling

Yeah -- 3333 looked like an odd port to me, too -- I've only seen 1521, 
1526 and 1527 before.
I figured his SID was just a generic placeholder for his real SID.

-----Original Message-----
From: Jorge Medina [mailto:jmedina@e-dialog.com]
Sent: Thursday, February 12, 2009 4:12 PM
To: Tomcat Users List
Subject: RE: Oracle connection pooling


Is your Oracle database port 3333 and is the name of your SID "SID"?

We use Oracle jdbc driver with Oracle 10g.
I set the attributes on the resource to:
   type="javax.sql.DataSource"
   driverClassName="oracle.jdbc.OracleDriver"
and no factory


-----Original Message-----
From: Hamacher, Eric [mailto:Eric_Hamacher@gallup.com]
Sent: Thursday, February 12, 2009 3:52 PM
To: users@tomcat.apache.org
Subject: Oracle connection pooling

Hello:

I am in a bind.

I am getting:

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context 
at
org.apache.naming.NamingContext.lookup(NamingContext.java:770)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at
survey.db.SurveyConnection.getConnection(SurveyConnection.java:66)
      at
util.LoadDropdownListener.loadAllCodes(LoadDropdownListener.java:137)
      at
util.LoadDropdownListener.contextInitialized(LoadDropdownListener.java:7
8)

when I add:

<Resource name="jdbc/GFDataSource" auth="Container"
                  type="oracle.jdbc.pool.OracleDataSource"
                  factory="oracle.jdbc.pool.OracleDataSourceFactory"
                  connectionCachingEnabled="true"
                maxActive="30"
                maxIdle="2"
                maxWait="1000"
                username="GLP_S"
                password="gideupstg"
                driverClassName="oracle.jdbc.driver.OracleDriver"
                url="jdbc:oracle:thin:@server:3333:SID"/>

to either server.xml (under <Server>), config/context.xml (under 
<Context>), or in META-INF/context.xml.

Here's what these files look like when I place <Resource> in them:

********** SERVER.XML
***************************************************************

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"

factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />

<Resource name="jdbc/GFDataSource" auth="Container"
                  type="oracle.jdbc.pool.OracleDataSource"
                  factory="oracle.jdbc.pool.OracleDataSourceFactory"
                  connectionCachingEnabled="true"
                maxActive="30"
                maxIdle="2"
                maxWait="1000"
                username="username"
                password="password"
                driverClassName="oracle.jdbc.driver.OracleDriver"
                url="jdbc:oracle:thin:@server:3333:SID"/>

  </GlobalNamingResources>
  <Service name="Catalina">

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
</Server>

*************** CONFIG/CONTEXT.XML
*******************************************


<Context>
<Resource name="jdbc/GFDataSource" auth="Container"
                  type="oracle.jdbc.pool.OracleDataSource"
                  factory="oracle.jdbc.pool.OracleDataSourceFactory"
                  connectionCachingEnabled="true"
                maxActive="30"
                maxIdle="2"
                maxWait="1000"
                username="username"
                password="password"
                driverClassName="oracle.jdbc.driver.OracleDriver"
                url="jdbc:oracle:thin:@server:3333:SID"/>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

</Context>

*************** META-INF/CONTEXT.XML
*******************************************

<Context>

<Resource name="jdbc/GFDataSource" auth="Container"
                  type="oracle.jdbc.pool.OracleDataSource"
                  factory="oracle.jdbc.pool.OracleDataSourceFactory"
                  connectionCachingEnabled="true"
                maxActive="30"
                maxIdle="2"
                maxWait="1000"
                username="username"
                password="password"
                driverClassName="oracle.jdbc.driver.OracleDriver"
                url="jdbc:oracle:thin:@server:3333:SID"/>
</Context>



Here is the offending code:

           Context context = new InitialContext();
            DataSource pds = null;
            pds = (DataSource)context.lookup("jdbc/GFDataSource");
            Connection conn = pds.getConnection();
            context.close();


I have tried java:comp/env/jdbc/GFDataSource as well.  I am using 
ojdbc14dms.jar and dms.jar.

J.  ERIC  HAMACHER
Software Application Developer
608.664.3859
8476 Greenway Boulevard
Suite 100
Middleton, WI  53562
USA
GALLUP Technology

Achiever | Learner | Restorative | Intellection | Deliberative


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


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


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


ForwardSourceID:NT0001526E 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message