Re: tomcat JDNI DB connection pool to Oracle

2002-09-03 Thread Vance Christiaanse

Isabel,


Your ResourceParams element contains

  
url
jdbc:oracle:oci8@homebank
  

but for 4.0.x "url" should be "driverName". ("url" is a much clearer name!)

(See
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html)

Also, you don't need the  element.

Hope this helps,

Vance

- Original Message -
From: "Isabel Lameda" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 03, 2002 8:50 AM
Subject: tomcat JDNI DB connection pool to Oracle


Anabody could help me, i´ve been trying to do this for days

I've been successfully making JDBC connections directly in my JSP

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con =
DriverManager.getConnection("jdbc:oracle:oci8:"+login+"/"+passwd+"@"+databas
e)

Now I'm trying to setup my Tomcat 4.0.9's JDNI DB connection pool, but I
can't get it to work

Here is what I've done so far

1. Move the Oracle Drivers (classes12.zip) into \common\lib
directory and rename it to classes12.jar

2. Added the following codes to my webapp's web.xml


jdbc/homebank
javax.sql.DataSource
Container



3. Added the following codes within the 
 tag
   of \conf\server.xml




  
factory
org.apache.commons.dbcp.BasicDataSourceFactory
  
  
driverClassName
oracle.jdbc.driver.OracleDriver
  
  
url
jdbc:oracle:oci8@homebank
  
  
username
scott
  
  
password
tiger
  
  
maxActive
20
  
  
maxIdle
10
  
  
maxWait
-1
  


4. try to make connection within my JSP

<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.naming.*" %>

<%
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/homebank");
Connection conn1 = ds.getConnection();
out.println("Oracle Connected!");
}
catch (SQLException E) {
out.println("unable to get connection on ora !");
out.println("SQLException: " + E.getMessage());
out.println("SQLState: " + E.getSQLState());
out.println("VendorError: " + E.getErrorCode());
}
%>

Results :
unable to get connection on ora !
SQLException: Cannot load JDBC driver class 'null'
SQLState: null
VendorError: 0

Why? I'm able to make connection call JDBC directly in my other JSP,
but not when I try to get the connection via JDNI Context ...??

Thank you in advance

P.S.: i´ve search the archives and found nothing that could help me.

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: tomcat JDNI DB connection pool to Oracle

2002-09-03 Thread Simon T

I am running ok with tomcat 4.1.9  using the oracle thin driver.

Tomcat 4.1 JNDI datasource examples doc say -

Use of the OCI driver should simply involve a changing thin to oci in 
the URL string.

url
jdbc:oracle:thin:[EMAIL PROTECTED]:1521:mysid

Your url in server.xml is 
jdbc:oracle:oci8@homebank

If homebank is in your tnsname.ora maybe tomcat is having problems locating it.


Or

Do you have the commons jar files e.g. commons-dbcp.jar in  common\lib

The commons jar file were installed for me when i installed tomcat 4.1.9.

Good luck.

Simon


Isabel Lameda wrote:

>Anabody could help me, i´ve been trying to do this for days
>
>I've been successfully making JDBC connections directly in my JSP 
>
>DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
>Connection con =
>DriverManager.getConnection("jdbc:oracle:oci8:"+login+"/"+passwd+"@"+databas
>e)
>
>Now I'm trying to setup my Tomcat 4.0.9's JDNI DB connection pool, but I
>can't get it to work
>
>Here is what I've done so far
>
>1. Move the Oracle Drivers (classes12.zip) into \common\lib 
>directory and rename it to classes12.jar
>
>2. Added the following codes to my webapp's web.xml
>
>
>jdbc/homebank
>javax.sql.DataSource
>Container
>
>
>
>3. Added the following codes within the 
> tag
>   of \conf\server.xml
>
>  type="javax.sql.DataSource"/> 
>
>
>  
>factory
>org.apache.commons.dbcp.BasicDataSourceFactory
>  
>  
>driverClassName
>oracle.jdbc.driver.OracleDriver
>  
>  
>url
>jdbc:oracle:oci8@homebank
>  
>  
>username
>scott
>  
>  
>password
>tiger
>  
>  
>maxActive
>20
>  
>  
>maxIdle
>10
>  
>  
>maxWait
>-1
>  
>
>
>4. try to make connection within my JSP
>
><%@ page import="java.net.*" %>
><%@ page import="java.io.*" %>
><%@ page import="java.sql.*" %>
><%@ page import="javax.sql.*" %>
><%@ page import="java.util.*" %>
><%@ page import="javax.naming.*" %>
>
><%
>try {
>Context initCtx = new InitialContext();
>Context envCtx = (Context) initCtx.lookup("java:comp/env");
>DataSource ds = (DataSource) envCtx.lookup("jdbc/homebank");
>Connection conn1 = ds.getConnection();
>out.println("Oracle Connected!");
>} 
>catch (SQLException E) {
>out.println("unable to get connection on ora !"); 
>out.println("SQLException: " + E.getMessage());
>out.println("SQLState: " + E.getSQLState());
>out.println("VendorError: " + E.getErrorCode());
>}
>%>
>
>Results :
>unable to get connection on ora ! 
>SQLException: Cannot load JDBC driver class 'null' 
>SQLState: null 
>VendorError: 0 
>
>Why? I'm able to make connection call JDBC directly in my other JSP, 
>but not when I try to get the connection via JDNI Context ...??
>
>Thank you in advance
> 
>P.S.: i´ve search the archives and found nothing that could help me.
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>
>  
>




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




tomcat JDNI DB connection pool to Oracle

2002-09-03 Thread Isabel Lameda

Anabody could help me, i´ve been trying to do this for days

I've been successfully making JDBC connections directly in my JSP 

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con =
DriverManager.getConnection("jdbc:oracle:oci8:"+login+"/"+passwd+"@"+databas
e)

Now I'm trying to setup my Tomcat 4.0.9's JDNI DB connection pool, but I
can't get it to work

Here is what I've done so far

1. Move the Oracle Drivers (classes12.zip) into \common\lib 
directory and rename it to classes12.jar

2. Added the following codes to my webapp's web.xml


jdbc/homebank
javax.sql.DataSource
Container



3. Added the following codes within the 
 tag
   of \conf\server.xml

 


  
factory
org.apache.commons.dbcp.BasicDataSourceFactory
  
  
driverClassName
oracle.jdbc.driver.OracleDriver
  
  
url
jdbc:oracle:oci8@homebank
  
  
username
scott
  
  
password
tiger
  
  
maxActive
20
  
  
maxIdle
10
  
  
maxWait
-1
  


4. try to make connection within my JSP

<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.naming.*" %>

<%
try {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/homebank");
Connection conn1 = ds.getConnection();
out.println("Oracle Connected!");
} 
catch (SQLException E) {
out.println("unable to get connection on ora !"); 
out.println("SQLException: " + E.getMessage());
out.println("SQLState: " + E.getSQLState());
out.println("VendorError: " + E.getErrorCode());
}
%>

Results :
unable to get connection on ora ! 
SQLException: Cannot load JDBC driver class 'null' 
SQLState: null 
VendorError: 0 

Why? I'm able to make connection call JDBC directly in my other JSP, 
but not when I try to get the connection via JDNI Context ...??

Thank you in advance
 
P.S.: i´ve search the archives and found nothing that could help me.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: