tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Propes, Barry L " <barry.l.pro...@citi.com>
Subject RE: JNDI setup oracle 11 g
Date Thu, 10 Jan 2013 20:34:22 GMT
I was going to ask this, too.

Which oracle jar are you using for this?


-----Original Message-----
From: Marco de Booij [mailto:marco.developer@debooy.eu]
Sent: Thursday, January 10, 2013 2:24 PM
To: users@tomcat.apache.org
Subject: Re: JNDI setup oracle 11 g

If you get an error when you provide a wrong username or password then the connection works.
Also the ORA-00911 indicates to a connection with the database.

Oracle works through JNDI (I use JNDI with Weblogic) and through JDBC. I do not know why you
say that the "simple" URL cannot be used for RAC databases. There is even a simpler way (I
will check tomorrow at work) in which you only use the alias (no port or servername) but then
you need to use the own Oracle JDBC drivers.

Perhaps here lies your problem. Do you use the right JDBC drivers with Tomcat? Oracle has
multiple versions depending on your database version and even the JDK. Check their website.

Marco

Op 10-01-13 20:57, tsidhu schreef:
> So the string works in that it connects to the DB. I just get an error when I try and
use the connection.
>
> I tested by providing an invalid password, and I did get a password invalid error from
oracle in the stack trace.
>
> I think the issue is in the get connection call it must make some call to the db, that
oracle does not like when used via JNDI but works fine when used via JDBC.
>
> Tony
>
>
> ________________________________
>   From: "Propes, Barry L [via Tomcat]"
> <ml-node+s10n4992236h6@n6.nabble.com>
> To: tsidhu <tsidhuus@yahoo.com>
> Sent: Thursday, January 10, 2013 2:32 PM
> Subject: RE: JNDI setup oracle 11 g
>
>
> Hmmm. I didn't know that, I guess.
>
> Well, I wonder if that long string requires some kind of escape character to be inserted
in it?
>
>
> -----Original Message-----
> From: tsidhu [mailto:[hidden email]]
> Sent: Thursday, January 10, 2013 1:22 PM
> To: [hidden email]
> Subject: Re: JNDI setup oracle 11 g
>
> Thanks Barry,
>
> The reason for the long dburl string is that this is an Oracle RAC (Clustered database).
My understanding is that the "simple" dburl cannot be used for RAC databases.
>
> Also, I tried removing/adding the  validationQuery  from the context.xml, however that
did not work either :(.
>
> When I researched the ORA-00911 error, it typically is thrown when you haven an invalid
character in the query. However I get this error when trying to get a connection via the JNDI
reference to the pool.
>
> The strange thing is that this works via a simple java program that directly uses the
JDBC/Oracle driver.
>
> I can work around the issue by not using JNDI in the web app, however I am not then able
to use pooling I guess.
>
> Tony
>
>
> ________________________________
>   From: "Propes, Barry L [via Tomcat]" <[hidden email]>
> To: tsidhu <[hidden email]>
> Sent: Thursday, January 10, 2013 1:09 PM
> Subject: RE: JNDI setup oracle 11 g
>
>
> Tony,
>
> I have a similar standalone Java app that hits Oracle 11g.
>
> At your line with the DBURL, I have something much more concise.
>
> Where you have
> public static final String DBURL = "jdbc:oracle:thin:@(DESCRIPTION =
> (ADDRESS = (PROTOCOL = TCP)(HOST = abc-def-scan.corp.xyz.com)(PORT =
> 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =
> SAMPLE.WORLD) )  )";
>
>
> I simply have:
>   String dbURL = "jdbc:oracle:thin:@dbservername.1526:servicename";
>
> I set the rest of that string in my tnsnames.ora file - not sure if you're unable to
do this or not. I'd think you'd do it there.
>
> Could that be where the error is stemming from?
>
> The rest of it looks correct to me.
>
> -----Original Message-----
> From: tsidhu [mailto:[hidden email]]
> Sent: Thursday, January 10, 2013 9:52 AM
> To: [hidden email]
> Subject: JNDI setup oracle 11 g
>
> Hello,
>
> I am able to connect to my database from a stand alone java program, however the same
connection information throws an exception when used via JNDI.
>
> MY JNDI / Context.xml configuration
>
> <Resource name="jdbc/myoracle" auth="Container"
>        type="javax.sql.DataSource"
>                  description="Oracle Datasource"
>                  driverClassName="oracle.jdbc.OracleDriver"
> url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=abc-def-scan.corp.xyz.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SAMPLE.WORLD)))"
> username="user1" password="pass1" maxActive="20" maxIdle="10" maxWait="-1"
>                  validationQuery = "SELECT 1 FROM DUAL" />
>
> The query runs fine when used in a stand alone java app, and I have tried all things
in the Context.XML to resolve.
> I know it connects fine to the DB, however the getConnection from the JNDI datasource
is causing that error to be thrown.
>
> Tony
>
>
>
>
>


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


Mime
View raw message