wood burning stoves 2.0*
The moose likes JSP and the fly likes retrieving records from the database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "retrieving records from the database " Watch "retrieving records from the database " New topic
Author

retrieving records from the database

Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641

after a long Gap i've again started working on jsp . Facing a prob which might be petty but i can't figure out why the above code fails to compile.
I,am using tomcat 3.2.4 . I have included the lib directory of tomcat inside my classpath but still i get the following error :
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fexamples\_0002fjsp_0002ftest_00031_0002ejsptest1_jsp_1.java:66: Identifier expected.
class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
Kindle help me out guys .
Thanks in advance


Raghav.
Gul Khan
Ranch Hand

Joined: Sep 03, 2003
Posts: 173
i think the "C" in class.forname is capital.
try Class.----

God bless you too
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Thanks !
That was a prob bu there is another prob which is :
Statement smt = mycon.createStatement();
The following line of code gives the following error :
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fexamples\_0002fjsp_0002ftest_00031_0002ejsptest1_jsp_1.java:70: ';' expected.
Statement smt = mycon.createstatement();

I just hope i am not doing something silly. Need ur help again.
Thanks in advance
Gul Khan
Ranch Hand

Joined: Sep 03, 2003
Posts: 173
you forgot to put semicolon in the line above the specified line, which is wat the error means.
mycon = DriverManager.getConnection("jdbc dbc b1","",""); //overhere
Statement smt = mycon.createStatement();
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
I did that but now i get an error :
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fexamples\_0002fjsp_0002ftest_00031_0002ejsptest1_jsp_1.java:70: Ambiguous class: java.beans.Statement and java.sql.Statement
Statement smt = mycon.createStatement();

Thanks in advance
Gul Khan
Ranch Hand

Joined: Sep 03, 2003
Posts: 173
may be u have imported two packages having same classes inside i.e. Statement
rather when defining ambiguous classes use complete path. like
java.sql.Statement stmt;
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641

This is what my code looks like now .
Afetr everything suggested by you i am eventually getting a servlet exception saying :
javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I have made the System dsn for access database .
Thanks in advance
Gul Khan
Ranch Hand

Joined: Sep 03, 2003
Posts: 173
are u using the same dsn name in the DriverManager parameters?
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
My dsn name is dsntest .
Now where would i be specifying it ?
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Oh my god .
this is what i was doing
mycon = DriverManager.getConnection("jdbc dbc b1","","");// connection string
I was specifying the database instead of the dsn
Now the code works fine ...
Thanks a ton for your help.
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
I would like to deviate from the main topic and would like to ask you one more thing which has to with the connectivity issue .
What is the internal processing od a JSP page . Why does it alsways take time to load whenever i refresh the page ?
Thanks in advance
Gul Khan
Ranch Hand

Joined: Sep 03, 2003
Posts: 173
JSP is compiled into a servlet if u have made changes to it the last time you loaded the page. and its executed at the server, the client is delivered with html content.
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Thats fine . I understand that !
Is there a specific reason for a jsp page to load slower than an ASP page for that matter .i just workied on a project where i implemented ASP and now when i am working on jsp , i can definately feel the diff in the performance .
 
Don't get me started about those stupid light bulbs.
 
subject: retrieving records from the database