Ask a Question related to Coldfusion Database Access, Design and Development.
-
rchinoy #1
Programmatically disable DSN
Hi all,
I have a CF MX 6.1 app that accesses an AS/400 DB2 database, but I need to
make sure ColdFusion disconnects from DB2 at a particular time so a backup can
proceed. I found the following code that is supposed to do this:
<cflock name="serviceFactory" type="exclusive" timeout="10">
<cfscript>
factory = CreateObject("java", "coldfusion.server.ServiceFactory");
ds_service = factory.datasourceservice;
dsources = ds_service.datasources;
dsources["your_dsn"]["disable"] = "Yes/No";
ds_service.restart();
</cfscript>
</cflock>
However, when I test this against a MySQL DSN (after plugging in my DSN name
and using the "Yes" option) and monitor the MySQL connections, it does not
appear that it's breaking the CF-maintained connection.
Anyone have any ideas?
Thanks,
Russ
rchinoy Guest
-
programmatically creating a cf5 dsn
Hello, I was curious if there was a way to programmatically create a coldfusion dsn for a ms sql 2000 database using coldfusion 5.0 code? i have... -
programmatically add DSN
How can I access a db without first registering in CF Administrator datasources? Can I programmatically (like asp) create a datasource in the .cfm... -
How to disable copy/past (selectable='disable') fromTextArea
How to disable copy/past and text selection ability from TextArea? <mx:Text has a nice selectable='false' propertie, but TextAre hasn't. Very,... -
Saving A PDF as a PNG Programmatically
I need to save PDFs as BMP files, scaled down in size. The closest thing I found was PDFtoIMG, but it crops the right edge and the bottom edge. I... -
Disable impersonation programmatically?
Hi, I have an issue with Indexing service and impersonation, namely that Indexing service do not work properly with <identity... -
Dan Bracuk #2
Re: Programmatically disable DSN
Are you not able to do this at the database end? The way we deal with this is:
1. make the database unavailable when required using database methods.
2. In Cold Fusion, test the database for availability before attempting to
use it. Using Oracle as an example
<cftry>
<cfquery>
select sysdate from dual
</cfquery>
<cfset ok = true>
<cfcatch>
<cfset ok = false>
</cftry>
<cfif ok>
run your page
<cfelse>
explain why not
</cfif>
Dan Bracuk Guest



Reply With Quote

