Advertisement
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 juninho.persistencia;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- /**
- *
- * @author Juninho
- */
- public class Dao {
- Connection con;
- PreparedStatement pstmt;
- public void abrirBanco() throws Exception {
- Class.forName("com.mysql.jdbc.driver");
- String url = "jdbc:mysql://localhost:3306/vab";
- String usuario = "root";
- String senha = "";
- con = DriverManager.getConnection(url, usuario, senha);
- }
- public void fecharBanco() throws Exception {
- if(con != null){
- con.close();
- }
- if(pstmt != null){
- pstmt.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement