终于配置了一个最简单的table在mysql中, 写了一个最简单的java..application来成功读取了mysql中的表....不容易呀...
import java.sql.*;
import java.util.*;
public class ManageSQL {
public static void main(String args[]){
Connection con;
Statement stmt;
ResultSet rs;
try{
Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/ManagerBook","root","000000");
stmt = con.createStatement();
rs = stmt.executeQuery("select * from book");
int column = rs.getMetaData().getColumnCount();
while(rs.next()){
Object[] obj = new Object[column];
for(int i=0;i<column;i++){
obj[i] = rs.getObject(i);
System.out.print(obj);
}
System.out.println();
}
}catch(ClassNotFoundException e){
e.printStackTrace();
}catch(SQLException e){
e.printStackTrace();
}
}
}