-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate.java
More file actions
32 lines (24 loc) · 1 KB
/
Create.java
File metadata and controls
32 lines (24 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package TeacherRegister;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Create {
public static void createNewDatabase(String fileName) throws ClassNotFoundException {
String url = "jdbc:sqlite:C:/sqlite/" + fileName;
try {
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection(url);
if (conn != null) {
DatabaseMetaData meta = conn.getMetaData();
System.out.println("The driver name is " + meta.getDriverName());
System.out.println("A new database has been created.");
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
public static void main(String[] args) throws ClassNotFoundException {
createNewDatabase("SSSIT.db");
}
}