Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package sqltest;
- import java.sql.DriverManager;
- import java.sql.*;
- /**
- *
- * @author Abdullah
- */
- public class INOUT {
- public static void main(String[] ags) throws SQLException{
- String url="jdbc:mysql://localhost/demo?autoReconnect&useSSL=false";
- String user="root";
- String password="abdullah";
- String SQL=
- " { call greet_the_department (?) }"
- ;
- String Department="HR";
- Connection connect=DriverManager.getConnection(url,user,password );
- CallableStatement CS=connect.prepareCall(SQL);
- // CS.registerOutParameter(1, Types.VARCHAR);
- CS.setString(1,Department);
- CS.execute();
- String set=CS.getString(1);
- System.out.println( set );
- }
- }
Add Comment
Please, Sign In to add comment