请问JSP如何通过JDBC与ACCESS连接
解决方案 »
- 求高手帮忙,文件上传问题~~
- 关于表单提交时 输入数据中若含有"’"(单引号),表单提交出错问题
- http://localhost:8080/myapp/index.jsp出错了
- eclipse 不能启动了?
- 编辑文章时用到的标签
- 如何在JSP中调用带有从表的jasper?
- 请问我把连接数据库的javabean设为session,在session结束后这个数据库连接会自动关闭吗?
- 就象csdn网站左边的“树型导航兰”是怎么作的阿,指点一下
- 在JSP页面,如何输一些数据,然后按一个按钮将数据插入到数据库,感激!
- myeclipse运行程序,浏览器出现的地址localhost位置是一些乱东西!
- 有JSP中怎么获取表单的内容
- javascript变量相加问题
http://www.java3z.com/cwbwebhome/article/article5a/5130.jsp?id=242
public static void main(String args[]) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:Access2000"; //Access2000是ODBC数据源
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql="SELECT * FROM table1";
ResultSet rs = statement.executeQuery(sql);
String tt;
while (rs.next()) {
System.out.print("姓名:" + rs.getString("Name"));
System.out.println(" 年龄:" + rs.getString("Age"));
}
rs.close();
connection.close();
}
catch(Exception ex){
System.out.println(ex);
System.exit(0);
}
}