Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class conexion {
- public String USERNAME = "root";
- public String PASSWORD = "jeferson";
- public String HOST = "localhost";
- public String PORT = "3306";
- public String DATABASE = "kevin_bd";
- public String CLASSNAME = "com.mysql.jdbc.Driver";
- public String URL = "jdbc:mysql://"+HOST+":"+PORT+"/"+DATABASE+"?useSSL=false";
- private Connection co;
- protected Statement st;
- public conexion(){
- try{
- Class.forName(CLASSNAME);
- co = DriverManager.getConnection(URL, USERNAME, PASSWORD);
- }catch(ClassNotFoundException cnex){
- System.out.println(cnex.getMessage());
- }
- catch(SQLException exsql){
- System.out.println(exsql.getMessage());
- }
- }
- public Statement getStmt(){
- return this.st;
- }
- public Connection getconexion(){
- return co;
- }
- public static void main(String[] args){
- conexion con = new conexion();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement