|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Adding DSN with ColdFusion Factory
Author: Andrew Scott
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32715#164122
Jake,
I have a CFC that will do the trick for you, it is shareware and I a mhappy
to pass this on as long as copyright is remain to the author.
The cfc will allow you to create, delete and verify a data source for
MsAccess and Ms SQL Server at the moment. If this fits your needs let me
know.
Regards
Andrew Scott
Technical Consultant
NuSphere Pty Ltd
Level 2/33 Bank Street
South Melbourne, Victoria, 3205
Phone: 03 9686 0485 - Fax: 03 9699 7976
Author: Jochem van Dieten
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32715#164103
Jake. wrote:
<cflock name="serviceFactory" type="exclusive" timeout="10">
<cfscript>
factory = CreateObject("java",
"coldfusion.server.ServiceFactory");
ds_service = factory.datasourceservice;
d_sources = ds_service.datasources;
</cfscript>
</cflock>
> like how to do you find the name of an existing datasource in order to model
it
To list all the datasources:
<cfoutput>#StructKeyList(d_sources)#</cfoutput>
> how do you check to ensure there aren稚 any existing DSNs with that same
name
Presuming your new datasource is named "foobar":
<cfif StructKeyExists(d_sources, "foobar")>
<cfthrow message="A datasource with that name already exists.">
</cfif>
> how do you associate the actual DB with the DSN you created
That depends on the driver, just create one using the
administrator and then have a good look at the structure that is
created. For instance, for PostgreSQL it is controlled
exclusively by the URL, while for Access with Unicode you need to
set the URL, the urlmap.databasefile and the
urlmap.connectionprops.databasefile.
Jochem
Author: Jake .
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32715#164094
Thanks for that link. I played around with it last night, and got it to added the
datasource. But there are still several key pieces missing (like how to do you
find the name of an existing datasource in order to model it, how do you check to
ensure there aren’t any existing DSNs with that same name, how do you associate
the actual DB with the DSN you created, etc.)
I was hoping that there might be a CFC or something out there like the
mappings.cfc from CFCZone.org that handles the entire process. (With something
like this, I don’t want to do it wrong!)
Any other pointers?
Jake
----- Excess quoted text cut - see Original Post for more -----
Author: mpwoodward
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32715#164092
>I'm looking for a way to add datasources via code, using the cf.Factory.
>I came across a great CFC for adding mappings (www.cfczone.org
><http://www.cfczone.org/> ), but I can't seem to find
something similar
>for datasources. I've found a few discussions/pages about the theory of
>how you would do this, but nothing will actual code.
http://spike.oli.tudelft.nl/jochemd/index.cfm?PageID=12
Author: Jake
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32715#164085
All,
I know that this has been much talked about, but after an hour of
searching I'm still without real answers.
I'm looking for a way to add datasources via code, using the cf.Factory.
I came across a great CFC for adding mappings (www.cfczone.org
<http://www.cfczone.org/> ), but I can't seem to find something similar
for datasources. I've found a few discussions/pages about the theory of
how you would do this, but nothing will actual code.
Can someone help me out?
Thanks!
Jake
--
BlogFusion - www.countersinkdg.com <http://www.countersinkdg.com/>
Getting Started with LEGO Trains - www.bricksonthebrain.com/trains
--
My Blog - <http://www.smackmybooty.com/> www.smackmybooty.com
Building Instructions Portal - <http://www.bricksonthebrain.com>
www.bricksonthebrain.com
LEGO Photoblog - www.bricksonthebrain.com/photoblog
Getting Started with LEGO Trains - www.bricksonthebrain.com/trains
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||