Help! Made a MySQL database running phpMyAdmin. And he created a table there. I use library MySQL_Connector. In order to get data from it, I use this code:
try{ Connection connection; String driverName = "com.mysql.jdbc.Driver"; Class.forName(driverName); String baseName = "ej3"; String serverName = "localhost"; String _url = "jdbc:mysql://"+serverName+"/"+baseName; String userName = "root"; String password = ""; connection = DriverManager.getConnection(_url, userName, password); String ask = "SELECT * FROM pupils"; Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(ask); String tempN,tempSN; while(rs.next()) { tempN = rs.getString("fName"); tempSN = rs.getString("sName"); addPupil(new Pupil(tempN, tempSN)); } connection.close(); }catch(Exception e){} He works. And how to do so, not to get the value, and write?
INSERTsql-tutorial.ru/en/book/operator_insert.html - Mikhail Rebrov