Oh ok, very good!

-----Original Message-----
From: tsidhu [mailto:tsidh...@yahoo.com]
Sent: Thursday, January 10, 2013 3:20 PM
To: users@tomcat.apache.org
Subject: Re: JNDI setup oracle 11 g



Thank you all for the help. I manged to resolve it.

It was actually "human error" :(. I was initially deploying the Oracle JAR file 
via Eclipse, and then switched to put it in the containers lib directory.

Well Eclipse thought I was still trying to deploy the Oracle JAR which was nio 
longer in the path and it basically broke the build. Every time I exported the 
classed were not being compiled, instead it included the previously built 
"classes".

Once I removed the export of the Oracle Jar from Eclipse, the code worked fine.

Thanks again for help.

Tony

________________________________
 From: "Propes, Barry L [via Tomcat]" <ml-node+s10n4992246...@n6.nabble.com>
To: tsidhu <tsidh...@yahoo.com>
Sent: Thursday, January 10, 2013 3:36 PM
Subject: RE: JNDI setup oracle 11 g


And FWIW, Tony, I'm using this oracle jar.

ojdbc6.jar

-----Original Message-----
From: Marco de Booij [mailto:[hidden email]]
Sent: Thursday, January 10, 2013 2:24 PM
To: [hidden email]
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]"
> <[hidden email]>
> To: tsidhu <[hidden email]>
> 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: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



________________________________

If you reply to this email, your message will be added to the discussion 
below:http://tomcat.10.n6.nabble.com/JNDI-setup-oracle-11-g-tp4992221p4992246.html
To unsubscribe from JNDI setup oracle 11 g, click here.
NAML



--
View this message in context: 
http://tomcat.10.n6.nabble.com/JNDI-setup-oracle-11-g-tp4992221p4992248.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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

Reply via email to