Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package br.com.vitor.dal;
- import java.sql.*;
- public class ModuloConexao {
- //metodo responsavel por estabalecer conexao com o banco de dados //
- public static Connection conector() {
- java.sql.Connection conexao = null;
- //chama o driver //
- String driver = "com.mysql.jdbc.Driver";
- //Armazenando informacao//
- String url = "jdbc:mysql://localhost:3306/aula";
- String user = "root";
- String password = "root";
- //estabelecendo conezao//
- try{
- Class.forName(driver);
- conexao=DriverManager.getConnection(url,user,password);
- return conexao;
- }catch(Exception e){
- //exibe o erro
- System.out.println(e);
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement