This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes CallableStatement PostgreSQL Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "CallableStatement PostgreSQL Error" Watch "CallableStatement PostgreSQL Error" New topic
Author

CallableStatement PostgreSQL Error

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi All,
Im trying to write sample stored functions in postgresql and call them using the CallableStatement offered by JDBC.

Here's some my test code

And my Stored function is of the form .


However, I'm getting the following error when I try to run the code .


Any idea on why this is happening would be appreciated.


Learning and Learning!-- Java all the way!
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Anyone ? Im kinda stuck with this
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20128
    
  30

I'm only guessing here, but I don't think it's possible to call a function like it was a stored procedure. In MS SQL Server it's certainly not allowed. Try calling it like this:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3719
    
  61

Rob Spoor wrote:I'm only guessing here, but I don't think it's possible to call a function like it was a stored procedure. In MS SQL Server it's certainly not allowed.

It should work. It definitely works in Oracle. Actually, this is why escaping (the curly braces) must be used, it allows the JDBC driver to rewrite and process the query as required by its database.

However, your advice is certainly worth to try, if the direct call doesn't work with MS SQL, other databases might be affected too.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CallableStatement PostgreSQL Error
 
jQuery in Action, 3rd edition