Package

Source Code of MainDBClass

import data.Person;
import service.DBOperations;
import service.DataBaseManager;

import java.sql.Connection;
import java.sql.SQLException;

import static utils.PropertiesUtils.getProperty;

public class MainDBClass {
    static final String JDBC_DRIVER = getProperty("driver");
    static final String DB_URL = getProperty("url");
    static final String USER = getProperty("login");
    static final String PASS = getProperty("password");

    public static void main(String[] args) {
        try {
            Connection connection = DataBaseManager.getConnection(JDBC_DRIVER, DB_URL, USER, PASS);
            DBOperations.createDBSchema(connection, "ssnewschema");
            service.DBOperations.createTableInSchema(connection, "ssnewschema", "table2");

            DBOperations.insertData(new Person("Malchvich", "Jonh", "Kreshatik 14", "TOKIO"), connection, "ssnewschema", "table1");

            System.out.println("HAPPY END");
            connection.close();
        } catch (SQLException e) {
            System.out.println("SQL EXCEPTION");
        }
    }
}
TOP

Related Classes of MainDBClass

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.