Can't create a Procedure or Function from within Java??
Posted by: Tony Galiano
Date: December 20, 2005 02:16PM

I am trying to create a procedure/function from within my java code.

Whenever I try to execute the Create Procedure or Function I always get an error.

For example...

I have the following Java String that contains the creation of the function "hello"


String sql = "

DELIMITER $$

DROP FUNCTION IF EXISTS `hello`$$
CREATE FUNCTION `toUpper`(s CHAR(20)) RETURNS char(50)


RETURN UPPER(s);


DELIMITER ; ";


This is just a dummy function trying to illustrate my problem.

Now let's say I want to execute this SQL against a MYSQL 5.0 Server using the following code:


ConnectionManager poolMan = ConnectionManager.getInstance();
con = poolMan.getConnection(ds);

st = con.createStatement();
st.setQueryTimeout(m_queryTimeout);

return st.execute(sql);

Then I get an error... Am I calling the right method to execute this SQL or is there anything I am missing?

Thank you.


Tony.



Edited 1 time(s). Last edit at 12/20/2005 02:16PM by Tony Galiano.

Options: Reply• Quote


Subject
Written By
Posted
Can't create a Procedure or Function from within Java??
December 20, 2005 02:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.