Skip navigation
Currently Being Moderated

Could not find prepared statement with handle 1.

Aug 2, 2012 9:05 AM

Tags: #cfquery #prepared #cfqueryparam

[Macromedia][SQLServer JDBC Driver][SQLServer]Could not find prepared statement with handle 1.


I'm getting this error message in what appear to be random ways. The first time I look at a page I might not get it, but the second time I might. I discovered that removing a cfqueryparam tag worked, but that is not really a safe solution. I checked that the cf_sql_type matched the database field, and in one case changed a cf_sql_varchar to a cf_sql_char so it would match a SQL Server nchar(10) field. But still these errors. Any ideas? I've not had any luck Googling this.


I should add that I'm running Coldfusion 9 as a Tomcat webapp on a Linux server. The database is SQL Server 2005, I think.

  • Currently Being Moderated
    Aug 2, 2012 9:09 AM   in reply to dcoli

    hard to say without looking at your code.  However, since you mentioned cfqueryparam, maybe you are sending an empty string without specifying null="true" or something like that.

    Mark as:
  • Currently Being Moderated
    Sep 14, 2012 6:40 AM   in reply to dcoli

    Just to let you know that you are not crazy, I have had the same issue in CF9 (standard Windows install) with SQL Server 2005.  I also have not found a solution, and in all cases I have had to remove the <cfqueryparam> tag.  Restarting CF (or, alternately, restarting SQL Server) solves the problem temporarily, but after a few days it always comes back.


    If you come across a solution, please update this post!

    Mark as:
  • Currently Being Moderated
    Oct 8, 2012 6:43 AM   in reply to ElLocoGatoCF

    I had the same problem due to a query that errored then all subsequent queries would error as well with this error message


    I found this blog post regarding this issue:


    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points