473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

JDBC caching plpgsql function errors?

Hey all - my inaugural post,

I have a Java web application on Tomcat 5 using pg73jdbc3.jar to connect to
PostgreSQL 7.3.4 running on the same server (Red Hat Linux [8.0, I think]).

I have a Perl script that drops the database and rebuilds it with all of our
table/function/etc. scripts. This ran without any errors - all the
functions, tables, etc. were created successfully.

While testing the web application, one of the functions returned a syntax
error. I went in using the psql command-line utility to fix the function
manually, and this worked - I could then call the function successfully via
the command-line ("SELECT foo(bar);").

However - and here's my problem - when testing the web application again, I
still got the SQLExceptioned syntax error, even though the function was
fixed.

Some more curiosities:

If I shut down Postgres and Tomcat, and then restart them, the
problem is still there.

If I shut down Postgres, and test the web application, I get the
expected "Connection could not be established". Then, when restarting
Postgres, I still get the syntax error message.

If I copy the function "foo", rename it as "foo2", and then have
the web application use "foo2" instead of "foo", then it works perfectly.

It would seem some sort of caching is going on, and it persists beyond
shutting Tomcat and Postgres down. Further, it would seem that it has
something to do with JDBC (I'm using PreparedStatement, by the way), or
Tomcat's connection-pooling mechanism, since if I run the very same SQL
statements directly via the psql console, the functions to not return an
error.

Anyone have any ideas? I /think/ I worked around this same problem a few
months ago by restarting the server, but clearly I shouldn't have to do that
every time I modify a function.

Thank you!

Jim Steinberger

Dynamic Edge, Inc.
Nov 23 '05 #1
6 1883

On 30/04/2004 17:34 Jim Steinberger wrote:
[snip]
Anyone have any ideas? I /think/ I worked around this same problem a few
months ago by restarting the server, but clearly I shouldn't have to do
that
every time I modify a function.


Are you storing anything in session scope which might cause the function
to be cached?
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

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

Nov 23 '05 #2

On 30/04/2004 17:34 Jim Steinberger wrote:
[snip]
Anyone have any ideas? I /think/ I worked around this same problem a few
months ago by restarting the server, but clearly I shouldn't have to do
that
every time I modify a function.


Are you storing anything in session scope which might cause the function
to be cached?
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

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

Nov 23 '05 #3
[snip]
Are you storing anything in session scope which might cause the function
to be cached?

No -- when the SUBMIT button is pressed, a bean is instantiated, the bean's
properties are set based on the HTML form, and then the bean's "insert"
method is called. The "insert" method gets a connection from Tomcat's
connection pool, uses it to create a PreparedStatement, and then uses the
bean's properties to set the PreparedStatement's parameters. It executes
the statement, and finally closes the PreparedStatement and then the
Connection (in a finally { } block) before leaving the method.

So, nothing's being stored in the session -- the bean, PreparedStatement,
and Connection objects are all created and destroyed/closed in the scope of
the request.
However, it is possible that each request is using the same database
connection, since each request closes the connection it used, returning the
connection to Tomcat's connection pool. Even if the connection is the same,
however, the specific PreparedStatement should have gone away when it was
closed, shouldn't it have? And even if it cached the PreparedStatement,
why/how would it be able to cache Postgres's response to it?
So confused,
Jim
-----Original Message-----
From: pg*****************@postgresql.org
[mailto:pg*****************@postgresql.org] On Behalf Of Paul Thomas
Sent: Friday, April 30, 2004 2:01 PM
To: Jim Steinberger
Cc: pgsql-general @ postgresql . org
Subject: Re: [GENERAL] JDBC caching plpgsql function errors?
On 30/04/2004 17:34 Jim Steinberger wrote:
[snip]
Anyone have any ideas? I /think/ I worked around this same problem a few
months ago by restarting the server, but clearly I shouldn't have to do
that
every time I modify a function.


Are you storing anything in session scope which might cause the function
to be cached?
--
Paul Thomas
+------------------------------+--------------------------------------------
-+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+--------------------------------------------
-+

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

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

http://archives.postgresql.org

Nov 23 '05 #4
[snip]
Are you storing anything in session scope which might cause the function
to be cached?

No -- when the SUBMIT button is pressed, a bean is instantiated, the bean's
properties are set based on the HTML form, and then the bean's "insert"
method is called. The "insert" method gets a connection from Tomcat's
connection pool, uses it to create a PreparedStatement, and then uses the
bean's properties to set the PreparedStatement's parameters. It executes
the statement, and finally closes the PreparedStatement and then the
Connection (in a finally { } block) before leaving the method.

So, nothing's being stored in the session -- the bean, PreparedStatement,
and Connection objects are all created and destroyed/closed in the scope of
the request.
However, it is possible that each request is using the same database
connection, since each request closes the connection it used, returning the
connection to Tomcat's connection pool. Even if the connection is the same,
however, the specific PreparedStatement should have gone away when it was
closed, shouldn't it have? And even if it cached the PreparedStatement,
why/how would it be able to cache Postgres's response to it?
So confused,
Jim
-----Original Message-----
From: pg*****************@postgresql.org
[mailto:pg*****************@postgresql.org] On Behalf Of Paul Thomas
Sent: Friday, April 30, 2004 2:01 PM
To: Jim Steinberger
Cc: pgsql-general @ postgresql . org
Subject: Re: [GENERAL] JDBC caching plpgsql function errors?
On 30/04/2004 17:34 Jim Steinberger wrote:
[snip]
Anyone have any ideas? I /think/ I worked around this same problem a few
months ago by restarting the server, but clearly I shouldn't have to do
that
every time I modify a function.


Are you storing anything in session scope which might cause the function
to be cached?
--
Paul Thomas
+------------------------------+--------------------------------------------
-+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+--------------------------------------------
-+

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

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

http://archives.postgresql.org

Nov 23 '05 #5
Hello,

How can i do to change, with security, my all database and records fromMySQL to PostgreSQL. Can Anybody help me??

Grettings
Kilmer Cruz
Nov 23 '05 #6
Hello,

How can i do to change, with security, my all database and records fromMySQL to PostgreSQL. Can Anybody help me??

Grettings
Kilmer Cruz
Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bogachkov | last post by:
Hello Joe Over the past several years, I have found your responses to jdbc usage/driver related issues to be extremely helpful. I am sure that you're very busy so I will make my question as...
6
by: Martin Marques | last post by:
We are trying to make some things work with plpgsql. The problem is that I built several functions that call one another, and I thought that the way of calling it was just making the assign: ...
1
by: Praveen | last post by:
Hi, I have installed WebSphere Portal on AIX and connected to DB2 on a remote machine, Getting the followin errors when trying to get the values from database thru applications installed on...
6
by: bill.postgresql-users | last post by:
What's the best way to ease development of plpgsql. My largest issues with plpgsql pertain to the quoting of course. Bill McMilleon ---------------------------(end of...
10
by: lnd | last post by:
After copied pg database from one PC to another -I could not find plpgsql function(s) in the copied database. -had to instal plpgsql language handler again -whilst tables and data moved...
14
by: Karl O. Pinc | last post by:
Hi, Thought perhaps some other eyes than mine can tell if I'm doing something wrong here or if there's a bug somewhere. I've never passed a ROWTYPE varaible to a function but I don't see where...
0
by: Jim Steinberger | last post by:
Hey all - my inaugural post, I have a Java web application on Tomcat 5 using pg73jdbc3.jar to connect to PostgreSQL 7.3.4 running on the same server (Red Hat Linux ). I have a Perl...
9
by: Karl O. Pinc | last post by:
I want to return multiple values, but not a set, only a single row, from a plpgsql function and I can't seem to get it to work. (I suppose I'd be happy to return a set, but I can't seem to make...
1
by: Karl O. Pinc | last post by:
FYI, mostly. But I do have questions as to how to write code that will continue to work in subsequent postgresql versions. See code below. begintest() uses EXIT to exit a BEGIN block from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.