miércoles, 4 de marzo de 2009

Codigo Java N1: pryMenuTabla Conectar

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package prymenu;
import java.sql.*;
/**
*
* @author Administrador
*/
public class Conectar {
Connection cn=null;
Statement stmt=null;
ResultSet rs=null;
int fila=0;
String sql="";

public Conectar(){
try{
Class.forName("org.postgresql.Driver").newInstance();
System.out.println("Driver instalado");
cn=DriverManager.getConnection("jdbc:postgresql://localhost/PORTAL_WEB","postgres","sistemas");
System.out.println("Base conectada");
}catch(Exception e){
System.out.println("Error= "+e.getMessage());
}
}

}

No hay comentarios: