/  14
 
Calling Stored Procedure&FunctionsFrom Java
 
create or replace procedure test1 is begininsert INTO emp(empno,ename) VALUES (13, 'rahat');end;/
 
import java.sql.*;import java.util.*;public class Connect1 {public static void main(String argv[]) {Connection conn = null;Statement stmt;try {DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());conn = DriverManager.getConnection("jdbc:oracle:oci8:@","scott", "tiger");stmt=conn.createStatement();}catch(SQLException e ) {e.printStackTrace(); }CallableStatement cs;try{cs=conn.prepareCall("{call test1}");cs.execute();}catch(SQLException e ) {e.printStackTrace(); }}

Share & Embed

More from this user

Add a Comment

Characters: ...

dimz66left a comment

Simple and consice. Nice!