Java创建数据库,找不到sun.jdbc.odbc.JdbcOdbcDriver驱动器

用Java编写程序,程序如下:importjava.sql.*;publicclassCreateTableBank{publicstaticvoidmain(Strin... 用Java编写程序,程序如下:
import java.sql.*;
public class CreateTableBank
{
public static void main(String[] args)
{
//String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb,*accdb)};DBQ=D:/javapro/Access/Bank.accdb";
String JDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectDB = "jdbc:odbc:Bank";
try
{
Class.forName(JDriver);
}
catch (java.lang.ClassNotFoundException e)
{
System.out.println("ForName:"+e.getMessage());
}
try
{
Connection con = DriverManager.getConnection(connectDB);
Statement stmt = con.createStatement();
String query1 = "create table Borrow("+"branch_name String,"+"loan_name Number,"+"customer_name String,"+"amount Number"+")";
String query2 = "create table Branch("+"branch_name String,"+"assets Number,"+"branch_city String"+")";
String query3 = "create table Customer("+"customer_name String,"+"street String,"+"customer_city String"+")";
String query4 = "create table Deposit("+"branch_name String,"+"account_number Number"+"customer_name String,"+"balance Number"+")";
stmt.executeUpdate(query1);
stmt.executeUpdate(query2);
stmt.executeUpdate(query3);
stmt.executeUpdate(query4);
stmt.close();
con.close();
}
catch (SQLException e)
{
System.out.println("SQLException:"+e.getMessage());
}
}
}

编译没有问题,运行出现问题如下:
ForName:sun.jdbc.odbc.JdbcOdbcDriver
SQLException:No suitable driver found for jdbc:odbc:Bank
求指教
展开
 我来答
yugi111
2015-09-07 · TA获得超过8.1万个赞
知道大有可为答主
回答量:5.1万
采纳率:70%
帮助的人:1.3亿
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式