Greg's Blog

helping me remember what I figure out

Flushing Db Connections

| Comments

In CF4.5 there used to be a useful function for terminating database connections (which I used most frequently in connection with MS Access databases): cfusion_dbconnections_flush() However in CFMX 6 this (un-documented) function disappeared. Someone on the CFDJlist asked how you could now achieve the same result. Simon Horwith pointed to the service factory and it was Ray Thompson who kindly provided an example: [code] factory = CreateObject(“java”, “coldfusion.server.ServiceFactory”); ds_service = factory.datasourceservice; dsources = ds_service.datasources; dsources[“yourDSN”][“disable”] = “Yes”; ds_service.restart(); [/code]

Comments