-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
49 lines (34 loc) · 1.32 KB
/
Main.java
File metadata and controls
49 lines (34 loc) · 1.32 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import config.DbConnectionManagement;
import entity.Employee;
import query.DeleteQueryApi;
import query.InsertQueryApi;
import query.SelectQueryApi;
import java.sql.Connection;
import java.util.Date;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) {
try {
//database'e baglantı kurar ve bir adet connection nesnesi yaratır
Connection connection = DbConnectionManagement.connectToDatabase();
/*10 idli kayıdın silme işlemini yapar
DeleteQueryApi.deleteRecord(10, connection);
*/
/* verilen id'nin veri tabanında olup olmadıgını kontrol eder
if (SelectQueryApi.findByEmployeeId(10, connection)!=null) {
System.out.println("Kayıt bulundu");
} else {
System.out.println("Kayıt bulunamadı");
}
*/
/* yeni kayıt ekleme yapar
Employee tempEmployee = new Employee("Ahmet", "Aksoy", "M", new Date(), new Date());
InsertQueryApi.insertOneRecord(tempEmployee, connection);
*/
//database baglantısını kapatır
DbConnectionManagement.killDbConnection(connection);
} catch (SQLException e) {
e.printStackTrace();
}
}
}