Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- import javax.swing.*;
- public class Conexion {
- Connection C;
- public Connection conexion(){
- try {
- Class.forName("com.mysql.jdbc.Driver");
- C = DriverManager.getConnection("jdbc:mysql://localhost/proyecto","root","");
- if (C != null){
- JOptionPane.showMessageDialog(null,"Conexion establecida correctamente");
- }
- else {
- JOptionPane.showMessageDialog(null,"Fallo en la conexion, favor de verificar los datos");
- }
- }
- catch(Exception e){
- JOptionPane.showMessageDialog(null,e.getMessage());
- }
- return C;
- }
- Statement createStatement(){
- throw new UnsupportedOperationException("No soportado");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement