{"id":65942,"date":"2021-07-18T04:10:04","date_gmt":"2021-07-18T08:10:04","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/jdbc-stored-procedure-java-short-notes\/"},"modified":"2021-07-18T04:10:04","modified_gmt":"2021-07-18T08:10:04","slug":"jdbc-stored-procedure-java-short-notes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65942","title":{"rendered":"JDBC: Stored Procedure #Java Short Notes"},"content":{"rendered":"<p><pre style='font-size:13;padding-left:5px'>Sample stored procedure call using JDBC:Call stored procedure to change\/set a value in the database<br \/><br \/>\/\/set birthday - supply professor nametry{    String professor= \"dylan thomas\";    CallableStatement proc = connection.prepareCall(\"{ call set_birth_date(?, ?) }\");    proc.setString(1, professor);    proc.setString(2, '1950-01-01');    cs.execute();}catch (SQLException e){    \/\/ ....}Stored procedures can also return result\/data to the caller: like\/\/return birth dayconnection.setAutoCommit(false);CallableStatement proc =    connection.prepareCall(\"{ ? = call birthday_when(?) }\");proc.registerOutParameter(1, Types.Timestamp);proc.setString(2, professorName);cs.execute();Timestamp age = proc.getString(2);Stored procedures can also return complex data like  resultsets. JDBC drivers from oracle, Sql Server, PostgreSQL support this. <\/pre>\n<\/p>\n<p> From: http:\/\/sitestree.com\/?p=4839<br \/> Categories:Java Short Notes<br \/>Tags:<br \/> Post Data:2010-07-30 07:32:42<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sample stored procedure call using JDBC:Call stored procedure to change\/set a value in the database\/\/set birthday &#8211; supply professor nametry{ String professor= &#8220;dylan thomas&#8221;; CallableStatement proc = connection.prepareCall(&#8220;{ call set_birth_date(?, ?) }&#8221;); proc.setString(1, professor); proc.setString(2, &#8216;1950-01-01&#8217;); cs.execute();}catch (SQLException e){ \/\/ &#8230;.}Stored procedures can also return result\/data to the caller: like\/\/return birth dayconnection.setAutoCommit(false);CallableStatement proc = connection.prepareCall(&#8220;{ &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65942\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-65942","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":69099,"url":"http:\/\/bangla.sitestree.com\/?p=69099","url_meta":{"origin":65942,"position":0},"title":"Stored Procedure in MySql #5","author":"Author-Check- Article-or-Video","date":"August 12, 2021","format":false,"excerpt":"Starting from MySQL 5, you get Stored Procedure in Mysql What is a stored procedure: A stored procedure is simply a procedure that is stored on the database server like MySQL. In programming languages, you write procedures to execute a function\/logic. You can write similar procedure in SQL and store\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26207,"url":"http:\/\/bangla.sitestree.com\/?p=26207","url_meta":{"origin":65942,"position":1},"title":"PHP SQL Server Stored Procedure #Root","author":"Author-Check- Article-or-Video","date":"April 19, 2021","format":false,"excerpt":"\/* prepare the statement resource *\/ $stmt=mssql_init(\"your_stored_procedure\", $conn); \/* now bind the parameters to it *\/ mssql_bind($stmt, \"@id\", $id, SQLINT4, FALSE); mssql_bind($stmt, \"@name\", $name, SQLVARCHAR, FALSE); mssql_bind($stmt, \"@email\", $email, SQLVARCHAR, FALSE); \/* now execute the procedure *\/ $result = mssql_execute($stmt); Another Example $conn = mssql_connect($db_host,$db_user,$db_password);if ($conn===false){ echo 'Cannot connect.'; exit;\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26824,"url":"http:\/\/bangla.sitestree.com\/?p=26824","url_meta":{"origin":65942,"position":2},"title":"Some simple utilities for building Oracle and Sybase JDBC connections #Programming Code Examples #Java\/J2EE\/J2ME #JDBC","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"DriverUtilities.java Some simple utilities for building Oracle and Sybase JDBC connections. This is not general-purpose code -- it is specific to our local setup. package cwp; \/** Some simple utilities for building Oracle and Sybase * JDBC connections. This is not general-purpose * code -- it is specific to my\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":75827,"url":"http:\/\/bangla.sitestree.com\/?p=75827","url_meta":{"origin":65942,"position":3},"title":"MS SQL Server Dynamic SQl, T-SQL","author":"Sayed","date":"June 25, 2023","format":false,"excerpt":"MS SQL Server Dynamic SQl, T-SQL Mostly: Dynamic SQL Stored Procedure Trigger Cursor Function Sayed Ahmed What are the Most Important Most Used Design ERD Convert ERD to database Normalization Indexing SQL Stored Procedure Dynamic SQL These will come, not too frequent Function, User Defined Data Types, Temporary Table Trigger,\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":70089,"url":"http:\/\/bangla.sitestree.com\/?p=70089","url_meta":{"origin":65942,"position":4},"title":"PHP SQL Server Stored Procedure #16","author":"Author-Check- Article-or-Video","date":"August 25, 2021","format":false,"excerpt":"\/* prepare the statement resource *\/$stmt=mssql_init(\"your_stored_procedure\", $conn);\/* now bind the parameters to it *\/mssql_bind($stmt, \"@id\", $id, SQLINT4, FALSE);mssql_bind($stmt, \"@name\", $name, SQLVARCHAR, FALSE);mssql_bind($stmt, \"@email\", $email, SQLVARCHAR, FALSE); \/* now execute the procedure *\/$result = mssql_execute($stmt); Another Example $conn = mssql_connect($db_host,$db_user,$db_password);if ($conn===false){ echo 'Cannot connect.'; exit;} if (mssql_select_db(\"YourDatabase\",$conn) === false) { echo\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26830,"url":"http:\/\/bangla.sitestree.com\/?p=26830","url_meta":{"origin":65942,"position":5},"title":"DBResults.java: Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways #Programming Code Examples #Java\/J2EE\/J2ME #JDBC","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"# DBResults.java Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways: * ResultSet doesn?t necessarily have all the data; reconnection to database occurs as you ask for later rows. * This class stores results as strings, in arrays. * This class includes DatabaseMetaData\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65942"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65942\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65942"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}