Problem Description: How do you configure jconnect JDBC Connection Pooling with apache tomcat 4.1.x?
Tip or Workaround: (Observations Performed with jconnect-5_2 and tomcat 4.1.18)
In line, below, area the text of what sales:
Web.xmlsybase.jspserver.xml.sybasedelta
Please proceed as stock:
1) Create The Following Folders: 1.1) C: / Program Files / Apache Group / Tomcat 4.1 / WebApps / Sybase1.2) C: / Program Files / Apache Group / Tomcat 4.1 / WebApps / Sybase / JSP1.3) C: / Program files / apache group / tomcat 4.1 / WebApps / Sybase / Web-INF1.4) C: / Program Files / Apache Group / Tomcat 4.1 / WebApps / Sybase / WEB-INF / JSP
2) Move the file "Web.xml" to folderc: / program files / apache group / tomcat 4.1 / webapps / sybase / web-inf
3) Move the file "sybase.jsp" to folderc: / program files / apache group / tomcat 4.1 / webapps / sybase / jsp
4) Copy the contents of file "server.xml.sybasedelta" INTO YOUREXISTING "C: / Program Files / Apache Group / Tomcat 4.1 / conf / server.xml" file.
Insert the new content as an additional context within the "Tomcat-Standalone" service specification. Insert this after the last " context>" entry, but before the " host>" terminatorin the "Tomcat-Standalone" service grouping.
Replace The Following Strings with Values Appropriatto your installation:
Database_hostnameYour_dbnameYour_UserIDYOUR_PASSWORD
IF Your DataServer Is Not "Listening" on Port 5000, Make The Corresponding Change for the Port, TOO, IN Theconnection URL.
5) Copy Your Jconnect / Classes / JCONN2.JAR File Into Directoryc: / Program Files / Apache Group / Tomcat 4.1 / Common / LIB
6) SHUTDOWN AND RESTART TOMCAT.
7) from your Web Browser, Enter the Following URL:
Http: // localhost: 8080 / Sybase
-------------------------------------------------- --------- Text of File "Web.xml" ----------------------
Xml Version = "1.0" encoding = "ISO-8859-1"?>
web-app>
END_OF_TEXT (Web.xml)
Text of file "Sybase.jsp" -------------------------
<% @ page import = "java.sql. *"%> <% @ Page Import = "javax.sql. *"%> <% @ page import = "javax.naming. *"%> <% @ Page Import = "java.util. *"%>
<%
String s = "java: comp / ENV"; string t = "jdbc / a_sybase_datasource";
INITIALCONTEXT INITX = NULL; try {INITCTX = new initialcontext (); out.println ("
infitx = new initialContext (): successful"); out.println ("
"); Out.println (E);}
Context envcctx = null; try {envctx = (context) INITCTX.LOOKUP (S); out.println ("
Envctx = INitctx.lookup (" S "): successful"); Out.println ("< Br> "); Out.Println;} catch (exception e) {out.println ("
Envctx = INITCTX.LOOKUP (" S "): failed "); Out.Println (e) DataSource DS = NULL;
DS = null; try {out.println ("
Trying DS = (DataSource) envctX.lookup (" t ")"); DS = (Datasource) envctx.lookup (t); Out.println ("
DataSource Lookup Apparently successful "); out.println ("
" DS);} catch (exception e) {outputln ("
DataSource Lookup Failed
); Out.print (e);
IF (DS == (Datasource) NULL) {Out.println ("
Datasource Null / N);
Try {
Connection conn = ds.getConnection (); statement stmt = conn.createstatement (); resultset = stmt.executeQuery ("SELECT DB_NAME ()"); while (rs.next ()) {Out.println ("
rs.close (); stmt.close (); conn.close ();} // end_trycatch {output.println ("
INSIDE CATCH (SQLException SQE)); Out.println (SQE. GetMessage ());} // end catch SQLExceptionCatch (Exception E) {Out.println ("
INSIDE CATCH (Exception E)
); out.println (E.GetMessage ()); Out.Print (e);} // end catch eXception%>
End_of_text (Sybase.jsp)
Text of file "server.xml.sybasedelta" -------------------------------------! - Sybase Example Context - DSCP EXAMPLE ->
Resourceparams> context>
End_of_text (server.xmlsybasedelta)