House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Adding DSN with ColdFusion Factory

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jake
05/23/2004 12:14 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
mpwoodward
05/23/2004 08:28 AM

>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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jake .
05/23/2004 10:05 AM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jochem van Dieten
05/23/2004 11:19 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Andrew Scott
05/23/2004 10:51 PM

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  


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

July 31, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
         1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31