Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package storedProcedures;
- import java.sql.*;
- public class StorePro
- {
- public static void main(String[] args)
- {
- Connection conn=null;
- CallableStatement stmt=null;
- try
- {
- conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/assignment","root","Welcome123");
- String theDepartment="h";
- stmt=conn.prepareCall("{call increase_salaries_for_department(?)}");
- stmt.setString(1, theDepartment);
- stmt.execute();
- stmt.executeUpdate();
- ResultSet rs=stmt.executeQuery("select * from student");
- while(rs.next())
- {
- System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4));
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment