DatabaseConnection: connect JDBC v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 21 Dec 2013 22:22:30 +0100
branchv_0
changeset 2857c44a6baedb
parent 27 24aa5199bfd6
child 29 d66858b4b563
DatabaseConnection: connect JDBC
java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java	Sat Dec 21 22:18:07 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java	Sat Dec 21 22:22:30 2013 +0100
     1.3 @@ -18,6 +18,9 @@
     1.4  package info.globalcode.sql.dk;
     1.5  
     1.6  import info.globalcode.sql.dk.configuration.DatabaseDefinition;
     1.7 +import java.sql.Connection;
     1.8 +import java.sql.DriverManager;
     1.9 +import java.sql.SQLException;
    1.10  
    1.11  /**
    1.12   *
    1.13 @@ -26,8 +29,11 @@
    1.14  public class DatabaseConnection {
    1.15  
    1.16  	private DatabaseDefinition databaseDefinition;
    1.17 +	private Connection connection;
    1.18  
    1.19 -	public DatabaseConnection(DatabaseDefinition databaseDefinition) {
    1.20 +	public DatabaseConnection(DatabaseDefinition databaseDefinition) throws SQLException {
    1.21  		this.databaseDefinition = databaseDefinition;
    1.22 +
    1.23 +		connection = DriverManager.getConnection(databaseDefinition.getUrl(), databaseDefinition.getName(), databaseDefinition.getPassword());
    1.24  	}
    1.25  }