java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java
author František Kučera <franta-hg@frantovo.cz>
Sat, 21 Dec 2013 22:22:30 +0100
branchv_0
changeset 28 57c44a6baedb
parent 27 24aa5199bfd6
child 29 d66858b4b563
permissions -rw-r--r--
DatabaseConnection: connect JDBC
franta-hg@26
     1
/**
franta-hg@26
     2
 * SQL-DK
franta-hg@26
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@26
     4
 *
franta-hg@26
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@26
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@26
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@26
     8
 * (at your option) any later version.
franta-hg@26
     9
 *
franta-hg@26
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@26
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@26
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@26
    13
 * GNU General Public License for more details.
franta-hg@26
    14
 *
franta-hg@26
    15
 * You should have received a copy of the GNU General Public License
franta-hg@26
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@26
    17
 */
franta-hg@27
    18
package info.globalcode.sql.dk;
franta-hg@27
    19
franta-hg@27
    20
import info.globalcode.sql.dk.configuration.DatabaseDefinition;
franta-hg@28
    21
import java.sql.Connection;
franta-hg@28
    22
import java.sql.DriverManager;
franta-hg@28
    23
import java.sql.SQLException;
franta-hg@26
    24
franta-hg@26
    25
/**
franta-hg@26
    26
 *
franta-hg@26
    27
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@26
    28
 */
franta-hg@26
    29
public class DatabaseConnection {
franta-hg@26
    30
franta-hg@26
    31
	private DatabaseDefinition databaseDefinition;
franta-hg@28
    32
	private Connection connection;
franta-hg@26
    33
franta-hg@28
    34
	public DatabaseConnection(DatabaseDefinition databaseDefinition) throws SQLException {
franta-hg@26
    35
		this.databaseDefinition = databaseDefinition;
franta-hg@28
    36
franta-hg@28
    37
		connection = DriverManager.getConnection(databaseDefinition.getUrl(), databaseDefinition.getName(), databaseDefinition.getPassword());
franta-hg@26
    38
	}
franta-hg@26
    39
}