try,
con = DriverManager.getConnection("jdbc:odbc:Movie","","");
works for me with a System DSN.
-----Original Message-----
From: Suket N Gandhi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 03, 1999 9:03 AM
To: [EMAIL PROTECTED]
Subject: Problem Retrieving Data from the ACCESS Database from Servlets
u sing JdbcOdbc Bridge
Importance: High
Hi,
We are trying to access data from ACCESS Database through Servlets.
The code we have used is as follows :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class tryAccessServlet extends javax.servlet.http.HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
PrintWriter out = res.getWriter();
res.setContentType("text/html");
Connection con = null;
ResultSet rs = null;
try
{
out.println("1");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
out.println("2");
// Get a connection to the database
con = DriverManager.getConnection("jdbc:odbc:@10.11.3.29:Movie","","");
/*Movie is the name of the DSN and the IP Address of the ACCESS Server is
10.11.3.29. */
out.println("3");
Statement stmt = con.createStatement();
out.println("4");
rs = stmt.executeQuery("SELECT * FROM CUSTOMERS");
out.println("5");
while(rs.next())
{
out.println("Customer Id : " + rs.getString(0));
}
out.println("2");
}
catch(ClassNotFoundException e)
{
out.println("Class Not Found");
}
catch(SQLException e)
{
out.println("An error occurred while accessing the database : " +
e.getMessage());
}
catch(Exception e)
{
out.println("An error occurred while : " + e.getMessage());
}
}
}
An exception is occurring in the statement :
con = DriverManager.getConnection("jdbc:odbc:@10.11.3.29:Movie","","");
Any idea as to why this is happening ?
Thank you for your patience.
Thanks and Regards
Suket
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html