Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS-SQL/ColdFusion: Mysterious database error: Object has been closed

I'm using ColdFusion with Microsoft SQL Server 2005 and on occasion I get this error:

"[Macromedia][SQLServer JDBC Driver]Object has been closed."

The traceback invariably leads to an SQL query as one would expect, even simple SELECT commands with no JOINs or input parameters or anything fancy at all.

The only solution I've heard about so far is to restart "the service", which I can only imagine refers to the SQL Server service. I've tried restarting both the SQL Server and the ColdFusion Service, but it still keeps happening at random times.

(Also a restart isn't a solution. One cannot have arbitrary pages giving arbitrary error messages at arbitrary times in a production environment.)

When it occurs, it occurs persistently for a few minutes, then goes away and might come back in a few seconds or minutes. It started happening when I was developing a JavaScript portion of my application which should have nothing to do with either the ColdFusion code or the SQL commands.

My searches online have been fruitless so far.

Any help appreciated.

like image 623
Teekin Avatar asked Nov 02 '10 14:11

Teekin


2 Answers

This is old, but I just ran into this and found a way to do it without restarting CF.

In the ColdFusion Administrator go to your Data Sources and edit the one that's causing your problem. Make a change in it, like checking an unimportant box, and Submit.

This will reconfigure the connection and allow it to work. Go back in and un-tick the box (if you don't really want it ticked).

For example. I turned off "Enable High ASCII characters..." hit submit and the datasource worked. I then went back in and checked it back off and submit the changes again.

No restart! Ideal if this is a production box.

like image 76
Danomite Avatar answered Oct 15 '22 10:10

Danomite


We ran into this problem with CF9 and restarting the service didn't help. We deleted and recreated the offending DSN in the CF configuration, and that has resolved the issue. So if the other solutions don't work, give this a try.

like image 32
FlipperPA Avatar answered Oct 15 '22 09:10

FlipperPA