problem in - JDBC Connection for MS-Access in JSP

Hi,

I am using Three tier Architecture. that is MS-Access as a Database, JAva Web Server as a server and HTML as a frontend.

I always getting error during the execution of JSP code.

Coding in JSP:

<%@ page import="java.sql.*"%>

<%

java.sql.Connection con;

java.sql.PreparedStatement pstmt;

java.sql.ResultSet rst;

String sDBQ= application.getRealPath("dem.mdb");

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con=DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ="+sDBQ);

pstmt = con.prepareStatement("select * from employee");

rst = pstmt.executeQuery();

if (rst.next())

{

String s1=rst.getString("EmployeeId");

String s2=rst.getString("EmployeeName");

out.println(s1);

out.println(s2);

}

}

catch(Exception e)

{

out.println("Error "+e);

}

%>

I'm getting this error

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too long

Please anyone rectify it

[1121 byte] By [sugandevisa] at [2007-11-27 9:44:36]
# 1
Hello...I have tried your example on my system, but its works fine by showing first record from Database. Check that you have place database in appropriate path.( I havent created any DSN... )// Anupam Pawar
PremInda at 2007-7-12 23:51:44 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
hi anupam,thanx for checking..I placed database in appropriate path but i didn't get..i'm using windows 2000 , is there any problem?suganya
sugandevisa at 2007-7-12 23:51:44 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
> I am using Three tier Architecture. Not really. I don't use MS Access, so I don't know if any of the code is even valid, but I'd take all that database connection code out of the JSP and move it into a java class. Get it out of the view.
nantucketa at 2007-7-12 23:51:44 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...