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

I got this error for the first time today, while trying to get a query working in ColdFusion 8.01. I'd defined some custom functions in SQL Server, and tested them out through the SQL Server Management Studio, but the datasource user didn't have the right permissions to use the queries. I added the permissions, reloaded the page and got smacked with the following error:

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

I found the solution on House of Fusion: restart your ColdFusion services. Something about the lack of permissions seems to catch in CF, and wont be released until you restart.



Brooks's Gravatar Just a quick note on this: Rather than restarting CF Services you can get the same effect by making a trivial change to the UDF and saving it.
Jon Hartmann's Gravatar @Brooks: Thanks for the note on that, I'll definitely try it if I have this problem again. Does this mean that the issue is related to CF caching the result of the function in some way?
brooks's Gravatar It's really hard to say as there are at least four layers of abstraction between a <cfquery> tag and the UDFs code (CFML --> Java --> JDBC --> SQL Engine).
Jon Hartmann's Gravatar @Brooks,

A coworker ran into an issue with MySQL today that looks like it might be a similar "caching" of permissions, and changes to the method didn't seem to cause any change in the results. I recommended that he try restarting the instance, but since this is a production machine, he had to wait for a little bit on that. Once he can restart it, I'll see if that clears it up and/or if it is a related issue.
David Hammond's Gravatar I just ran into this problem. I didn't want to restart ColdFusion either as I have a number of other sites running on the same server. What I did was make a change to the datasource and submit, so that the connection failed, then changed the datasource back and submitted. That seemed to clear up whatever cache was causing the problem. Thought I'd add that option to the list!
shane's Gravatar Thanks for the info, saved me some headache. "Object has been closed" isn't terribly specific.
Adam Tuttle's Gravatar Awesome, thanks for blogging this. Saved me hours of frustration, I'm sure!
Jon Hartmann's Gravatar Glad I could be of help!
Val Erb's Gravatar Thanks. I guess that was the first time I made a mistake in setting up a user - never saw that before until today.
Gareth Arch's Gravatar Thank you, thank you, thank you! It's been a fun night...added a datasource, forgot my admin password, changed the *wrong* datasource, spent an hour trying to figure out the password/add a user to SQL/login. This error would've topped everything off nicely. Quick restart and I'm back in :) Thanks again.
Helgi Hrafn Gunnarsson's Gravatar Thank you for the remedy!

It would be nice to have a real solution, though, that prevents this from happening. It's very uncomfortable knowing that this will happen at some point and not being able to do anything about it until there is already downtime. :/

But thanks, that worked for me, at least temporarily!
Jon Hartmann's Gravatar @Val, Gareth, and Helgi: Glad to be of help. I just wish there was a permanent solution for this as Helgi mentioned.
Sql Server JDBC Driver Download's Gravatar Wow!!! Thanks for sharing it. Its really helps for other peoples..

Keep it up :)
Fabian's Gravatar I had this issue come up after adding a new dbowner and using that account in the data source. All I had to do for the issue to go away is to add a space in my cfquery SELECT statement, so that created a new cached query. Much easier than restarting CF.
Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one. authenticjobs.com

Interested in becoming a sponsor? Contact me.