Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. connect to an in-memory database, you use the following connection string:
  2. jdbc:sqLite::memory
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7. try{
  8. Connection conn = DriverManager.getConnection("jdbc:sqlite:C:\Users\Owner\Desktop\School Project\Software-Engineering---Java-Project\Nati Elmaliach java\data.db");
  9. Statement statement = conn.createStatement();
  10.  
  11. //CREATE TABLES
  12. statement.execute("CREATE TABLE IF NOT EXISTS CUSTOMERS (name TEXT,phone INTEGER,email TEXT)");
  13.  
  14. //INSERT TO TABLES
  15. statement.execute("INSERT INTO CUSTOMERS (name,phone,email)" +
  16. "VALUES ('NETANEL', 05555555,'SADF@GMAIL')");
  17. statement.execute("INSERT INTO CUSTOMERS (name,phone,email)" +
  18. "VALUES ('BAR', 05554646,'RTGDG@GMAIL')");
  19. statement.execute("INSERT INTO CUSTOMERS (name,phone,email)" +
  20. "VALUES ('TOMER', 055646541,'ASDQWE@GMAIL')");
  21. statement.execute("INSERT INTO CUSTOMERS (name,phone,email)" +
  22. "VALUES ('LEIZY', 064646231,'ASD@GMAIL')");
  23. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement