File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes a easy question   please help !!! 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 » Databases » JDBC
Bookmark "a easy question   please help !!!" Watch "a easy question   please help !!!" New topic
Author

a easy question please help !!!

David Liu
Greenhorn

Joined: Apr 16, 2002
Posts: 24
how can I access microsoft access2000 in jsp
this is my code
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%
java.sql.Connection sqlConn;
java.sql.Statement sqlStmt;
java.sql.ResultSet sqlRst;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
sqlConn=java.sql.DriverManager.getConnection("jdbc.odbc.people");
sqlStmt=sqlConn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
sqlRst=sqlStmt.executeQuery("select name,age from people");
%>
<html>
<head>
<title>JDBC ACCESS 测试<title>
</head>
<body>
<table border="1" cellspacing="0" align="center">
<tr>
<th>姓名<th>
<th>年龄</th>
</tr>
<%while(sqlRst.next()){%>
<tr>
<td><%=sqlRst.getString(1)%></td>
<td><%=sqlRst.getLong(2)%></td>
</tr>
<%}%>
</table>
</body>
</html>
<%
sqlRst.close();
sqlStmt.close();
sqlConn.close();
%>

but tomcat says "no suitable driver"


It's better burn out than to fade away.
Janet Wilson
Ranch Hand

Joined: Jul 16, 2002
Posts: 98
David,
I'm sure you figured out an answer to your question and I'm not even certain this will help you out since it's Java and not JSP, but figured I would share some beginner code I have been creating for a training plan which might give you some pointers? The following code does successfully attach to an Access 2000 DB from within JDK 1.4.1 using a User DSN:

Remember, it's meant as a training tool! Hope this helps!
Janet
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: a easy question please help !!!
 
Similar Threads
how to find which data the user clicked
best option for implementing form
HTML Table Column Widths
How to save values in a database in JSTL?
how to display output in the same page of imput