Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class.forName("com.mysql.jdbc.Driver");//Cargar el driver
- Connection conexion = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/agenda","root", ""); //Primer ejemplo Nombre de la BD, Segundo ejemplo Usuario, Tercer ejemplo Clave.
- Statement sentencia = conexion.createStatement();
- sentencia.executeQuery ("SELECT * FROM contactos WHERE nombre='" + contacto[0] + "' and apellidos='" + contacto[1] + "';");
- sentencia.executeUpdate ("UPDATE contactos SET tlf='" + contacto[1] + "' WHERE codigo=" + contacto[0] + ";");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement