db setup //runable

This commit is contained in:
Malte Schulze Hobeling 2022-11-29 22:45:05 +01:00
parent d5d98fde7a
commit 79aaa3fe85

View File

@ -20,7 +20,7 @@ public class HelloApplication extends Application {
}
public static void main(String[] args) {
String sql = """
/* String sql = """
CREATE TABLE IF NOT EXISTS user (
id integer PRIMARY KEY,
name text);""";
@ -28,10 +28,10 @@ public class HelloApplication extends Application {
String sql3 = "INSERT INTO user (id,name) VALUES (1,'test1')";
try(Connection conn = connect();
Statement stmt = conn.createStatement()){
//stmt.execute(sql);
//stmt.execute(sql3);
stmt.execute(sql);
stmt.execute(sql3);
PreparedStatement pstmt = conn.prepareStatement(sql2);
pstmt.setInt(1,1);
pstmt.setInt(1,0);
ResultSet rs = pstmt.executeQuery();
while (rs.next()){
System.out.println(rs.getInt("id"));
@ -39,7 +39,7 @@ public class HelloApplication extends Application {
}catch (SQLException e){
e.printStackTrace();
return;
}
} */
launch();
}