程序如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
String dbpath = application.getRealPath("/test.mdb");
out.println(dbpath);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=" + dbpath);
out.println("conn successful");
conn.close();
} catch(Exception e) {
out.println(e.toString());
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
</body>
</html>问题出错:
/www/users/zenggui.com.cn/database/test.mdb java.lang.NullPointerException 我数据库就话在database目录下的,可是老找不到数据库,这是为什么
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
String dbpath = application.getRealPath("/test.mdb");
out.println(dbpath);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=" + dbpath);
out.println("conn successful");
conn.close();
} catch(Exception e) {
out.println(e.toString());
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
</body>
</html>问题出错:
/www/users/zenggui.com.cn/database/test.mdb java.lang.NullPointerException 我数据库就话在database目录下的,可是老找不到数据库,这是为什么
解决方案 »
- java web 获取客户端的计算机名称
- 急org.apache.jasper.JasperException:ext-all.js #{...}js not allowed in template
- autocomplete.js
- 如何在同一个jsp页面里,点击左侧的链接控制右侧的ifram
- 在同一个页面里如何对两个表同时进行添加操作,我用的ACCESS数据库!
- 解决了,马上给...关于数组的问题...(恼我3天的问题啊!)
- TOMCAT内部错误
- 在VB中怎样调用JAVA Bean(给分100)
- 我结分很快,问题解决立刻给分,简单的问题,好机会啊……
- 请问哪位高手知道javascript验证日期型字段的语法?
- 如何用Java实现对Excel文件工作表设置“只读”保护密码,以防用户修改Excel模板文件!100分。
- 如何替换properties文件中的冒号啊?
/www/users/zenggui.com.cn/database/test.mdb
证明路径不是问题
就可以了记得给分