全文预览

C猜字游戏

上传者:非学无以广才 |  格式:pdf  |  页数:67 |  大小:8120KB

文档介绍
io.*;\rimport java.sql.*;\rimport java.util.*;\rpublic class ReadMySQL{\rstatic Connection con=null;\rstatic PreparedStatement pstm=null;\rstatic ResultSet result = null;\rpublic static void main(String[] args){\rReadMySQL R = new ReadMySQL();\rR.Sprint();\r}\rpublic void Sprint(){\rtry{\rClass.forName("com.mysql.jdbc. Driver");\rcon = DriverManager.getConnection("jdbc:mysql://localhost:3306/\rstudent","root","root");\rpstm = con.prepareStatement("select * from student");.\rresult = pstm.executeQuery();\rwhile(result.next()){\rfor(int i=1;i<5;i++){\rSystem.out.print(result.getString(i)+"");\r//result.next();\r}\rSystem.out.println();\r)\r}catch(Exception e){\re.printStackT race();\r)\r)\r)

收藏

分享

举报
下载此文档