aspose file tools*
The moose likes JDBC 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC connection to MS Access" Watch "JDBC connection to MS Access" New topic
Author

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 -->
<html>
<head><title>JAI SHRI RAM</title></head>

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

String url = "jdbc dbc:lala" ;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection(url,"","");
st = conn.createStatement();
rs = st.executeQuery("select * from ram1");
while(rs.next() )
{
System.err.println( rs.getString("name") );
System.out.println(rs.getString("password"));

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");
%>
</body></html>

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

Joined: Mar 06, 2002
Posts: 220
Gaurav
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.

Raj
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC connection to MS Access
 
Similar Threads
insertion into the database
Error while connecting to database
error in connectivity with database
error in connectivity with database
how to use variable of included page of jsp