No suitable driver~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
java.sql.SQLException: No suitable driver
import java.sql.*;
public class New6{
public static void main(String[] args)
{
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(
ClassNotFoundException e){}
try
{
Connection con=DriverManager.getConnection( "jdbc:odbc:sun ", " ", " ");
Statement sql=con.createStatement();
ResultSet rs=sql.executeQuery( "select name,english from student where english> =80 ");
while(rs.next())
{
String name=rs.getString(1);
int english=rs.getInt(5);
System.out.println( " 姓名: "+ name);
System.out.println( " 英语 "+english);
}
con.close();
}
catch(
SQLException e)
{
System.out.println(e);
}
}
}
------解决方案--------------------JDK里应该带有这个驱动的