Home > Archive > PostgreSQL JDBC > March 2005 > jdbc/callable statment error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author jdbc/callable statment error
fake@dusk.homelinux.org

2005-03-30, 9:42 am

When executing the following statments from netbeans 4.1 sun app server 8.1

CallableStatement proc = con.prepareCall("{ ? = call test_function ( ? ) }");
proc. registerOutParameter
(1, Types.BOOLEAN);
proc.setString(2, "testthis");
proc.execute();

This shows up in my server log.

LOG: statement: select * from test_function ( 'thisTest' ) as result;
ERROR: function test_function("unknown") does not exist
HINT: No function matches the given name and argument types. You may need to add explicit type casts.


And I get an exception from my app server that states "No function" etc, etc...

Now, if I cut and paste that into my psql terminal it appears to work... So I'm really curious as to why it doesn't work through jdbc...

Couple of things: I'm getting my connection through a connection pool on my app server and that appears to be in working order...

Any suggestions?


Gary Lucas

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

fake@dusk.homelinux.org

2005-03-30, 9:42 am

And now that I think of it, I'm useing postgres 7.4

Not sure how relevant that is,

Gary


On Wed, Mar 30, 2005 at 01:16:47AM -0800, fake@dusk.homelinux.org wrote:
> When executing the following statments from netbeans 4.1 sun app server 8.1
>
> CallableStatement proc = con.prepareCall("{ ? = call test_function ( ? ) }");
> proc. registerOutParameter
(1, Types.BOOLEAN);
> proc.setString(2, "testthis");
> proc.execute();
>
> This shows up in my server log.
>
> LOG: statement: select * from test_function ( 'thisTest' ) as result;
> ERROR: function test_function("unknown") does not exist
> HINT: No function matches the given name and argument types. You may need to add explicit type casts.
>
>
> And I get an exception from my app server that states "No function" etc, etc...
>
> Now, if I cut and paste that into my psql terminal it appears to work... So I'm really curious as to why it doesn't work through jdbc...
>
> Couple of things: I'm getting my connection through a connection pool on my app server and that appears to be in working order...
>
> Any suggestions?
>
>
> Gary Lucas
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Dave Cramer

2005-03-30, 9:42 am

What do the logs say when you excecute this from psql ?

Dave

fake@dusk.homelinux.org wrote:

>When executing the following statments from netbeans 4.1 sun app server 8.1
>
>CallableStatement proc = con.prepareCall("{ ? = call test_function ( ? ) }");
>proc. registerOutParameter
(1, Types.BOOLEAN);
>proc.setString(2, "testthis");
>proc.execute();
>
>This shows up in my server log.
>
>LOG: statement: select * from test_function ( 'thisTest' ) as result;
>ERROR: function test_function("unknown") does not exist
>HINT: No function matches the given name and argument types. You may need to add explicit type casts.
>
>
>And I get an exception from my app server that states "No function" etc, etc...
>
>Now, if I cut and paste that into my psql terminal it appears to work... So I'm really curious as to why it doesn't work through jdbc...
>
>Couple of things: I'm getting my connection through a connection pool on my app server and that appears to be in working order...
>
>Any suggestions?
>
>
>Gary Lucas
>
>---------------------------(end of broadcast)---------------------------
>TIP 8: explain analyze is your friend
>
>
>
>


--
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Charl Gerber

2005-03-30, 9:42 am

After experiencing something similar, I read somewhere
that CallableStatement's shouldn't be used pre-8.0. I
think someone posted on a message board or something.

I changed all my java code to call my functions as
PreparedStatements:

ps = con.prepareStatement("select myFunction(?,?)")
ps.setBoolean(1, true);
ps.setInt(2, 198);
etc.

And it worked fine from there on.



--- fake@dusk.homelinux.org wrote:
> And now that I think of it, I'm useing postgres 7.4
>
> Not sure how relevant that is,
>
> Gary
>
>
> On Wed, Mar 30, 2005 at 01:16:47AM -0800,
> fake@dusk.homelinux.org wrote:
> netbeans 4.1 sun app server 8.1
> call test_function ( ? ) }");
> 'thisTest' ) as result;
> exist
> argument types. You may need to add explicit type
> casts.
> states "No function" etc, etc...
> terminal it appears to work... So I'm really curious
> as to why it doesn't work through jdbc...
> through a connection pool on my app server and that
> appears to be in working order...
> broadcast)---------------------------
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com