• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

retrieving records from the database

 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Gul Khan
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think the "C" in class.forname is capital.
try Class.----

God bless you too
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are u using the same dsn name in the DriverManager parameters?
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My dsn name is dsntest .
Now where would i be specifying it ?
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic