Please forgive me, but this is more of a JDBC type question than EJB, but it's JDBC from within an EJB :-)
There is a stored procedure on the database I'm using called GETDATE() which, remarkably enough, gets the current date & time.
How do I access this from within a prepared statement using parameter transformation?
I want to do the equivelent of:-
INSERT INTO table1 (cuurent_date) VALUES (?)
And replace the '?' with GETDATE()
For strings I use setString, for int I use setInt, what do I use for Stored procedures?
Cheers,
Rick
-
EJB/JDBC/Stored Procedure (3 messages)
- Posted by: Richard Kenyon
- Posted on: April 05 2001 09:15 EDT
Threaded Messages (3)
- EJB/JDBC/Stored Procedure by Kiran Patchigolla on April 05 2001 16:39 EDT
- EJB/JDBC/Stored Procedure by Somil Nanda on April 05 2001 20:12 EDT
- EJB/JDBC/Stored Procedure by Richard Kenyon on April 06 2001 02:46 EDT
-
EJB/JDBC/Stored Procedure[ Go to top ]
- Posted by: Kiran Patchigolla
- Posted on: April 05 2001 16:39 EDT
- in response to Richard Kenyon
String sName = "PACKAGENAME.GETDATE()";
"INSERT INTO table1 (cuurent_date) VALUES ('"+sName+"') ";
However, you cannot use stored procedure in a sql statement. You could use functions instead.
-
EJB/JDBC/Stored Procedure[ Go to top ]
- Posted by: Somil Nanda
- Posted on: April 05 2001 20:12 EDT
- in response to Richard Kenyon
use callableStatement to call a stored Procedure
something like
CallableStatement cs = con.prepareCall("{call Whatever(?,?)}");
cs.setString(1,"something");
cs.setInt(2,99); -
EJB/JDBC/Stored Procedure[ Go to top ]
- Posted by: Richard Kenyon
- Posted on: April 06 2001 02:46 EDT
- in response to Somil Nanda
Thanks to both of you!
Cheers,
Rick