equal
deleted
inserted
replaced
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 package info.globalcode.sql.dk; |
18 package info.globalcode.sql.dk; |
19 |
19 |
20 import info.globalcode.sql.dk.configuration.DatabaseDefinition; |
20 import info.globalcode.sql.dk.configuration.DatabaseDefinition; |
|
21 import java.sql.Connection; |
|
22 import java.sql.DriverManager; |
|
23 import java.sql.SQLException; |
21 |
24 |
22 /** |
25 /** |
23 * |
26 * |
24 * @author Ing. František Kučera (frantovo.cz) |
27 * @author Ing. František Kučera (frantovo.cz) |
25 */ |
28 */ |
26 public class DatabaseConnection { |
29 public class DatabaseConnection { |
27 |
30 |
28 private DatabaseDefinition databaseDefinition; |
31 private DatabaseDefinition databaseDefinition; |
|
32 private Connection connection; |
29 |
33 |
30 public DatabaseConnection(DatabaseDefinition databaseDefinition) { |
34 public DatabaseConnection(DatabaseDefinition databaseDefinition) throws SQLException { |
31 this.databaseDefinition = databaseDefinition; |
35 this.databaseDefinition = databaseDefinition; |
|
36 |
|
37 connection = DriverManager.getConnection(databaseDefinition.getUrl(), databaseDefinition.getName(), databaseDefinition.getPassword()); |
32 } |
38 } |
33 } |
39 } |