Stored Procedures: group of SQL statements that perform a particular task Normally created by DBA Can have any combination of input, output, and input/output parameters Benefits: Performance - compiled once but executable more times Productivity and Ease of Use - avoid redundant code, extend SQL Database functionality Scalability Maintainability Interoperability Replication Security To call stored procedure from Java The JDBC API provides the CallableStatement CallableStatement myCall = myConn.prepareCall("{ call some_stored_procedure() }"); ... myCall.execute(); JDBC API parameter types IN default INOUT OUT Stored Procedure can return result sets EXAMPLE: Created stored procedure on MySQL side - NAME: increase_salaries_for_department DELIMITER $$ DROP PROCEDURE IF EXISTS ` increase_salaries_for_department `$$ CREATE DEFINER=`student`@`localhost` PROCEDURE `increase_salaries_for_departme...
Komentarze
Prześlij komentarz