Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
added an Databse file dont' exsist handler to create the Database
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobin Rosenau committed Dec 13, 2017
1 parent 8f0f0f1 commit 8a806b1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
*/
public class Database {
public Database() {
}

public String createTable() {
Connection c = null;
Statement stmt = null;
File db = new File("telefonbuch.db");
if (!db.exists()) {
try {
db.createNewFile();
createTable();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}

public String createTable() {
Connection c = null;
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:telefonbuch.db");
Expand Down

0 comments on commit 8a806b1

Please sign in to comment.