Calling stored procedures using JDBC | ||||||||||||||||||||
The main aim of this example is to show a means of calling Oracle stored procedures from Java, passing and returning a mix of input and output parameters of various types, and handling the main output of the stored procedure as a resultset. The following shows a Java program calling a stored procedure contained within an Oracle PL/SQL package. The code uses Oracle's jdbc driver to connect to the database. This component is included in the Oracle installation and is installed in a subdirectory of the Oracle installation directory. For Oracle v8.1.5 the file is \Oracle\Ora81\jdbc\lib\classes111.zip, but the name and installation path may be different for later versions. The example was created and run with the JavaTM 2
Software Development Kit (SDK), Standard Edition Cut and paste the text from each of the text areas below. An easy way to do this is to click in the text area, use Ctrl-a to highlight all the text, then Ctrl-c to copy it to the clipboard.
|