Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public void createDatabase()
  2. {
  3. try {
  4.  
  5. Class.forName("org.sqlite.JDBC");
  6. c = DriverManager.getConnection("jdbc:sqlite:SchemaStore.db");
  7. System.out.println("Opened database successfully");
  8.  
  9. stmt = c.createStatement();
  10. String sql = "CREATE TABLE schemainfo " +
  11. "(DatabaseName TEXT NOT NULL," +
  12. " RelationName TEXT NOT NULL," +
  13. " FieldName PRIMARY KEY TEXT NOT NULL," +
  14. " FieldType TEXT NOT NULL," +
  15. " PartOfPrimKey BOOLEAN," +
  16. " PartOfForKey BOOLEAN," +
  17. " ParentRelation TEXT," +
  18. " ParentField TEXT)";
  19. stmt.executeUpdate(sql);
  20. stmt.close();
  21. c.close();
  22. } catch ( Exception e ) {
  23. System.err.println( e.getClass().getName() + ": " + e.getMessage() );
  24. System.exit(0);
  25. }
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement