Hi,
When Tomcat is installed as a service , it requires that all the library
jars
should be mapped in the "wrapper.properties" file with following line :
wrapper.class_path=$(wrapper.tomcat_home)\lib\xxx.jar
where xxx.jar is the required jar file.
Try to remove the old service.
Modify the file and retry. I hope it will work.
Good Luck !
-Amit.
>
>
> Hi, experts!
> I met a problem when I tried to make JDBC connection by using the
> code as follows.
>
> The program work well when I use startup.bat to start tomcat.
>
> But I cannot use it when I start Tomcat as a service. Yet I can
> still use all the other JSP sameples, it tells me the URL is not valid
> or does not exist. I promise the ODBC data source is there and I can use
> it when I start tomcat using Startup.bat
> So can some body tell me the reason.
>
> --------------------------------------------
>
>
> public class PersistentConnection {
>
> private static Connection theConnection;
> public static Connection getConnection() {return theConnection;}
>
> public void setDbClass() {
> try {
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
>
> } catch (Exception e) {
> System.err.println("Error loading class");
> e.printStackTrace(System.err);
> }
> }
>
> public void setConnection() {
> try {
> theConnection =
> DriverManager.getConnection("jdbc:odbc:NorthWind","username","password");
>
> }catch (Exception e) {
> System.err.println("Error setting DBUrl");
> e.printStackTrace(System.err);
> }
> }
>
> public void shutDown() {
> try {
> theConnection.close();
> } catch (Exception e) {}
> }
> }
>
>
>