import java.io.*;
import java.sql.*;
class BookQuery
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException ce)
{
System.out.println("SQLException"+ce.getMessage());
}
try
{
Connection con=DriverManager.getConnection("jdbc.odbc:bookbase");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from bookTab");
while(rs.next())
{
System.out.println(
"书号"+rs.getInt(1)+"\t"+
"书名"+rs.getString(2)+"\t"+
"作者"+rs.getString(3)+"\t"+
"单价"+rs.getFloat(4));
}
stmt.close();
con.close();
}
catch(SQLException e)
{
System.out.println("SQLException:"+e.getMessage());
}
}
}
报错为:SQLException: No Suitable driver
why ??