Revize c670fa2f
Přidáno uživatelem Jan Havlíček před asi 4 roky(ů)
project/Deserializer/src/io/Database.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
public DB_Messenger(String driver, String url, String user, String password, String table, String condition, String column) { |
25 | 25 |
this.driver = driver; |
26 |
this.url = url; |
|
26 |
//The timezone statement added due to MySQL DB. Is it OK with MsSQL and Oracle? |
|
27 |
this.url = url + "?useTimezone=true&serverTimezone=UTC"; |
|
27 | 28 |
this.user = user; |
28 | 29 |
this.password = password; |
29 |
this.sql = "SELECT " + column + " FROM " + table + " WHERE " + condition + ";"; |
|
30 |
|
|
31 |
this.sql = "SELECT " + column + " FROM " + table; |
|
32 |
if(condition.length() > 0) |
|
33 |
{ |
|
34 |
this.sql += " WHERE " + condition; |
|
35 |
} |
|
36 |
this.sql += ";"; |
|
37 |
|
|
30 | 38 |
this.column = column; |
31 | 39 |
} |
32 | 40 |
|
... | ... | |
49 | 57 |
//DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver()); |
50 | 58 |
|
51 | 59 |
System.out.println("--- Connecting to the database ---".toUpperCase()); |
60 |
|
|
52 | 61 |
conn = DriverManager.getConnection(crate.url, crate.user, crate.password); |
53 | 62 |
|
54 | 63 |
System.out.println("--- Executing the query ---".toUpperCase()); |
Také k dispozici: Unified diff
re #7963 DB communication repaired, tested.
html structures removed