2012-08-03 144 views

回答

0

本教程有详细的解释:http://www.vogella.com/articles/MySQLJava/article.html。该网站是真棒,并有许多其他伟大的教程!

简而言之:

Class.forName("com.mysql.jdbc.Driver"); 
connect = DriverManager.getConnection("jdbc:mysql://localhost/dbname?user=sqluser&password=sqluserpw"); 
statement = connect.createStatement(); 
resultSet = statement.executeQuery("SELECT * FROM dbname.tablename"); 

这是你需要什么?

+0

是的,谢谢.. – user1573259 2012-08-14 07:21:59

+1

还有一件事你可以做......接受答案;)(http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer -工作) – 2012-08-14 07:42:28