Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2006, 03:06 PM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default calling an oracle procedure from a jsp page

I'm just getting into jsp pages and are having a bit of trouble calling an oracle-stored procedure. I've managed to do an insert by putting the sql in the page but I'd prefer to do it via a stored procedure. So can anyone help me?

I'm running tomcat 5.5.16 with oracle 9i hope this enough info for you

Thanks Jason

<%
Connection dbconn;
ResultSet rs;
PreparedStatement sql;
try
{
Class.forName("oracle.jdbc.OracleDriver");
try
{
boolean doneheading = false;
dbconn = DriverManager.getConnection("jdbc:oracle:thin:@tes tdtb:25005:testdtb","tuser","waikato");
sql = dbconn.prepareStatement("insert into tmp_a insert into tmp_a (field_1,field_2,field_3,field_4) values ('a','b','c','d') ");
rs = sql.executeQuery();
sql.close();
rs.close();
dbconn.close();
}
catch (SQLException s)
{
out.println(s.toString());
}
}
catch (ClassNotFoundException err)
{
out.println("Class loading error");
}
%>

from sqlplus I can
execute xtest_procedure ('a','b','c','d')
to do the same thing.
How do you execute the procedure from the jsp page?

procedure syntax
CREATE OR REPLACE PROCEDURE xtest_procedure
(
pfiled_1 IN tmp_a.filed_1%TYPE,
pfiled_2 IN tmp_a.filed_2%TYPE,
pfiled_3 IN tmp_a.filed_3%TYPE,
pfiled_4 IN tmp_a.filed_4%TYPE
) IS
BEGIN
insert into tmp_a
(field_1,field_2,field_3,field_4)
values
(pfield_1,pfield_2,pfield_3,pfield_4);
END xtest_procedure;
/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Oracle Stored Procedure using Linked Serve Twinklestar SQL Server 2000 4 September 23rd, 2009 04:02 AM
Calling bean from jsp page madhavaram123 JSP Basics 6 May 10th, 2006 09:15 PM
Calling an Oracle Stored Procedure booksnore2 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 October 1st, 2004 09:35 AM
Calling stored procedure from ASP page niravp SQL Server ASP 7 March 19th, 2004 07:40 PM
CALLING ORACLE SELECT PROCEDURE danielwajnberg Oracle 1 November 20th, 2003 09:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.