Re: JNDI + Tomcat + Oracle 9i Database
Hi [difficult name ommited], I had this problem a couple of weeks ago. try changing the url to capitals ! nameURL/name This fixed an identical problem for me. Thanks, Mehdi Nejad Sebastião Carlos Santos To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: .com.br Subject: JNDI + Tomcat + Oracle 9i Database 25/02/2003 15:02 Please respond to Tomcat Users List I am trying to configure JNDI to access Oracle 9i R1, according to JNDI Datasource HOW-TO, however I am not obtaining a lot of success when I go to establish the connection. In the end of this e-mail I will list some fragments of the configuration of server.xml, web.xml and of my class java that I am using to accomplish the connection test. The reference $CATALINA_HOME/common/lib/*. jar is in CLASSPATH of the system Fragment of configuration of server.xml ... Resource name=jdbc/sged auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sged parameternamefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value/parameter parameternamedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value/parameter parameternameurl/name valuejdbc:oracle:[EMAIL PROTECTED]:1521:XXX/value/parameter parameternameusername/namevaluescott/value/parameter parameternamepassword/namevaluej/value/parameter parameternamemaxActive/namevalue20/value/parameter parameternamemaxIdle/namevalue10/value/parameter parameternamemaxWait/namevalue1/value/parameter parameternameremoveAbandoned/namevaluetrue/value/parameter parameternameremoveAbandonedTimeout/namevalue60/value/parameter parameternamelogAbandoned/namevaluetrue/value/parameter /ResourceParams ... File /web/WEB-INF/web.xml ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionOracle Database Connection/description resource-ref descriptionPool/description res-ref-namejdbc/sged/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.jsp/welcome-file welcome-fileindex.htm/welcome-file /welcome-file-list /web-app Method of the class java that makes the connection test public String obtem_dados() { Connection conn = null; Statement stmt = null; ResultSet rset = null; resultado = new StringBuffer(); try { Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup (java:/comp/env); DataSource ds = (DataSource)envContext.lookup (jdbc/sged); conn = ds.getConnection(); stmt = conn.createStatement(); rset = stmt.executeQuery(SELECT COUNT(*) FROM V$SESSION); if (rset.next()) { resultado.append(Número de Conexões - ); resultado.append(rset.getString(1)); resultado.append(br); } } catch (java.lang.Exception e) {
Re: JNDI + Tomcat + Oracle 9i Database
When I made the change of the nameurl / name for nameURL / name I started to receive the following error message Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' it goes connect URL 'null' Going back to the configuration nameurl / name Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' it goes connect URL 'jdbc:oracle:[EMAIL PROTECTED]:1521:GED' Taking advantage of the opportunity, which driver JDBC should use, ojdbc14.jar (for the jdk 1.4) or classes12.zip, that should have the name according to the documentation changed for classes12.jar Sebastião Carlos Santos Oracle Database Administrator Universidade Federal de Uberlândia - UFU Gratificação de Estímulo à Docência - GED - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI + Tomcat + Oracle 9i Database
Kris, I believe that I went badly interpreted or I wrote of less in the e-mail. I don't see him/it why of installing the customer of Oracle 9i in the application servant for the simple fact most of the time, after the installation routines we have to specify the files. zip and. jar copied in the installation for ORACLE_HOME in CLASSPATH of the system, which in other words it would be the same thing of using the drivers jdbc supplied separately. I didn't have the intention of contradicting the positioning for you put. Respectfully, Sebastião Carlos Santos Oracle Database Administrator Universidade Federal de Uberlândia - UFU Gratificação de Estímulo à Docência - GED
RE: JNDI + Tomcat + Oracle 9i Database
This issue has been asked and answered again and again in the mailing list of tomcat, struts, and commons. Consider that Oracle is so populate, setup should be pretty straightforward. My advice is to make sure that you have read carefully the tomcat datasource documentation. My environment is J2sdk 1.4.1_01 = 1.4 Tomcat 4.1.18 Apache 2.0.44 Tomcat Connector 2.0.3 Red Hat Linux 7.2 (prod) Windows 2000 (dev) Oracle 8.1.7 classes12.jar = 1.2 1. Below is part of my context. Do not invent the resource type, driver, and factory. I saw someone use a different factory or driver think they are going to utilize Oracle's pooling. It is smart but it is wrong in this case. To prove it is wrong, read Tomcat source code. Resource name=jdbc/abcd auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/abcd parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@oratest.int.abcd.com:1521:PROD/value /parameter 2. Also in my app's web.xml resource-ref descriptionOracle Datasource/description res-ref-namejdbc/abcd/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Do not put commons-dbcp and pooling jars in your app's WEB-INF/lib, use Tomcat's (in common/lib). 3. Initialize the connection pool and get connection: Context initContext = new InitialContext(); Context envContext = (Context) initContext.lookup(java:comp/env); DataSource dataSource = (DataSource) envContext.lookup(jdbc/abcd); dataSource.getConnection() Don't do anything other than point 3 to get the connection or driver. I have had two problems before: - null driver: renamed classes12.zip to classes12.jar and put it ONLY in commons/lib. - cannot connect: use a real url other than Microsoft's name, so oratest won't work on linux while oratest.mydomain.com works. - cast exception: use commons dbcp and pooling in commons/lib. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Sebastião Carlos Santos [mailto:[EMAIL PROTECTED] Sent: February 25, 2003 1:37 PM To: [EMAIL PROTECTED] Subject: Re: JNDI + Tomcat + Oracle 9i Database When I made the change of the nameurl / name for nameURL / name I started to receive the following error message Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' it goes connect URL 'null' Going back to the configuration nameurl / name Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' it goes connect URL 'jdbc:oracle:[EMAIL PROTECTED]:1521:GED' Taking advantage of the opportunity, which driver JDBC should use, ojdbc14.jar (for the jdk 1.4) or classes12.zip, that should have the name according to the documentation changed for classes12.jar Sebastião Carlos Santos Oracle Database Administrator Universidade Federal de Uberlândia - UFU Gratificação de Estímulo à Docência - GED - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]