package otrodb; import java.sql.*; public static static static static public
class OtroDB { String bd = "alumnos"; String login = "root"; String password = ""; String url = "jdbc:mysql://localhost/"+bd; static void main(String[] args) throws Exception { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(url,login,password); if (conn != null) { System.out.println("Conexi贸n a base de datos "+url+" ... Ok"); conn.close(); } } catch(SQLException ex) { System.out.println("Hubo un problema al intentar conectarse con la base de datos "+url); } catch(ClassNotFoundException ex) { System.out.println(ex); } } }