act1ve
asked on
could not find database driver - jsp
Hi,
im receiving an error saying
Could not find the database driver
and then hence
Could not connect to the database
i have classes111.zip in WEB-INF/lib of tomcat folder
Anyone any ideas?
im receiving an error saying
Could not find the database driver
and then hence
Could not connect to the database
i have classes111.zip in WEB-INF/lib of tomcat folder
Anyone any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you should put the jar files into WEN-INF/lib and any .class files into WEB-INF/classses. If there is a web.xml file, it goes in WEB-INF.
See here for an example of the basic structure of a webapp http://e-docs.bea.com/wls/docs70/webapp/basics.html
ASKER
thanks,
i unzipped and it created 2 directories, javax and oracle with numerous sub directories in the oracle one.
Still receiving the same error though. Do i have to seperate all the files inside these directories? There are quite a number. If so do i break the directory structure?
i unzipped and it created 2 directories, javax and oracle with numerous sub directories in the oracle one.
Still receiving the same error though. Do i have to seperate all the files inside these directories? There are quite a number. If so do i break the directory structure?
what are these files? Are they jars or are they class files? Javax is a reserved keyword for Suns exterprise library (j2ee.jar and servlet.jar for example). To picked up by tomcat the jars must be directly in the WEB-INF/lib folder
Where did you download this zip from, are there no installation instructions?
Where did you download this zip from, are there no installation instructions?
ASKER
the file classes111.zip was located in C:\oracle\ora81\jdbc\lib\c lasses111. zip. The oracle client software was already installed on my machine and is apparently all i need for conneciton to the database.
in javax there is another folder called sql which holds many class files (ConnecitonEvent.class for example). The oracle folder has numerous other folders all containing classes
in javax there is another folder called sql which holds many class files (ConnecitonEvent.class for example). The oracle folder has numerous other folders all containing classes
All class files belong in directories in the folder WEB-INF/classes depending on their package. If I have a class called DBConnector that is in the package com.bloodredsun.dbUtils (as declared at the top of the source code) then it would need to go into the folder WEB-INF/classes/com/bloodr edsun/dbUt ils.
Also, have you downloaded the Oracle driver and palced that Jar in the WEB-INF/lib folder?
But again, where did you download this zip from, are there no installation instructions?
Can you please show the exception/error you are getting, and maybe the relevent bitof the jsp you are using?
Also, have you downloaded the Oracle driver and palced that Jar in the WEB-INF/lib folder?
But again, where did you download this zip from, are there no installation instructions?
Can you please show the exception/error you are getting, and maybe the relevent bitof the jsp you are using?
All class files belong in directories in the folder WEB-INF/classes depending on their package. If I have a class called DBConnector that is in the package com.bloodredsun.dbUtils (as declared at the top of the source code) then it would need to go into the folder WEB-INF/classes/com/bloodr edsun/dbUt ils.
Also, have you downloaded the Oracle driver and palced that Jar in the WEB-INF/lib folder?
But again, where did you download this zip from, are there no installation instructions?
Can you please show the exception/error you are getting, and maybe the relevent bitof the jsp you are using?
Also, have you downloaded the Oracle driver and palced that Jar in the WEB-INF/lib folder?
But again, where did you download this zip from, are there no installation instructions?
Can you please show the exception/error you are getting, and maybe the relevent bitof the jsp you are using?
>> you need to unzip the classes111.zip file into that folder
! I don't think you do...
You need to do
Class.forName( "oracle.jdbc.OracleDriver" ) ;
Before you try to get a connection from the DriverManager...
it should be fine as it was. As a zip file in the WEB-INF/lib
Actually...are you defining a resource in server.xml?
In that case, you need to move classes111.zip into tomcat/common/lib
! I don't think you do...
You need to do
Class.forName( "oracle.jdbc.OracleDriver"
Before you try to get a connection from the DriverManager...
it should be fine as it was. As a zip file in the WEB-INF/lib
Actually...are you defining a resource in server.xml?
In that case, you need to move classes111.zip into tomcat/common/lib
ASKER
This zip is the same as which can be downloaded from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc817.html
That creates the directories javax and oracle when unzipped? It doesnt seem to come just as one jar file?
The error i get is:
org.apache.jasper.JasperEx ception: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\query$js p.java:71: ';' expected.
Could not find the database driver
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\query$js p.java:73: ';' expected.
Could not connect to the database
Thanks for all your help
That creates the directories javax and oracle when unzipped? It doesnt seem to come just as one jar file?
The error i get is:
org.apache.jasper.JasperEx
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
Could not find the database driver
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
Could not connect to the database
Thanks for all your help
You mean like this?
http://www.mathworks.com/access/helpdesk/help/toolbox/database/instal13.html
It might work if you just rename it from .zip to .jar
http://www.mathworks.com/access/helpdesk/help/toolbox/database/instal13.html
It might work if you just rename it from .zip to .jar
>> It might work if you just rename it from .zip to .jar
It will work as .zip
Or at least I always used it as .zip
It will work as .zip
Or at least I always used it as .zip
Ahhhh... Tomcat might not automatically add it to the classpath...
try renaming it to .jar as brs said ;-)
I'll be quiet now ;-)
try renaming it to .jar as brs said ;-)
I'll be quiet now ;-)
>>I'll be quiet now ;-)
Don't! you always seem to stop me from barking up the wrong tree %-)
Don't! you always seem to stop me from barking up the wrong tree %-)
ASKER
i renamed the zip file to .jar but still the same error posted earlier appears.
This is my code for connection:
<%
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.driver.Oracle Driver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "myhost";
String portNumber = "1521";
String sid = "MACH";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "myusername";
String password = "mypassword";
connection = DriverManager.getConnectio n(url, username, password);
} catch (ClassNotFoundException e) {
Could not find the database driver
} catch (SQLException e) {
Could not connect to the database
}
%>
Does that seem ok?
This is my code for connection:
<%
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.driver.Oracle
Class.forName(driverName);
// Create a connection to the database
String serverName = "myhost";
String portNumber = "1521";
String sid = "MACH";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "myusername";
String password = "mypassword";
connection = DriverManager.getConnectio
} catch (ClassNotFoundException e) {
Could not find the database driver
} catch (SQLException e) {
Could not connect to the database
}
%>
Does that seem ok?
>> Don't! you always seem to stop me from barking up the wrong tree %-)
Hehehe, same here :-D
act1ve, you are doing:
Class.forName( "oracle.jdbc.OracleDriver" ) ;
before you try to get your connection aren't you?
Hehehe, same here :-D
act1ve, you are doing:
Class.forName( "oracle.jdbc.OracleDriver"
before you try to get your connection aren't you?
Try
String driverName = "oracle.jdbc.OracleDriver" ;
(NB: I may be wrong, but I seem to remember that's what it was called)
I always used to use classes12.zip tho, not 111
String driverName = "oracle.jdbc.OracleDriver"
(NB: I may be wrong, but I seem to remember that's what it was called)
I always used to use classes12.zip tho, not 111
ASKER
sorry mate, not too sure what you mean there, do you mean in that jsp connection which i just posted?
String driverName = "oracle.jdbc.driver.Oracle Driver";
Class.forName(driverName);
?
If so i assumed drivername was declared as a string and used then by Class.forName?
String driverName = "oracle.jdbc.driver.Oracle
Class.forName(driverName);
?
If so i assumed drivername was declared as a string and used then by Class.forName?
ASKER
tried removing driver but the same prob, im stuck using classes111 because of jdkv1 only being installed on this computer :(
thanks for all your continued help
thanks for all your continued help
Yeah, that's cool...but try:
String driverName = "oracle.jdbc.OracleDriver" ;
instead of
String driverName = "oracle.jdbc.driver.Oracle Driver";
String driverName = "oracle.jdbc.OracleDriver"
instead of
String driverName = "oracle.jdbc.driver.Oracle
ASKER
again same error :( not looking good :/
>> tried removing driver but the same prob
Ahhh...
I know what it is!! :-D *bounce*
Change this:
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
to this:
String url = "jdbc:oracle:thin:@//" + serverName + ":" + portNumber + "/" + sid;
You had the OCI format...tht's now the thin format :-)
Tim
Ahhh...
I know what it is!! :-D *bounce*
Change this:
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
to this:
String url = "jdbc:oracle:thin:@//" + serverName + ":" + portNumber + "/" + sid;
You had the OCI format...tht's now the thin format :-)
Tim
hehehe...hope that's right or else I'm gonna look dumb ;-)
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#05_01
is where I found the 2 different connect string formats :-)
is where I found the 2 different connect string formats :-)
ASKER
hehe you sound really confident so i reckon you could be correct with that,
however im still getting those same damn errors so im guessing it must be my setup here rather than your improved conneciton script
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\query$js p.java:71: ';' expected.
Could not find the database driver
You kn how it says generated servlet error in d:\
I am running tomcat off of g:\ however.
Coud this be making any difference?
however im still getting those same damn errors so im guessing it must be my setup here rather than your improved conneciton script
Generated servlet error:
D:\Tomcat4\work\Standalone
Could not find the database driver
You kn how it says generated servlet error in d:\
I am running tomcat off of g:\ however.
Coud this be making any difference?
Is there a Tomcat install in D:?
That's a bit odd...
And it does sound like you have a ";" missing...
are you sure you don't have 2 tomcat installs?
That's a bit odd...
And it does sound like you have a ";" missing...
are you sure you don't have 2 tomcat installs?
ASKER
yes there is a tomcat install in d also,
the problem is the way this computer is setup. a tomcat install was originally on d and then i installed on g which is a drive i have full access to. i only have read access to d unfortunaetly.
i am running tomcat off g: though so i start it with the startup batch file from g:
Im guessing it should run from g: then, i can navigate to http://localhost:8080 and see the install page, and also /momentum which is a folder i have created on the tomcat install on g: with all my jsp files.
Im guessing this is causing conflict though? although the tomcat install on d is not running?
the problem is the way this computer is setup. a tomcat install was originally on d and then i installed on g which is a drive i have full access to. i only have read access to d unfortunaetly.
i am running tomcat off g: though so i start it with the startup batch file from g:
Im guessing it should run from g: then, i can navigate to http://localhost:8080 and see the install page, and also /momentum which is a folder i have created on the tomcat install on g: with all my jsp files.
Im guessing this is causing conflict though? although the tomcat install on d is not running?
>> although the tomcat install on d is not running?
Are you sure? ;-) Is it running as a service?
Ok, that sounds like catalina.home or something is going back to the D value :-/
Odd...
Can you post the entire JSP that's causing the error? Is it HUGE? Hmmm...
I take it that the lines:
Could not find the database driver
and
Could not connect to the database
are REALLY something like:
out.println( "Could not connect to the database" ) ;
yes?
Tim
Are you sure? ;-) Is it running as a service?
Ok, that sounds like catalina.home or something is going back to the D value :-/
Odd...
Can you post the entire JSP that's causing the error? Is it HUGE? Hmmm...
I take it that the lines:
Could not find the database driver
and
Could not connect to the database
are REALLY something like:
out.println( "Could not connect to the database" ) ;
yes?
Tim
ASKER
yea its not running :)
enitre jsp isnt big at all, i have a simple query.jsp which is:
<%@ include file="db.jsp"%>
<%
try {
// Create a result set containing all data from my_table
Statement stmt = connection.createStatement ();
ResultSet rs = stmt.executeQuery("SELECT * FROM Supervisor");
} catch (SQLException e) {
}
%>
and then the db.jsp as posted earlier:
<%
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.OracleDriver" ;
Class.forName(driverName);
// Create a connection to the database
String serverName = "ora.wit.ie";
String portNumber = "1521";
String sid = "MACH";
String url = "jdbc:oracle:thin:@//" + serverName + ":" + portNumber + "/" + sid;
String username = "W01606662";
String password = "EGPZAR";
connection = DriverManager.getConnectio n(url, username, password);
} catch (ClassNotFoundException e) {
out.println( "Could not find the database driver");
} catch (SQLException e) {
out.println( "Could not connect to the database");
}
%>
enitre jsp isnt big at all, i have a simple query.jsp which is:
<%@ include file="db.jsp"%>
<%
try {
// Create a result set containing all data from my_table
Statement stmt = connection.createStatement
ResultSet rs = stmt.executeQuery("SELECT * FROM Supervisor");
} catch (SQLException e) {
}
%>
and then the db.jsp as posted earlier:
<%
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.OracleDriver"
Class.forName(driverName);
// Create a connection to the database
String serverName = "ora.wit.ie";
String portNumber = "1521";
String sid = "MACH";
String url = "jdbc:oracle:thin:@//" + serverName + ":" + portNumber + "/" + sid;
String username = "W01606662";
String password = "EGPZAR";
connection = DriverManager.getConnectio
} catch (ClassNotFoundException e) {
out.println( "Could not find the database driver");
} catch (SQLException e) {
out.println( "Could not connect to the database");
}
%>
what happens if you just go to db.jsp?
does that work?
Oh, and I'd probably change your username/password on the database after this is solved :-/
And can you post the actual exception?
does that work?
Oh, and I'd probably change your username/password on the database after this is solved :-/
And can you post the actual exception?
ASKER
hehe yea i noticed that i posted those details! silly me! :)
db.jsp bring up exact same as query.jsp
exception:
org.apache.jasper.JasperEx ception: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\db$jsp.j ava:71: ';' expected.
Could not find the database driver
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\db$jsp.j ava:73: ';' expected.
Could not connect to the database
^
2 errors, 1 warning
at org.apache.jasper.compiler .Compiler. compile(Co mpiler.jav a:285)
at org.apache.jasper.servlet. JspServlet .loadJSP(J spServlet. java:548)
at org.apache.jasper.servlet. JspServlet $JspServle tWrapper.l oadIfNeces sary(JspSe rvlet.java :176)
at org.apache.jasper.servlet. JspServlet $JspServle tWrapper.s ervice(Jsp Servlet.ja va:188)
at org.apache.jasper.servlet. JspServlet .serviceJs pFile(JspS ervlet.jav a:381)
at org.apache.jasper.servlet. JspServlet .service(J spServlet. java:473)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at org.apache.catalina.core.A pplication FilterChai n.internal DoFilter(A pplication FilterChai n.java:247 )
at org.apache.catalina.core.A pplication FilterChai n.doFilter (Applicati onFilterCh ain.java:1 93)
at org.apache.catalina.core.S tandardWra pperValve. invoke(Sta ndardWrapp erValve.ja va:243)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.core.S tandardCon textValve. invoke(Sta ndardConte xtValve.ja va:190)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.valves .Certifica tesValve.i nvoke(Cert ificatesVa lve.java:2 46)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.core.S tandardCon text.invok e(Standard Context.ja va:2347)
at org.apache.catalina.core.S tandardHos tValve.inv oke(Standa rdHostValv e.java:180 )
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.valves .ErrorDisp atcherValv e.invoke(E rrorDispat cherValve. java:170)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.valves .ErrorRepo rtValve.in voke(Error ReportValv e.java:170 )
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.valves .AccessLog Valve.invo ke(AccessL ogValve.ja va:468)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.core.S tandardEng ineValve.i nvoke(Stan dardEngine Valve.java :174)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.connec tor.http.H ttpProcess or.process (HttpProce ssor.java: 1027)
at org.apache.catalina.connec tor.http.H ttpProcess or.run(Htt pProcessor .java:1125 )
at java.lang.Thread.run(Threa d.java:536 )
doesnt jsp give horrible errors :)
db.jsp bring up exact same as query.jsp
exception:
org.apache.jasper.JasperEx
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
Could not find the database driver
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
Could not connect to the database
^
2 errors, 1 warning
at org.apache.jasper.compiler
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at javax.servlet.http.HttpSer
at org.apache.catalina.core.A
at org.apache.catalina.core.A
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.connec
at org.apache.catalina.connec
at java.lang.Thread.run(Threa
doesnt jsp give horrible errors :)
right...
the db.jsp that it's executing doesn't have
out.println( "Could not find the database driver");
but just has
Could not find the database driver
like in the example you posted earlier...
That's what I reckon the problem is now...
>> doesnt jsp give horrible errors :)
Oh yes! At least this one's useful... there's the 1% of errors where it says "null"
Thanks Tomcat ;-)
hehehe
Tim
the db.jsp that it's executing doesn't have
out.println( "Could not find the database driver");
but just has
Could not find the database driver
like in the example you posted earlier...
That's what I reckon the problem is now...
>> doesnt jsp give horrible errors :)
Oh yes! At least this one's useful... there's the 1% of errors where it says "null"
Thanks Tomcat ;-)
hehehe
Tim
ASKER
hmm yea i changed the file to suit with your out.print included but it is still returning the same error.
your right though it is obviously looking for ; at the end of those 2 lines.
i have restarted tomcat for it to take effect but nothing. db.jsp has definatly been changed though to what you suggested.
its just a case of saving these files as .jsp yes?
unlike .java then dont need compiling or anything?
your right though it is obviously looking for ; at the end of those 2 lines.
i have restarted tomcat for it to take effect but nothing. db.jsp has definatly been changed though to what you suggested.
its just a case of saving these files as .jsp yes?
unlike .java then dont need compiling or anything?
yeah..that should work (tomcat should pick up the changes and recompile them)
Are you sure you only have one "db.jsp" file? You could be changing one, and tomcat could be using the other...
Happened to me a few times...and it really makes your brain itch ;-)
Are you sure you only have one "db.jsp" file? You could be changing one, and tomcat could be using the other...
Happened to me a few times...and it really makes your brain itch ;-)
If you're sure, then try stopping tomcat, and removing anything inside Tomcat/work
then restart...that should kick tomcat into action ;-)
then restart...that should kick tomcat into action ;-)
ASKER
ah Tim, i was editing another db file which wasnt in momenutm, something simple eh?
i'm not getting:
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\query$js p.java:56: Class org.apache.jsp.Connection not found.
Connection connection = null;
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\query$js p.java:69: Undefined variable or class name: DriverManager
connection = DriverManager.getConnectio n(url, username, password);
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone \localhost \_\momentu m\query$js p.java:72: Class org.apache.jsp.SQLExceptio n not found.
} catch (SQLException e) {
^
I'm puzzled :/
i'm not getting:
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
Connection connection = null;
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
connection = DriverManager.getConnectio
^
An error occurred between lines: 1 and 23 in the jsp file: /momentum/db.jsp
Generated servlet error:
D:\Tomcat4\work\Standalone
} catch (SQLException e) {
^
I'm puzzled :/
Right, you need to import java.sql.* into both your JSPs :-)
Put:
<%@ page import="java.sql.*" %>
at the top of both your JSPs :-)
Put:
<%@ page import="java.sql.*" %>
at the top of both your JSPs :-)
ASKER
this is what i get now:
java.lang.NullPointerExcep tion
at org.apache.jsp.query$jsp._ jspService (query$jsp .java:100)
at org.apache.jasper.runtime. HttpJspBas e.service( HttpJspBas e.java:107 )
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at org.apache.jasper.servlet. JspServlet $JspServle tWrapper.s ervice(Jsp Servlet.ja va:201)
at org.apache.jasper.servlet. JspServlet .serviceJs pFile(JspS ervlet.jav a:381)
at org.apache.jasper.servlet. JspServlet .service(J spServlet. java:473)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at org.apache.catalina.core.A pplication FilterChai n.internal DoFilter(A pplication FilterChai n.java:247 )
at org.apache.catalina.core.A pplication FilterChai n.doFilter (Applicati onFilterCh ain.java:1 93)
at org.apache.catalina.core.S tandardWra pperValve. invoke(Sta ndardWrapp erValve.ja va:243)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.core.S tandardCon textValve. invoke(Sta ndardConte xtValve.ja va:190)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.valves .Certifica tesValve.i nvoke(Cert ificatesVa lve.java:2 46)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.core.S tandardCon text.invok e(Standard Context.ja va:2347)
at org.apache.catalina.core.S tandardHos tValve.inv oke(Standa rdHostValv e.java:180 )
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.valves .ErrorDisp atcherValv e.invoke(E rrorDispat cherValve. java:170)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.valves .ErrorRepo rtValve.in voke(Error ReportValv e.java:170 )
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.valves .AccessLog Valve.invo ke(AccessL ogValve.ja va:468)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 64)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.core.S tandardEng ineValve.i nvoke(Stan dardEngine Valve.java :174)
at org.apache.catalina.core.S tandardPip eline.invo keNext(Sta ndardPipel ine.java:5 66)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:472)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 43)
at org.apache.catalina.connec tor.http.H ttpProcess or.process (HttpProce ssor.java: 1027)
at org.apache.catalina.connec tor.http.H ttpProcess or.run(Htt pProcessor .java:1125 )
at java.lang.Thread.run(Threa d.java:536 )
hehe bit of a long error there, at least you got rid of any errors in my code :)
java.lang.NullPointerExcep
at org.apache.jsp.query$jsp._
at org.apache.jasper.runtime.
at javax.servlet.http.HttpSer
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at javax.servlet.http.HttpSer
at org.apache.catalina.core.A
at org.apache.catalina.core.A
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.connec
at org.apache.catalina.connec
at java.lang.Thread.run(Threa
hehe bit of a long error there, at least you got rid of any errors in my code :)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> at least you got rid of any errors in my code :)
I think we're just back to it failing to get a connection again ;-)
hehehe... 3 steps forward, and errr... 3 back to the start ;-)
Try that change, and see what it says...at least we will then have working code (even if it still fails)
Tim
I think we're just back to it failing to get a connection again ;-)
hehehe... 3 steps forward, and errr... 3 back to the start ;-)
Try that change, and see what it says...at least we will then have working code (even if it still fails)
Tim
ASKER
hehe yea i see what ya mean, you had to change it to show what error it might be, good thinking
yes it came up with: Could not connect to the database Giving up...connection is null
Something wrong with the actualy connection to my database so is there?
yes it came up with: Could not connect to the database Giving up...connection is null
Something wrong with the actualy connection to my database so is there?
Try changing:
} catch (ClassNotFoundException e) {
out.println( "Could not find the database driver");
} catch (SQLException e) {
out.println( "Could not connect to the database");
}
to:
} catch (ClassNotFoundException e) {
out.println( "Could not find the database driver: " + e.getMessage() );
} catch (SQLException e) {
out.println( "Could not connect to the database: " + e.getMessage() );
}
and see if that give a bit more info :-)
} catch (ClassNotFoundException e) {
out.println( "Could not find the database driver");
} catch (SQLException e) {
out.println( "Could not connect to the database");
}
to:
} catch (ClassNotFoundException e) {
out.println( "Could not find the database driver: " + e.getMessage() );
} catch (SQLException e) {
out.println( "Could not connect to the database: " + e.getMessage() );
}
and see if that give a bit more info :-)
ASKER
hey Tim i finally got it all working!!! :)
i decide to change the query file and put db.jsp in it itself without the use of include.
Also i tried a different conneciton string String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
it connects to the database ok and i did:
while( rs.next() )
{
out.println( rs.getString( 1 ) + "<BR>" );
}
to print out the values form the query!
Without all you help i wouldnt be able to do it, your a hero!
i decide to change the query file and put db.jsp in it itself without the use of include.
Also i tried a different conneciton string String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
it connects to the database ok and i did:
while( rs.next() )
{
out.println( rs.getString( 1 ) + "<BR>" );
}
to print out the values form the query!
Without all you help i wouldnt be able to do it, your a hero!
>> hey Tim i finally got it all working!!! :)
Yay!!!
>> String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
Ahhhh...so I was wrong, your original connect string was right :-) hehehe... My *bounce* was premature ;-)
>> Without all you help i wouldnt be able to do it, your a hero!
Hehe, no worries! I'm glad we got it sorted out :-)
It's great when it all works ;-)
Good luck with it all!
Tim
Yay!!!
>> String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
Ahhhh...so I was wrong, your original connect string was right :-) hehehe... My *bounce* was premature ;-)
>> Without all you help i wouldnt be able to do it, your a hero!
Hehe, no worries! I'm glad we got it sorted out :-)
It's great when it all works ;-)
Good luck with it all!
Tim