?
Solved

Getting data from an MS Access Database

Posted on 2002-05-28
4
Medium Priority
?
303 Views
Last Modified: 2010-04-01
Hi All,
Below is my psuedo code JSP page. What do I need to adjust in order to connect to an MS Access MDB file with or without a DSN reference, open the database, search and retrieve a string from the datbase.

TIA,
DoughBoy


//what other packages should I import
<%@ page import="java.sql.*" %>

<%
String sDefinition = "";
String sLabelString = "";

sLabelString = request.getParameter("currlabel"));

//what driver do I need????????????
Class.forName("some.class.odbc.ms.access.Driver");
         
// what Parameters do I need????????????? for an
// MS Access database with or with a DSN reference.
Connection conn = DriverManager.getConnection("odbc:dsn://mymdbfile", "someuser-not-needed", "somepwd-not-needed");
             
PreparedStatement stmt1 = conn.prepareStatement("select resultstring from mytable where column1data =" + string1 + " and column2data = " + sLabelString);

ResultSet rs = stmt1.executeQuery();

while (rs.next())
{
sDefinition = rs.getString(1);
}
rs.close();
conn.close();
%>

<html>
<head>
<title>ODBC Result String</title>
</head>
<body>

<p> <% =sDefinition %> </p>

</body>
</html>
0
Comment
Question by:DoughBoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 7040939
I think you need to use DSN to connect to M$ Access database..
0
 
LVL 6

Accepted Solution

by:
kotan earned 400 total points
ID: 7040950
0
 

Author Comment

by:DoughBoy
ID: 7042604
thanks very much
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New style of hardware planning for Microsoft Exchange server.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question