Search Results

Search found 1 results on 1 pages for 'ck1221'.

Page 1/1 | 1 

  • Java program will read from database, but not write to it

    - by ck1221
    I have a Java program that successfully connects to a mysql database that is hosted on godaddy's server. I can read from that db with out issue, however, when I try to write to it with INSERT or UPDATE for example, the query does not execute. I am using the 'admin' account that I set up through godaddy, I realize this is not the root account. I have checked and verified that the connection is not read only, and have logged out of phpmyadmin while the query ran. I'm not sure what else I can try or if anyone has experienced this issue. Maybe a setting to the connection I have failed to set? Or maybe its not possible since the db is hosted on godaddy's servers? Any help is great! Thanks. Here is some relevant code: Connection to db: Connection con; public DBconnection(String url, String user, String pass) { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection (url,user,pass); if(!con.isClosed()) System.out.println("connecton open"); } catch (InstantiationException e) {e.printStackTrace();} catch (IllegalAccessException e) {e.printStackTrace();} catch (ClassNotFoundException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} } Send Query: public ResultSet executeQuery(String query) { ResultSet rs = null; try { Statement stmt = (Statement) con.createStatement(); rs = stmt.executeQuery(query); //while(rs.next()) //System.out.println(rs.getString("ticket_num")); } catch (SQLException e) {} return rs; } Insert Query (works in phpmyadmin): conn.executeQuery("INSERT INTO tickets VALUES(55555,'12/01/2012','me','reports','test','','','0','Nope')");

    Read the article

1