Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package Classes;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- /**
- *
- * @author Kevin
- */
- public class Connection {
- private java.sql.Connection conn = null;
- public Connection() throws ClassNotFoundException, SQLException {
- Class.forName("com.mysql.jdbc.Driver");
- conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/clinicas", "root", "root");
- }
- public java.sql.Connection getConnection() {
- return conn;
- }
- public void close(ResultSet rs) throws SQLException {
- if (rs != null) {
- rs.close();
- }
- }
- public void close(Statement stmt) throws SQLException {
- if (stmt != null) {
- stmt.close();
- }
- }
- public void destroy() throws SQLException {
- if (conn != null) {
- conn.close();
- }
- }
- }
Add Comment
Please, Sign In to add comment