jsp怎么访问Access数据库呢?

sjhasp 2002-04-03 01:07:14
jsp怎么访问Access数据库呢?
...全文
80 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
rootwuyu 2002-04-15
  • 打赏
  • 举报
回复
import java.sql.*;

public class test{
public static void main(String[] args){
//Authors
try{
String dbname="/TEMP/BIBLIO.MDB";
String dbinfo = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="+dbname;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(dbinfo);
Statement stmt = conn.createStatement();
ResultSet RS = stmt.executeQuery("SELECT * FROM Authors");
while(RS.next()){
System.out.println(RS.getString(2));
}
RS.close();
RS=null;
stmt.close();
stmt=null;
conn.close();
conn=null;
}
catch(java.lang.Exception e){
System.err.println(e);
}
}
}
lczddd 2002-04-03
  • 打赏
  • 举报
回复
jsp怎么访问Access数据库?为什么这么搭配?大骡子拉小车
可乐加水 2002-04-03
  • 打赏
  • 举报
回复
用jdbc-odbc桥,说白了就是,使用的数据库驱动程序变一下,其它的方式方法都一样
rootwuyu 2002-04-03
  • 打赏
  • 举报
回复
用JDBC-ODBC

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧