Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void addResult(){
- testmessage = "hejx2";
- try{
- String hostname = "jdbc:mysql://localhost:3306/test";
- String user = "root";
- String password = "password";
- connect = DriverManager.getConnection(hostname, user, password);
- if (connect != null) {
- testmessage = "Connected to the database test1";
- }
- else{
- testmessage = "poop";
- }
- try{
- Statement statement = connect.createStatement();
- statement.executeUpdate(
- "INSERT INTO `resultat` (`resultatID`, `studentID`, `kurskod`, `termin`, `provnr`, `betyg`) VALUES ('2', 'eriped-3', 'D0006N', 'HT2015', '3', 'VG');");
- }
- catch (SQLException ex) {
- testmessage = "testing123";
- System.out.println(ex.getMessage());
- }
- }
- catch (SQLException ex) {
- testmessage = "testing123456";
- System.out.println(ex.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement