• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hello guys here is an interesting problem?

 
krishna bommu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys,
I am using java web server & i do coding the jsp pages.
I have a System DSN in my system named icportal
for making a connection to database i use:
<%
Class.forname("sun:jdbc dbc:JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc dbc:icportal");
Statement stmt=con.createStatement();
Resultset rs=con.executeQuery(myquery);
%>

then here i do coding for displaying the retrieved records

but i could n't see any results in o/p.There is 500 SERVER INTERNAL ERROR.
can anyone suggest me a good soln??
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tip for you and everyone else: if you're using Internet Explorer, go to Tools, Internet Options, Advanced, and untick "Show friendly HTTP error messages". That box really means "Don't bother me with any details if there's an error, I'm and end user and don't care". But you're a JSP developer and do care.
Another tip: if you're developing JSPs in earnest, use Netscape (or Opera). IE will be able to display the most broken HTML. That's nice if you're a user -- there's plenty of incompetent HTML on the web -- but a Bad Thing if you're a developer.
I should add that neither Netscape nor Opera can replace a good HTML validator, but validating a JSP can be a pain.
- Peter
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any serious web developer should make sure that they test their web applications regularly (at least every day) on at least IE 4, IE 5, Netscape 4, Netscape 6, Opera, and Lynx. If it doesn't work with all of those, you are heading for big maintenance problems later.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, you probably should use a Servlet for your data access code and then include a JSP to display the response. This allows the compiler to pick up many potential problems in the servlet before you try to run it. Also, the JSP is then much simpler since it contains minimal code.
Anyway, for your problem, A 500 error means that your JSP is broken, which normally occurs because of a compilation problem. Look at the console or log file of your servlet engine to see what the error is. Some servlet engines, like WebLogic, will display a useful message in the browser rather than a 500 error response.
Your code should look more like this:



[This message has been edited by Terry Mueller (edited March 06, 2001).]
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just see the files of compiled Jsp's i.e., server created Servlets for any clue.It is not recommended to do all database related functions in Jsp's either u can use bean's or servlets for this.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should call executeQuery on the Statement instead of Connection as I see in your code.
Originally posted by krishna bommu:
Hello guys,
I am using java web server & i do coding the jsp pages.
I have a System DSN in my system named icportal
for making a connection to database i use:
<%
Class.forname("sun:jdbc dbc:JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc dbc:icportal");
Statement stmt=con.createStatement();
Resultset rs=con.executeQuery(myquery);
%>

then here i do coding for displaying the retrieved records

but i could n't see any results in o/p.There is 500 SERVER INTERNAL ERROR.
can anyone suggest me a good soln??

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic