File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC connection to MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC connection to MS Access" Watch "JDBC connection to MS Access" New topic

JDBC connection to MS Access

gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
sir i want to connect jsp with MS-Access
the code is--------

<!-- jai shri ram -->
<head><title>JAI SHRI RAM</title></head>

<%@ page import="java.sql.*" %>
String user1 = null;
String pass1 = null;
ResultSet rs = null;
Statement st = null;
Connection conn = null;

String url = "jdbc dbc:lala" ;
conn = DriverManager.getConnection(url,"","");
st = conn.createStatement();
rs = st.executeQuery("select * from ram1");
while( )
System.err.println( rs.getString("name") );

user1 = rs.getString("name");
pass1 = rs.getString("name");
out.println(user1+" "+pass1);
catch(Exception e)
out.println("there is an error");
out.println("jai shri ram");

but it is giving an error as it is going into catch block.......
please help me is veru necessary
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
The catch statements you used doesnt help you conclude anything what the error is about. provide some meaning ful catch statements and if possible print the stack to find what the actual error is.
As of the connection to access,
did u created the DSN named 'lala' in the ODBC32 of windows? if not ,do check it and create either a System or File dsn named 'lala' and then test the application.

I agree. Here's the link:
subject: JDBC connection to MS Access
jQuery in Action, 3rd edition