Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. package Modelo;
  8. import java.sql.*;
  9.  
  10. public class Conexion {
  11. public Conexion() {
  12. }
  13.  
  14. public Connection getConexion(){
  15. Connection con=null;
  16. try{
  17. /* Carga|Registra el driver JDBC */
  18. Class.forName("com.mysql.jdbc.Driver").newInstance();
  19. /* Obtener la conexion */
  20. con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bd_prueba","root","");
  21. }catch(SQLException ex){
  22. }catch(Exception e){
  23. }
  24. return con;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement