File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

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

Joined: Aug 15, 2004
Posts: 2874
duplicate of http://www.coderanch.com/t/301770/JDBC/java/JDBC-connection-MS-Access
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while connecting to database
 
Similar Threads
how to import a page in other page
insertion into the database
page information
JDBC connection to MS Access
how to use variable of included page of jsp