Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Model extends Sql {
- PreparedStatement s;
- //preparando variables necesarias
- protected PreparedStatement ps;
- protected String bd;
- protected Connection cn;
- protected Statement st;
- protected String sql;
- protected ResultSet rs;
- String DatoFinales = "";
- String driverDataBase = "";
- private Connection dbVerificadorConnection;
- public Model() throws Exception {
- String sqlserverProperties = Util.getProperties("sqlserver");
- String applicationNameProperties = Util.getProperties("applicationName");
- String databaseNameProperties = Util.getProperties("databaseName");
- String userProperties = Util.getProperties("user");
- String passwordProperties = Util.getProperties("password");
- String driverDataBaseProperties = Util.getProperties("driverDataBase");
- DatoFinales += "jdbc:sqlserver:"
- + sqlserverProperties
- + ";applicationName="
- + applicationNameProperties
- + ";databaseName="
- + databaseNameProperties
- + ";user="
- + userProperties
- + ";password="
- + passwordProperties;
- driverDataBase = driverDataBaseProperties;
- }
- private void AbrirConexionBaseDatos() {
- try {
- Class.forName(driverDataBase); //inicializo el driver
- cn = DriverManager.getConnection(DatoFinales, new Properties()); //enlazo la tabla
- } catch (ClassNotFoundException | SQLException e) {
- Util.Exception(e);
- }
- }
- private void CerrarConexionBaseDatos() throws SQLException {
- try {
- s.close();
- } catch (Exception e) {
- Util.Exception(e);
- }
- }
Add Comment
Please, Sign In to add comment