URGENT: Jdbc database configuration for tomcat in server.xml file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Stefaan_Delanghe
Posted On:   Tuesday, October 1, 2002 10:17 PM

I try to connect to a oracle database by configuring my server.xml file of tomcat in standalone mode. A servlet is used to access the database but everytime I get a not suitable driver sql exception. Could anyone tell me what is wrong with this!!!!! servlet.java Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); tyrex.jdbc.xa.EnabledDataSource ds = (tyrex.jdbc.xa.EnabledDataSource)envCtx.lookup("jdbc/EmpDB"); // DataSource ds = (DataSource)envCtx.lookup("jdbc/EmpDB"); conn = ds.getConnection();    More>>

I try to connect to a oracle database by configuring my server.xml file of tomcat in standalone mode.
A servlet is used to access the database but everytime
I get a not suitable driver sql exception.

Could anyone tell me what is wrong with this!!!!!





servlet.java




Context initCtx = new InitialContext();

Context envCtx = (Context)

initCtx.lookup("java:comp/env");



tyrex.jdbc.xa.EnabledDataSource ds =
(tyrex.jdbc.xa.EnabledDataSource)envCtx.lookup("jdbc/EmpDB");

// DataSource ds =
(DataSource)envCtx.lookup("jdbc/EmpDB");

conn = ds.getConnection();



server.xml










className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5"
maxProcessors="75"
enableLookups="true"
redirectPort="8443"
acceptCount="10" debug="0"
connectionTimeout="60000"/>


className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5"
maxProcessors="75"
acceptCount="10" debug="0"/>


debug="0">


className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>


className="org.apache.catalina.realm.MemoryRealm" />


appBase="webapps" unpackWARs="true">


className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="common"/>


className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="localhost_log." suffix=".txt"
timestamp="true"/>










type="javax.sql.DataSource"/>





user mail





password mail






driverClassName oracle.jdbc.driver.OracleDriver






url jdbc:oracle:thin:@oracle:1521/ORCL




maxActive 32


maxIdle 10




























className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps"
acceptCount="10" debug="0"/>




className="org.apache.catalina.connector.warp.WarpEngine"
name="Apache" debug="0">




className="org.apache.catalina.logger.FileLogger"
prefix="apache_log." suffix=".txt"
timestamp="true"/>




className="org.apache.catalina.realm.MemoryRealm" />










web.xml





<?xml version="1.0" encoding="ISO-8859-1"?>


PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">






DataSourceServlet

DataSourceServlet







DataSourceServlet

/DataSourceServlet







Resource reference to a factory for
java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file.

jdbc/EmpDB

javax.sql.DataSource

Container






   <<Less

Re: URGENT: Jdbc database configuration for tomcat in server.xml file

Posted By:   Mitch_Winkle  
Posted On:   Thursday, October 10, 2002 02:25 PM

Rule number one of JDBC...load the driver.


Class.forName("your.jdbc.driver.Name");
About | Sitemap | Contact