tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Faulkner <christopher.faulk...@ntlworld.com>
Subject database connect to db overr mod_webapp - possible bug
Date Tue, 12 Feb 2002 13:26:12 GMT
Hi

I have a JSP which,when called direct into Tomcat (4.0.1) on Linux works fine. It connects
to a database, retrieves results, fine.

http://host_a:8080/ism/JSP/file.jsp?param1=value&param2=value

"host_a" is a vrtual host defined in my apache config and in the DNS servers on our LAN.

In the virtual host setting of Apache, I have 

WebAppConnection coni warp localhost:8008
WebAppDeploy ism   coni    /ism/

Static pages,servlets and JSP are fine across mod_webapp. However, when I try my database
JSP, I get errors. This code is in the JSP when I go through 8080 and it WORKS, it connects
to the DB and all goes 
OK. So my configuration of the jdbc/IsmDB must be OK. I created the JDBC datasources as outlined
at the Tomcat website.

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
javax.sql.DataSource ds = (javax.sql.DataSource)envCtx.lookup("jdbc/IsmDB");
Connection conn = ds.getConnection();

However, when I connect to the page via Apache, the third line fails the connection to the
database fails. I replace those 4 lines with the following and it works.

String sConn   = "jdbc:oracle:thin:@ip:port:sid"; // connnection string
DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver() );
Connection conn=DriverManager.getConnection( sConn, "user", "password" );
Statement stmt    = conn.createStatement();

So have I missed some configuration to make the database connection work over mod_webapp or
is this a bug ?

Thanks


Chris



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message