Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Database connectivity problem


Message #1 by "Pallavi Mahajan" <paluindian@r...> on Sun, 8 Apr 2001 20:10:10
Hi All,
Hey I've just started JSP and have problems in Database connectivity 
problem.
I'mtrying to connect to MS Acees Database Norhtwind.mdb and wanna access 
Employee and rest of the table. I have created DSN named NorthWindODBC 
forthat. My code goes like this...

<html>
<body>
<%@ page language="java" import="java.util.*"%>
<%@ page import="java.awt.*"%>
<%@ page import="java.sql.*"%>

<%
try{
%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection
("jdbc:odbc:NorthWindODBC","admin","admin");
Statement stmt=con.createStatement();
ResultSet rs= stmt.executeQuery("Select * from Employees");

while(rs.next()) {%>
<%
	String result=rs.getString("LastName");
	String result1=rs.getString("FirstName");
	%>
	
	<%=result%><BR>
	<%=result1%><BR>
	<%
}
rs.close();

}//end the try

catch(Exception e){
System.out.println(e);
}//end the catch
%>

</body>
</html>



Can anbody tell me where I'm wrong. I get error like " JDBC:ODBC driver 
not found and default is not specified" dont know how to proceed. Please 
help me out.
Please check the code also and tellme how to find the registry of DSN on 
ur system.
bye
Pallavi


  Return to Index