Calling a stored procedure in Java : Java : Procedure Function SQL / MySQL


SQL / MySQL » Procedure Function » Java »

 

Calling a stored procedure in Java


 
try {
   Class.forName("com.mysql.jdbc.Driver").newInstance();

   String ConnectionString="jdbc:mysql://" + hostname + "/" + database + "?user=" +
          username + "&password=" + password;
   System.out.println(ConnectionString);
   Connection conn = DriverManager.getConnection(ConnectionString);
   Statement stmt=conn.createStatement();
   stmt.execute("call error_test_proc(1)");
}
catch(SQLException SQLEx) {
   System.out.println("MySQL error: "+SQLEx.getErrorCode()+
          " SQLSTATE:" +SQLEx.getSQLState());
   System.out.println(SQLEx.getMessage());
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

SQL / MySQL

 Navioo Procedure Function
» Java