473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help JSP connecting to Access

Hi,

I'm trying to connect to an Access database using tomcat. I'm new to
JSP so I'm not sure whether I'm doing the right thing. I'm saving the
code below as "AccessConnect.jsp" under
"jakarta-tomcat-4.0\webapps\jsptests\". Under the folder jsptests is
an empty subfolder called "WEB-INF". Under this folder are two empty
folders calles "lib" & "classes".

I then open I.E. and type the url
ttp://localhost:8080/jsptest/AccessConnect.jsp
I'm getting page not found. Can someone tell me what am I doing wrong.
Am I supposed to compile something or Tomcat is supposed to do that
automatically? Thanks.

I also have the following variables setup on Windows 2000 NT:
CATALINA_HOME c:\jakarta-tomcat-4.0
CLASSPATH c:\jakarta-tomcat-4.0\common\lib\servlet.jar;.
JAVA_HOME c:\j2sdk1.4.1_01
PATH %SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SY STEM32\W
BEM;C:\DMI\WIN32\BIN;C:\Documents and
Settings\ahlcu\jswdp-1_0\bin;C:\j2sdk1.4.1_01\bin

Here's the code:

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>

<html>
<body>
<%

//instantiate variables
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String queryString;
queryString = "select COF_NAME, PRICE from COFFEES";

try
{
//Load the JDBC driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();

//Get the connection getConnection("access driver", "userID",
"password")
con = DriverManager.getConnection("jdbc:odbc:AccessPaul" ,"myUserID","myPassword");

stmt = con.createStatement();

//sql statements: create, update, query
rs = stmt.executeQuery(queryString);

while (rs.next()) {
String result = rs.getString("name");
%>

<%= result %> </br>

<%
}
rs.close();
}catch (Exception e) {
System.out.println(e);
}
%>

</body>
</html>
Jul 20 '05 #1
1 3332
"Paul" <pc*******@yahoo.com> wrote:
I'm trying to connect to an Access database using tomcat.


Answered in comp.lang.java.programmer

--
Wendy
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Daven Thrice | last post by:
Hi, I've converted the tables from an old Access application to MySql format. I then linked the tables into access using MyODBC and everything works great (on my computer). For now, I want to...
4
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
16
by: peshekeedweller | last post by:
Using asp.net 1.1. vb.net 2003. I am trying to connect to a remote sql server 2000 on a virtual machine running windows 2000 server. I can connect through the server explorer in visual studio,...
5
by: bill | last post by:
I am having difficulties connecting to a remote Sql server database in VB.net. Lets say my remote server is found at 255.255.255.255 and its name is MyServer. The database is called MyDatabase....
35
by: robert d via AccessMonster.com | last post by:
I was asked to provide a proposal. I provided a proposal on my application and the prospective client likes what I have but is wary of it having been developed in Access. I don't understand this...
1
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
4
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
3
by: BigZero | last post by:
hello i m new to php i m working on project that has interface with simple html and php i m thinking to use i got some problem with the connecting to DB here is the code for connecting db ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.