Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void writeToFile() throws IOException {
- Connection dbConnection = null;
- PreparedStatement statement = null;
- try {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- System.out.println("MYSQL:s JDBC-drivrutiner hittades.");
- } catch (Exception e) {
- System.err.println("MYSQL:s JDBC-drivrutiner kunde INTE hittas.");
- }
- String url = "jdbc:mysql://atlantis.informatik.umu.se/svph1102_db2_vt2012";
- String user = "svph1102";
- String password = "qygebagaq";
- try {
- dbConnection = DriverManager.getConnection(url, user, password);
- statement = dbConnection.prepareStatement("INSERT INTO BLA BLA");
- for (int i = 0; i < spelLista.size(); i++) {
- Spel s = spelLista.get(i);
- }
- } catch (SQLException ex) {
- System.err.println("Ett fel har uppstått: " + ex.toString());
- }
- }
Add Comment
Please, Sign In to add comment