This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//creando conexion | |
Class.forName("com.mysql.jdbc.Driver"); | |
Connection conexion = DriverManager.getConnection ("jdbc:mysql://localhost/prueba","root", "la_clave"); | |
//creando el vehiculo para ejecutar el query | |
Statement db = conexion.createStatement(); | |
// ejecutar query guardando el resultado en un ResultSet | |
ResultSet result = db.executeQuery ("select * from ------"); | |
// se usa executequery para unicamente el SELECT, para lo demas es executeupdate |