nquadr 0 Newbie Poster

Hi I am new to .jsp programming. I wanted to create a simple web page to display some information from an access database, but unfortunately I keep getting an error that no data is found. I created a DSN source through the ODBC tool in Windows, and I feel I am doing everything correctly, but it is not working. Any help would be greatly appreciated. I am enclosing the code and errors I am receiving.

Am I supposed to download a separate ODBC driver? I just downloaded the ojdbc14 driver to place in my tomcat lib directory. Once again, any help would be greatly appreciated.

<%@page import="sun.jdbc.odbc.JdbcOdbcDriver"%>
<%@page import="java.sql.*" %>
<%@page import="java.io.*" %>
<%@page import="java.lang.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
<head> 
<body>

<center><H1>Use this page to look up Contract ID's</H1></center>

		<Form Action="">
		<table>
		<tbody>
		<tr>
		<td>
		<select name="ContractNum">
		<option Value=""> Select Contract Number </option>
			<%
				//1.) Load the driver
				String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
				String url = "jdbc:odbc:Belmont";
				//String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.accdb)};DBQ=Belmont.accdb";
				Class.forName(driver).newInstance();
				System.out.println("line 25 ok, driver ok");
				
				//2.) Establish the connection
				Connection conn = DriverManager.getConnection(url,"","");		
				System.out.println("line 29 ok, connection ok");
				
				
				//3.) Create a statement
				Statement stmnt = conn.createStatement();
				
				//4.) Create a query
				String query = "Select ContractNum From Contract";
				System.out.println("line 37 ok, query ok");
				
				//5.) Execute a query
				ResultSet rs = stmnt.executeQuery(query);
				System.out.println("line 41 ok, executed query ok");
				
				try{
				//6.) Process the results
				while (rs.next())
				{
					out.println("<option value=" + "'" + rs.getString(1) + "'>" + rs.getString(1) + "</option>");
				}
				}
				catch (java.sql.SQLException exp){
				System.err.println(exp);
				exp.printStackTrace();
				}
				//7.) Close the connection
				try {
				conn.close();
				}catch (Exception ignored){}
			%>
		
		
		</select>
		</td>
		</tr>
		</tbody>
		</table>
		
		</Form>


</body>
</html>

Errors I am receiving:

Jul 10, 2011 12:22:53 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;I:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;I:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Java\jdk1.6.0_25\bin;.
Jul 10, 2011 12:22:53 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Belmont' did not find a matching property.
Jul 10, 2011 12:22:53 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SairaWebPage' did not find a matching property.
Jul 10, 2011 12:22:53 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jul 10, 2011 12:22:53 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jul 10, 2011 12:22:53 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 471 ms
Jul 10, 2011 12:22:53 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 10, 2011 12:22:53 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.16
Jul 10, 2011 12:22:54 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 10, 2011 12:22:54 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 10, 2011 12:22:54 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 703 ms
line 25 ok, driver ok
line 29 ok, connection ok
line 37 ok, query ok
line 41 ok, executed query ok
java.sql.SQLException: No data found
java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at org.apache.jsp.ContractId_jsp._jspService(ContractId_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:140)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)