473,405 Members | 2,262 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,405 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 1889

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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.