This probably isn't supported by Macromedia but it appears to work:

<cfset datasource = "quickstart" />
<cfset connection = createObject("java",
"coldfusion.server.ServiceFactory").getDataSourceService().getDatasource(datasource).getConnection())
/>
<cfdump var="#connection#" />
<cfset connection.close() />


On 10/25/05, Barney Boisvert <[EMAIL PROTECTED]> wrote:
> I was actually thinking about one step further, where you actually get
> the connection from CF's pool, rather than just the connection info.
> So you let CF take care of everything (as it does normally), except
> that you have complete control over the connection rather than letting
> CF manage it.  And really, my greater hope would be for that
> functionality on BD, because it'd alleviate some of the
> transaction-related issues it has (not bugs, per se, just
> implementation details that prevent certain solutions from working).
> But if it worked cross platform (with a check for the server to tell
> how to get the connection, of course), that'd be the best scenario.
>
> cheers,
> barneyb
>
> On 10/25/05, Doug Arthur <[EMAIL PROTECTED]> wrote:
> > Just to slightly modify what I've already done, is this what you're
> > refereing to Barney?
> >
> > The only downside is that since the password is encrypted in the structure,
> > the password would still have to be supplied.
> >
> > <cffunction name="dump">
> >     <cfdump var="#Arguments[1]#">
> > </cffunction>
> > <cfscript>
> >     namedDatasource = "db";
> >     password = "password";
> >
> >
> >     ServiceFactory = CreateObject("java",
> > "coldfusion.server.ServiceFactory");
> >     datasources =
> > ServiceFactory.getDataSourceService().getDatasources();
> >
> >     if(StructKeyExists(datasources, namedDatasource))
> >         dataSourceStruct = StructFind(datasources, namedDatasource);
> >
> >
> >     try {
> >      Class =
> > createObject("java","java.lang.Class").forName(dataSourceStruct.class);
> >      DriverManager = createObject("java", " java.sql.DriverManager");
> >      conn = DriverManager.getConnection(dataSourceStruct.url,
> > dataSourceStruct.username, password);
> >      stmt = conn.createStatement();
>
>
> --
> Barney Boisvert
> [EMAIL PROTECTED]
> 360.319.6145
> http://www.barneyb.com/
>
> Got Gmail? I have 100 invites.
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to 
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the 
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
> (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[email protected]
>
>
>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to