db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From teamderby <mikehmur...@gmail.com>
Subject Tomcat Derby JSP Help needed! please
Date Fri, 28 Nov 2008 16:12:22 GMT

hi guys,
I'm having a bit of trouble configuring apache tomcat to work with a derby
database on mac OS. Below are the steps I took. The error I get when trying
to acces the page from a jsp page is "java.sql.SQLException: No suitable
driver". Can anyone please help, i'd be very very grateful.


Thanks,

Mike


I've created a derby database using the ij tool at location:

home/derby/db

I've installed Tomcat 6.0.18 at

home/applications/apache-tomcat-6.0.18/

and created a webapp at /apache-tomcat-6.0.18/webapps/ROOT 

i've attempted to integrate the db with tomcat by:

sever.xml. adding:

    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />

and to webapps/ROOT/server.xml

  <context-param>
     <param-name>
        javax.servlet.jsp.jstl.sql.dataSource
     </param-name>
     <param-value>jdbc/db</param-value>
  </context-param>

  <resource-ref>
     <description>DB Connection</description>
     <res-ref-name>jdbc/db</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
  </resource-ref>


in startup.sh I have added:

DERBY_HOME=/derby/db

CATALINA_OPTS="-Dderby.system.home=/derby/db"

CLASSPATH=\
Applications/apache-tomcat-6.0.18/lib/derbyclient.jar:\


I have then attempted to access the db from a jsp page using the following
script:

<%@ page language="java" import="java.sql.*" %>

<%
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
String dbName="/db";
String connectionURL = "jdbc:derby://localhost:8080/" + dbName; 
Connection conn = null;
try{
    Class.forName(driver);
} catch(java.lang.ClassNotFoundException e) {
    e.printStackTrace();
	out.println(e);
}
try {
    conn = DriverManager.getConnection(connectionURL);
	out.println("CONNETED<br>"); 

    //body of code to go here

}  catch (Throwable e)  {   
   out.println(e);
   e.printStackTrace();
} finally {
    
}

%>



This returns the error

"java.sql.SQLException: No suitable driver"


-- 
View this message in context: http://www.nabble.com/Tomcat-Derby-JSP-Help-needed%21-please-tp20737019p20737019.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.


Mime
View raw message