[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Prepared Statement Problem

Posted on 2004-10-28
Medium Priority
Last Modified: 2012-06-27
Hello, I'm having a problem where PostgreSQL tells that a prepared statement already exists.  The trouble is that I don't use prepared statements.  Basically I'm developing a 3 tier system.  It uses .Net remoting.  I keep getting the error Prepared Statement already exists until I shut down the remote component.  That makes since seeing as the clear when the session closes.

Why am I getting this error when I'm not using prepared statements, and how can I stop it?

Thanks in advance.
Question by:Guitarman316
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 22

Expert Comment

by:earth man2
ID: 12449287
What is .Net remoting ?
LVL 22

Assisted Solution

by:earth man2
earth man2 earned 250 total points
ID: 12454542
OK .Net Remoting is DCE/DCOM in $Soft new .net framework.  Need more detail of your implementation to replicate this problem.

Author Comment

ID: 12463441
Well, Before I discuss the implementation let me say, I found Friday that if I add something random to the end of my fields like Select *, TimeStamp as Random from table where whatever that the problem mysteriously goes away.  It seems as though PostgreSQL is trying to cache the statement.  I also found that when I got the error "Prepared Statement 'PRSTMT1182451640138' Already Exists"  That if I trapped for it, stripped off everything except the statement name and then tried to deallocate that statement it would say that the statement wasn't found.  The versions of PostgreSQL I'm using are 7.4.5 and 8.0 beta2.  The problem happens on both of them.

As far as the remoting goes here's basically the way it is set up.

1) There are 3 PC's involved.  1 for client code 1 for remote component (middle tier) and 1 for database server.
2) The remote component is setup as SingleCall using MarshalByRefObject and a TCP channel for performance.
3) In addition to the remote components dll I have a dll that handles security.  This is the first place it bombs.  If security class is removed it will bomb elsewhere with same issue.
4) The remote component is setup such that each method requires security validation before any work is done.  The component is targeted potentially at the internet.  For this reason sometimes multiple calls occur where the sql statement looks the same.  The remote component uses Core Labs PostgreSQL dataadapter.
5) The remote component is then insantiated from the client and calls to the db occur from PC number 2 with datasets or affected row counts being returned to the client pc.

The only way to clear the problem once it has occured is to physically stop the remote components host and restart it.

If you need any further information please let me know.

Thanks for the help.
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.


Accepted Solution

rjkimble earned 250 total points
ID: 12464397
If you think it's a PostgreSQL problem, I'm sure they'd appreciate a bug report.

Could it be that the driver you're using is creating the prepared statement behind the scenes? Maybe it's a driver issue.

Author Comment

ID: 12464812
I just recieved an email from Core Labs to try a new driver.  It appears that that has fixed the problem.  I didn't want to send in a bug report on PostgreSQL until I was sure that it was the problem.  I know I'm not to fond of unfounded bug reports.  Also I tried to duplicate it this morning with PgAdmin3.  I ran the exact same statement over and over and never got the error.

Thanks for the help.
LVL 22

Expert Comment

by:earth man2
ID: 12464854
My gut feeling is it must be a Core Labs Issue.
What is the content of  your postgres database log file.  If it is a database problem the log file should show the error.

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question