Guest User

Untitled

a guest
Nov 28th, 2018
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. package storedProcedures;
  2.  
  3. import java.sql.*;
  4.  
  5. public class StorePro
  6. {
  7.  
  8. public static void main(String[] args)
  9. {
  10. Connection conn=null;
  11. CallableStatement stmt=null;
  12. try
  13. {
  14. conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/assignment","root","Welcome123");
  15. String theDepartment="h";
  16.  
  17. stmt=conn.prepareCall("{call increase_salaries_for_department(?)}");
  18. stmt.setString(1, theDepartment);
  19.  
  20. stmt.execute();
  21. stmt.executeUpdate();
  22. ResultSet rs=stmt.executeQuery("select * from student");
  23. while(rs.next())
  24. {
  25. System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4));
  26. }
  27.  
  28. }
  29. catch (Exception e)
  30. {
  31. e.printStackTrace();
  32. }
  33. }
  34.  
  35. }
Add Comment
Please, Sign In to add comment