Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- */
- /**
- * @author pedro
- *
- */
- import java.sql.*;
- public class CopyOfHolaMundoBaseDatos2 {
- public static void main(String[] args)
- throws ClassNotFoundException, SQLException {
- Class.forName("com.mysql.jdbc.Driver");
- Connection conn = DriverManager.getConnection(
- "jdbc:mysql://localhost:3306/sample","root","");
- //Statement stmt2 = conn.prepareStatement("INSERT INTO autores VALUES (3,'Pepe','Española'");
- Statement stmt = conn.createStatement();
- int rs = stmt.executeUpdate(
- "INSERT INTO autores VALUES(3,'Pepe','Española' ");
- // while (rs.next()) {
- // String name = rs.getString("nombre");
- //
- // System.out.println(name);
- // }
- // rs.close();
- stmt.close();
- conn.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement