新手上路 急用,为什么会报这个错啊
我写的一个连接acssess数据库的代码,import java.sql.*;
public class HH {
/**
* @param args
* @throws ClassNotFoundException
* @throws SQLException
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:driver ={Microsoft Access Driver (*.mdb)};DBQ=D:\\gong\\LiteratureData.mdb";
Connection con = DriverManager.getConnection(url, "", "");
Statement stmt = con.createStatement();
}
}
它报错是
Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at HH.main(HH.java:12)
这个,该怎么搞啊
求助各位大侠