Couple of things :
a) Provide the complete source code for the jsp.
b) Apparently nothing seems to be wrong with your java bean code.
Have a nice day.
With regards,
Sachin S. Khanna
http://www.emailanorder.com
----- Original Message -----
From: Jonas Devries <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 18, 2001 1:04 PM


> Does somebody knows why this code doesn't work?  I want to acces a MS =
> Access DB and give a simple query.  I give the ResultSet back to my JSP =
> file but he gives some errors.  JSP and Java-bean are included.  Errors =
> also.  There is data in the db and the odbc-jdbc driver is installed.
>
> Thank you very much in advance
>
> Jonas
>
>
> import java.sql.*;
> import java.util.*;
>
> public class databank {
>
> private String driver =3D "sun.jdbc.odbc.Jdbc.OdbcDriver";
> private String url =3D "jdbc:odbc:db1";
> private Connection connection;
> private Statement statement;
> private ResultSet res;
> private ResultSetMetaData meta;
> private String naam;
> private int aantal;
>
> public databank(){}
> =20
> =20
> public ResultSet lijst(){
>
>   try {
>    String query =3D "select * from klant";
>    Class.forName(driver);
>    connection =3D DriverManager.getConnection(url);        =20
>    statement =3D connection.createStatement();
>    res =3D statement.executeQuery(query);    =20
>     =20
>   }
>   catch (SQLException e){}
>   catch (ClassNotFoundException cnfex){}=20
>
>   return res;
>
> }
>
> }
>
>
>
>
> ResultSetMetaData meta =3D res.getMetaData(); int aantal =3D
> meta.getColumnCount(); %> while (res.next()){ for (kol =3D 1; kol <=3D
> aantal; kol++) %>
>
>
>
>
>
> Error: 500
> Location: /test9.jsp
> Internal Servlet Error:
>
> javax.servlet.ServletException
>         at =
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContext=
> Impl.java:386)
>         at =
> _0002ftest_00039_0002ejsptest9_jsp_0._jspService(_0002ftest_00039_0002ejs=
> ptest9_jsp_0.java:126)
>         at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at =
> org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet=
> .java:174)
>         at =
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>         at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at =
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:5=
> 03)
>         at =
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>         at =
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnect=
> ion(Ajp12ConnectionHandler.java:156)
>         at =
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:=
> 338)
>         at java.lang.Thread.run(Thread.java:484)
>
> Root cause:=20
> java.lang.NullPointerException
>         at =
> _0002ftest_00039_0002ejsptest9_jsp_0._jspService(_0002ftest_00039_0002ejs=
> ptest9_jsp_0.java:93)
>         at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at =
> org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet=
> .java:174)
>         at =
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>         at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at =
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:5=
> 03)
>         at =
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>         at =
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnect=
> ion(Ajp12ConnectionHandler.java:156)
>         at =
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:=
> 338)
>         at java.lang.Thread.run(Thread.java:484)
>
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to