db setup //runable
This commit is contained in:
parent
d5d98fde7a
commit
79aaa3fe85
@ -20,7 +20,7 @@ public class HelloApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String sql = """
|
/* String sql = """
|
||||||
CREATE TABLE IF NOT EXISTS user (
|
CREATE TABLE IF NOT EXISTS user (
|
||||||
id integer PRIMARY KEY,
|
id integer PRIMARY KEY,
|
||||||
name text);""";
|
name text);""";
|
||||||
@ -28,10 +28,10 @@ public class HelloApplication extends Application {
|
|||||||
String sql3 = "INSERT INTO user (id,name) VALUES (1,'test1')";
|
String sql3 = "INSERT INTO user (id,name) VALUES (1,'test1')";
|
||||||
try(Connection conn = connect();
|
try(Connection conn = connect();
|
||||||
Statement stmt = conn.createStatement()){
|
Statement stmt = conn.createStatement()){
|
||||||
//stmt.execute(sql);
|
stmt.execute(sql);
|
||||||
//stmt.execute(sql3);
|
stmt.execute(sql3);
|
||||||
PreparedStatement pstmt = conn.prepareStatement(sql2);
|
PreparedStatement pstmt = conn.prepareStatement(sql2);
|
||||||
pstmt.setInt(1,1);
|
pstmt.setInt(1,0);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
while (rs.next()){
|
while (rs.next()){
|
||||||
System.out.println(rs.getInt("id"));
|
System.out.println(rs.getInt("id"));
|
||||||
@ -39,7 +39,7 @@ public class HelloApplication extends Application {
|
|||||||
}catch (SQLException e){
|
}catch (SQLException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
} */
|
||||||
launch();
|
launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user