| 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: jrebel
|
|
subject: JDBC connection to MS Access
|
|
|