pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
jdbc/callable statment error
5+ messages / 3 participants
[nested] [flat]

* jdbc/callable statment error
@ 2005-03-30 09:16 fake@dusk.homelinux.org
  2005-03-30 09:55 ` Re: jdbc/callable statment error fake@dusk.homelinux.org
  2005-03-30 11:10 ` Re: jdbc/callable statment error Dave Cramer <pg@fastcrypt.com>
  0 siblings, 2 replies; 5+ messages in thread

From: fake@dusk.homelinux.org @ 2005-03-30 09:16 UTC (permalink / raw)
  To: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: jdbc/callable statment error
  2005-03-30 09:16 jdbc/callable statment error fake@dusk.homelinux.org
@ 2005-03-30 09:55 ` fake@dusk.homelinux.org
  1 sibling, 0 replies; 5+ messages in thread

From: fake@dusk.homelinux.org @ 2005-03-30 09:55 UTC (permalink / raw)
  To: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: jdbc/callable statment error
  2005-03-30 09:16 jdbc/callable statment error fake@dusk.homelinux.org
@ 2005-03-30 11:10 ` Dave Cramer <pg@fastcrypt.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Dave Cramer @ 2005-03-30 11:10 UTC (permalink / raw)
  To: fake@dusk.homelinux.org; +Cc: pgsql-jdbc

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: jdbc/callable statment error
@ 2005-03-30 14:44 Charl Gerber <charlgerber@yahoo.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Charl Gerber @ 2005-03-30 14:44 UTC (permalink / raw)
  To: fake@dusk.homelinux.org; pgsql-jdbc

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:
> > 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
> 



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: jdbc/callable statment error]
@ 2005-03-30 18:51 fake@dusk.homelinux.org
  0 siblings, 0 replies; 5+ messages in thread

From: fake@dusk.homelinux.org @ 2005-03-30 18:51 UTC (permalink / raw)
  To: pgsql-jdbc

Ok,  so issue was wrong database name.

Have since gotten callable statements working,  

some caveats:

Sun Application server:

 while it's much better then tomcat still has some flakiness issues... 
It seems that about every 10th restart or so it locks up and won't load/unload my app.  

And that wasn't the only thing...  
Also,  after noticing that my callable statments were hanging at the server I restarted and with no changes to the code everything started "magically" working fine...

Thanks all,
Gary


----- Forwarded message from Dave Cramer <pg@fastcrypt.com> -----

Date: Wed, 30 Mar 2005 14:12:45 -0500
From: Dave Cramer <pg@fastcrypt.com>
Reply-To: pg@fastcrypt.com
Organization: Postgres International
User-Agent: Mozilla Thunderbird 1.0 (X11/20041206)
X-Accept-Language: en-us, en
To: fake@dusk.homelinux.org
Subject: Re: [JDBC] jdbc/callable statment error
In-Reply-To: <20050330180708.GA18364@dusk.homelinux.org>

Can you do me a favour and forward this to the list, might as well let 
your learning experience help everyone else.

Dave

fake@dusk.homelinux.org wrote:

>Indeed that was my problem...  I was specifying databasename as bank when 
>in fact it should have been bankDB... There was some sort of default db 
>under bank that had nothing in it...
>
>I'll consider it a learning experience and thanks for your time.
>
>Gary
>
>
>On Wed, Mar 30, 2005 at 12:08:08PM -0500, Dave Cramer wrote:
> 
>
>>Well, the only thing I can think of is that you aren't connecting to the 
>>same database.
>>
>>is that possible?
>>
>>Dave
>>
>>fake@dusk.homelinux.org wrote:
>>
>>   
>>
>>>LOG:  statement:  select * from  test_function ( 'thisTest' )  as result;
>>>DEBUG:  parse tree:
>>>DETAIL:  {QUERY :commandType 1 :querySource 0 :canSetTag true 
>>>:utilityStmt <>
>>>     :resultRelation 0 :into <> :hasAggs false :hasSubLinks false 
>>>     :rtable ({RTE
>>>     :alias {ALIAS :aliasname result :colnames <>} :eref {ALIAS 
>>>     :aliasname result
>>>     :colnames ("result")} :rtekind 4 :funcexpr {FUNCEXPR :funcid 18643
>>>     :funcresulttype 16 :funcretset false :funcformat 0 :args ({CONST 
>>>     :consttype
>>>     1043 :constlen -1 :constbyval false :constisnull false :constvalue 
>>>     12 [ 12 0 0
>>>     0 116 104 105 115 84 101 115 116 ]})} :coldeflist <> :inh false 
>>>     :inFromCl true
>>>     :checkForRead true :checkForWrite false :checkAsUser 0}) :jointree 
>>>     {FROMEXPR
>>>     :fromlist ({RANGETBLREF :rtindex 1}) :quals <>} :rowMarks () 
>>>     :targetList
>>>     ({TARGETENTRY :resdom {RESDOM :resno 1 :restype 16 :restypmod -1 
>>>     :resname
>>>     result :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk 
>>>     false} :expr
>>>     {VAR :varno 1 :varattno 1 :vartype 16 :vartypmod -1 :varlevelsup 0 
>>>     :varnoold 1
>>>     :varoattno 1}}) :groupClause <> :havingQual <> :distinctClause <> 
>>>     :sortClause
>>>     <> :limitOffset <> :limitCount <> :setOperations <> 
>>>     :resultRelations ()}
>>>
>>>DEBUG:  PortalRun
>>>LOG:  statement: insert into test_Table (user_id) VALUES ( $1 )
>>>CONTEXT:  PL/pgSQL function "test_function" line 5 at SQL statement
>>>DEBUG:  parse tree:
>>>etc,etc
>>>
>>>
>>>On Wed, Mar 30, 2005 at 06:10:13AM -0500, Dave Cramer wrote:
>>>
>>>
>>>     
>>>
>>>>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
>>>> 
>>>>
>>>>       
>>>>
>>>
>>>
>>>     
>>>
>>-- 
>>Dave Cramer
>>http://www.postgresintl.com
>>519 939 0336
>>ICQ#14675561
>>   
>>
>
>
> 
>

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

----- End forwarded message -----



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-03-30 18:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-30 09:16 jdbc/callable statment error fake@dusk.homelinux.org
2005-03-30 09:55 ` fake@dusk.homelinux.org
2005-03-30 11:10 ` Dave Cramer <pg@fastcrypt.com>
2005-03-30 14:44 Re: jdbc/callable statment error Charl Gerber <charlgerber@yahoo.com>
2005-03-30 18:51 Re: jdbc/callable statment error] fake@dusk.homelinux.org

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox