Code example for SQLException

Methods: toString

0
        } 
        try { 
            stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
            prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)");
        } catch (SQLException e) {
            System.out.println(url + ": " + e.toString());
        } 
    } 
 
    private void insert(int id) {
        try { 
            if (prep != null) {
                prep.setInt(1, id);
                prep.setString(2, "World " + id);
                prep.execute();
            } 
        } catch (SQLException e) {
            System.out.println(url + ": " + e.toString());
        } 
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE