I looking for a javajdbc pl/sql example. TIA, monty6 ------------------ We learn more from our mistake's than from our success's.
Multi Platform Database Developer & DBA on E.S.T.
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
I use JDBC with PL/SQL on Oracle 7 from time to time. Mostly you just build the PL/SQL as if it were SQL and send it using "executeQuery". What part of the process are you interested in?
I'm presently coding a gateway appliation using PRO*C C and Oracle 8i. I want to code the same gateway system in JAVA. Presently I am teaching myself pl/sql. I was wondering how hard it would be to exec pl/sql from within java using the oracle thin client driver. My plan is to run the application on my NT box. Connecting to a UNIX box running Oracle. I have already coded a sample application using the oracle thin client. I do not have any problem there using standard sql. If you have a small sample program that you could post.. it would be greatly appreciated. TIA, monty6
------------------ We learn more from our mistake's than from our success's.
ram menon
Greenhorn
Joined: Oct 24, 2000
Posts: 5
posted
0
Hi, This program calls a PL/SQL stored procedure which has got an OUT paramater. As U can see it is very simple to call PL/SQL from java. import java.sql.*; class PLSQL { public static void main (String args []) throws SQLException, ClassNotFoundException { // Load the driver Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database // You can put a database name after the @ sign in the connection URL. Connection conn = DriverManager.getConnection ("jdbc racle ci8:@", "scott", "tiger");
// Call a procedure with an OUT parameter { CallableStatement procout = conn.prepareCall ("begin my_proc(?); end;"); procout.registerOutParameter (1, java.sql.Types.BIGINT); procout.execute(); System.out.println ("Out argument is: " + procout.getLong(1)); }
// Close the connection conn.close(); } }
Hope this helps, Ram
Monty Ireland
Ranch Hand
Joined: Oct 03, 2000
Posts: 161
posted
0
thanks you this is what i was looking for... ------------------ We learn more from our mistake's than from our success's. a.k.a. monty6
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.