First, you must connect to the database. Private Static connection conn; static {// Step 1: load the driver try {class. forname ("oracle. JDBC. driver. oracledriver "); // obtain the connection object conn = drivermanager. getconnection ("JDBC: oracle: thin :@ localhost: 1521: orcl", "Scott", "Scott");} catch (classnotfoundexception E) {// todo auto-generated catch blocke. printstacktrace ();} catch (sqlexception e) {// todo auto-generated catch blocke. printstacktrace () ;}} instance 1: [Create or rep Export procedure selectemp (emp_no in number, ename out varchar2, job out varchar2, Sal out number, deptno out number) isbeginselect ename, job, Sal, deptno into ename, job, Sal, deptno from EMP where empno = emp_no; end selectemp;] // call the Stored Procedure public static void procedure () throws sqlexception {// create the callablestatement parameter in out by passing the callablestatement CAS = conn through a placeholder. preparecall ("{call selectemp (?,?,?,?,?)} "); // Int Index = 1 from 1; // assign CAs to the placeholder. setint (index ++, 7369); // the value assigned is the input parameter // The output parameter CAS. registeroutparameter (index ++, Oracle. JDBC. oracletypes. varchar); CAS. registeroutparameter (index ++, Oracle. JDBC. oracletypes. varchar); CAS. registeroutparameter (index ++, Oracle. JDBC. oracletypes. number); CAS. registeroutparameter (index ++, Oracle. JDBC. oracletypes. number); // execute the operation based on the passed parameter value. If the first result is a resultset object, true is returned. If the first result is an update count or no Returns falseboolean flag1_cas.exe cute (); system. Out. println (FLAG); If (! Flag) {// string ename = CAS. getstring (2); string job = CAS. getstring (3); int sal = CAS. getint (4); int deptno = CAS. getint (5); system. out. println (ename); system. out. println (job); system. out. println (SAL); system. out. println (deptno);} instance 2: [declare a stored procedure create or replace package emppackage istype empcursor is ref cursor; Procedure selectemps (emplist out empcursor); End emppackage; package body: Create or replace package body EMP Package isprocedure selectemps (emplist out empcursor) isbeginopen emplist for select * from EMP; end emppackage;] public static void testprocedure () throws sqlexception {// create the callablestatement parameter in out by passing the callablestatement CAS = conn through a placeholder. preparecall ("{call emppackage. selectemps (?)} "); // Int Index = 1 from 1; // assign CAs to the placeholder. registeroutparameter (index ++, Oracle. JDBC. oracletypes. cursor); // if the operation is returned Based on the passed parameter value, false indicates that there is nothing in it. If the return value is true, the returned resultset result set Boolean flag1_cas.exe cute (); system. out. println (FLAG); // oraclecallablestatement is the object of the stored procedure in Oracle. // The getcursor method in the call returns the resultset result set resultset rs = (oraclecallablestatement) CAS ). getcursor (1); While (RS. next () {system. out. println (RS. getint (1 ));}}