File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Error while connecting to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

Error while connecting to database

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
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
duplicate of
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

Please do not cross-post the same question in multiple forums.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Error while connecting to database
It's not a secret anymore!