Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String driver="com.mysql.jdbc.Driver";
- String url="jdbc:mysql://localhost/prueba";
- String usuario="root";
- String password="";
- Class.forName(driver);
- Connection conexion=DriverManager.getConnection(url,usuario, password);
- Statement st=conexion.createStatement();
- String sql="SELECT * FROM tabla";
- ResultSet rs=st.executeQuery(sql);
- while(rs.next()){
- int id =rs.getInt("COL_ID");
- String nombre =rs.getString("COL_NOMBRE");
- String apellido =rs.getString("COL_APELLIDO");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement