Skip to main content
Participant
July 25, 2008
Answered

Connecting to the Datasource in ColdFusion 8 vs CF 6

  • July 25, 2008
  • 2 replies
  • 563 views
Hi all,

I have a CF6 application that is running well. However, I'm in the process of upgrading to CF8, and some of the code no longer works. I've scoured the documentation and haven't found information on the replacement code.

My old code gets a datasource, acquires a database connection, uses the connection, and then closes the datasource.


variables.dsService = CreateObject("java", "coldfusion.server.ServiceFactory").DataSourceService;
variables.dsManager = dsService.getDman();
variables.dataSource = variables.dsManager.getDataSource(<data source name goes here>);
variables.dbConnection = variables.dataSource.getConnection();
<code to use the db connection goes here>
variables.dbConnection.close();

Under CF8, the error message is "The getDman method was not found." So I've been unable to find any code that will let me get access to an object that implements DataSource, so that I can use my connections.

Any advice would be appreciated.

Mike K.
This topic has been closed for replies.
Correct answer MKK2
I ultimately discovered that what I needed was pretty simple

variables.dsService = CreateObject("java", "coldfusion.server.ServiceFactory").DataSourceService;
variables.dataSource = variables.dsService.getDataSource(<data source name>);
variables.dbConnection = variables.dataSource.getConnection();
<use the datasource>
variables.dbConnection.close();

2 replies

MKK2AuthorCorrect answer
Participant
July 28, 2008
I ultimately discovered that what I needed was pretty simple

variables.dsService = CreateObject("java", "coldfusion.server.ServiceFactory").DataSourceService;
variables.dataSource = variables.dsService.getDataSource(<data source name>);
variables.dbConnection = variables.dataSource.getConnection();
<use the datasource>
variables.dbConnection.close();
Inspiring
July 27, 2008
not sure if these help:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=basiconfig_37.html

http://localhost/CFIDE/adminapi/datasource.cfc

--
Ken Ford
Adobe Community Expert - Dreamweaver/ColdFusion
Fordwebs, LLC
http://www.fordwebs.com


"MKK2" <webforumsuser@macromedia.com> wrote in message news:g6d5sa$s0q$1@forums.macromedia.com...
> Hi all,
>
> I have a CF6 application that is running well. However, I'm in the process of
> upgrading to CF8, and some of the code no longer works. I've scoured the
> documentation and haven't found information on the replacement code.
>
> My old code gets a datasource, acquires a database connection, uses the
> connection, and then closes the datasource.
>
>
> variables.dsService = CreateObject("java",
> "coldfusion.server.ServiceFactory").DataSourceService;
> variables.dsManager = dsService.getDman();
> variables.dataSource = variables.dsManager.getDataSource(<data source
> name goes here>);
> variables.dbConnection = variables.dataSource.getConnection();
> <code to use the db connection goes here>
> variables.dbConnection.close();
>
> Under CF8, the error message is "The getDman method was not found." So I've
> been unable to find any code that will let me get access to an object that
> implements DataSource, so that I can use my connections.
>
> Any advice would be appreciated.
>
> Mike K.
>