-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnDB.java
61 lines (41 loc) · 1.64 KB
/
ConnDB.java
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
50
51
52
53
54
55
56
57
58
59
60
61
package com.canavci.library.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.LinkedList;
import javax.swing.SwingUtilities;
import com.canavci.library.ctrl.Library;
import com.canavci.library.dao.BooksDAO;
import com.canavci.library.dom.Book;
import com.canavci.library.gui.LibraryGui;
public class ConnDB {
public static void main(String[] args) {
/* // TODO Auto-generated method stub
try {
Class.forName("org.postgresql.Driver");
Connection connection = null;
connection = DriverManager.getConnection("jdbc:postgresql://10.106.2.63:5432/mylibrary", "odoo", "5678");
// get the data
LinkedList<Book> listOfBooks = new LinkedList<Book>();
// BooksDAO.populateListOfBooks(connection, listOfBooks);
// BooksDAO.selectBooksList(connection, listOfBooks);
// print data
// listOfBooks.forEach(System.out::println);
PreparedStatement pst = null;
// Statement st=null;
// Library.addBook(connection, pst, "Hatıralarım", 1);
Library.hireBook(connection,pst, 1, "Beşiktaşın Tarihi","2017-10-20", listOfBooks);
// listOfBooks);
// listOfBooks.forEach(System.out::println);
// Library.returnBook(connection, pst, "Beşiktaşın Tarihi", 2, listOfBooks);
// Library.hireBook(connection, pst, 2, "Tarih", "2017-09-20", listOfBooks);
// Library.returnBook(connection, pst, "Tarih", 2, listOfBooks);
connection.close();
System.out.println("Connection successful");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
LibraryGui test = new LibraryGui();
}}