RE: Adding remote datasource dynamically
Hi, I received an e-mail from Don regarding this and just wanted to post a response from Macromedia on this topic. There are no documented ways that are supported for on the fly dsn creation in MX. There are ways to do this through the service factory but that is not supported as we could change the factory at any time. We have also seen this method of creating datasources corrupt core xml files and cause further issues. I just wanted to post this as an fyi, I know it's not exactly what everyone wanted to hear but I hope it helps! Best Regards, Christine Lawson Macromedia Technical Support -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 5:26 AM To: CF-Talk Subject: Re: Adding remote datasource dynamically Chunshen (Don) Li wrote: > Oops, Java was not a friend of mine :) > Same result same err msg after using javaCast string function. I just got an email from Rafael Quinones confirming that JavaCast() should work: factory = CreateObject("java", "coldfusion.server.ServiceFactory"); ds_service = factory.datasourceservice; dsources = ds_service.datasources; "#DBpassword#"))#> Jochem _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > Oops, Java was not a friend of mine :) > Same result same err msg after using javaCast string function. I just got an email from Rafael Quinones confirming that JavaCast() should work: factory = CreateObject("java", "coldfusion.server.ServiceFactory"); ds_service = factory.datasourceservice; dsources = ds_service.datasources; Jochem [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > Jochem, are you dropping the ball? I don't use datasource passwords stored in CF, so I can't help you. Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
On Tuesday 16 Dec 2003 21:16 pm, Chunshen (Don) Li wrote: > What's your email address? I'm on CFMX 6.0. Thanks. > >From: "Andrew Scott" <[EMAIL PROTECTED]> > >If anyone is interested I am about to release a suite of tools, its been Um ? -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.*** [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
If anyone is interested I am about to release a suite of tools, its been in the making for the last 2 months but its finally almost ready to release. If you have ever wanted to create, verify, delete a datasource within a coldfusion application then this Coldfusion component will be for you. Currently only works on CF Mx 6.1, haven't tested it on MX 6.0 and works on SQL Server with the others to follow in the next few weeks. If you wish to express your interest in these tools, send me an email offline. _ From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Tuesday, 16 December 2003 6:41 PM To: CF-Talk Subject: Re:Adding remote datasource dynamically Don said: > Same result after ds.password = > ds_service.encryptPasword("#FORM.pwd#"); ds.password = ds_service.encryptPasword(javaCast("string",FORM.pwd)); Jochem _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > > 'An exception occurred during method selection process for Method encryptPasword The cause of this exception was that either there are no methods with the the specified method name and argument types, or the method encryptPasword is overloaded with arguments types that Coldfusion can't decipher reliablly. Use javacast function to reduce ambiguity.' > Line 61, that is, ds.password = ds_service.encryptPasword(FORM.pwd); Cast the password to a string? Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
CLASS="coldfusion.server.ServiceFactory" NAME="factory"> ds_service = factory.DataSourceService; ds = StructNew(); ds.CLASS = "macromedia.jdbc.MacromediaDriver"; ds.DRIVER = "MSSQLServer"; ds.NAME = FORM.dsName; ds.DATABASE = FORM.dbName; ds.HOST = FORM.serverName; ds.username = FORM.un; ds.password = ds_service.encryptPasword(FORM.pwd); urlPath = StructNew(); urlPath.DATABASE = FORM.dbName; urlPath.HOST = FORM.serverName; urlPath.PORT = 1433; urlPath.SELECTMETHOD = "direct"; urlPath.SENDSTRINGPARAMETERSASUNICODE = "false"; // You might need to fix the following line, don't know if URLMAP is the correct name ds.urlmap = urlPath; ds_service["datasources"][FORM.dsName] = ds; > Execution results: > 1) cfdump displays all datasources of the CFMX installation YET the new ds is not added; There are various errors in the code where you use names of objects as strings instead of objects. Also, you assign values twice, which means the first value is overwritten. > 2) error code/msg/detail is EMPTY The code you gave shouldn't return an error because it is syntactically correct. It just doesn't do what you want it to do either. Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > I've realized without MM inside knowledge one can't accomplish the task. Have you done anything similar? I have done it without the passwords. What is the error message? Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > Jochem, pls keep the ball rolling, thanks. I don't use passwords in datasource definitions so I didn't test it. Some people have reported that it worked, but I never bothered to find out the exact syntax and I don't keep IRC logs long enough to find out who reported that. Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > Thanks. Getting close, but password encryption step failed, I tried to encrypt it during pwd insertion also failed, any idea what's going on? > StructUpdate(ds, "password","#factory.DataSourceService.encryptPasword()#"); Shouldn't you insert the password somewhere: encryptPassword(form.password) Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
Chunshen (Don) Li wrote: > > Question on "coldfusion.server.ServiceFactory" CLASS, > it seems to have a method called getDataSourceService(), in the instances of MS SQL 7 and above, I would think it also has a method called AddDataSourceService() something You just create a structure with the right keys and values, and add that to coldfusion.server.ServiceFactory.DataSourceService.datasources To figure out which keys and values, dump coldfusion.server.ServiceFactory.DataSourceService.datasources > Then, encrypt the password, Jochem mentioned about encryptPassword() method, would its syntax be like coldfusion.server.ServiceFactory.DataSourceService['thisDS'].encryptPasword()? No, just coldfusion.server.ServiceFactory.DataSourceService.encryptPasword() Jochem -- When you don't want to be surprised by the revolution organize one yourself - Loesje [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
Seems to be a little confusion of terms. Sandy is definitely correct that CFMX does not support dynamic data sources in the most common use of the term as people use "dynamic data source" to refer to the ability to connect to a database without creating a coldfusion datasource to it. The ability to dynamically create a datasource on the fly does not mean you have "dynamic datasource" capability in cfmx. However, in most cases when using CF5 style dynamic datasource code we're connecting to a Jet based datasource and in those cases it's trivial to use a proxy database and send the connection string to Jet in the from clause. select * from "connection string to database".table In this case we need a datasource called "proxy" pointing to a Access database but we never actually hit the database, Jet redirects the query. HTH, Sam -- Blog: http://www.rewindlife.com Chart: http://www.blinex.com/products/charting -- -Original Message- From: Chunshen (Don) Li [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 9:36 AM To: CF-Talk Subject: Re:Adding remote datasource dynamically Hmm, I would beg to differ. I assumed that the datasource data of a given CFMX installation is stored as an XML file and the CFMX engine and/or the CFMX Admin tool would look for it. So, if this assumption is correct and the knowledge that CFMX for Windows does not use Window's registry for datasource is valid, then, one would be able to add/edit/remove datasource with this particular XML file (of course verification etc. would also be involved), else, I would find it hard to believe. Don Li >CFMX does not support dynamic dsn's. That functionality is only available >in CF5. > [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
short of cygwin, you could always just get a win port of grep. I don't know how anyone lives without it. http://www.interlog.com/~tcharron/grep.html -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 10:49 AM To: CF-Talk Subject: RE: Adding remote datasource dynamically > Thomas, you also seem to be an old man :), how could the Unix > 'grep' command would be applicable to a normal Window's env? I think that he's just saying that on his Unix system, the file that he found is "neo-query.xml". If you want to use grep on your Windows machine, though, I'd recommend installing Cygwin. Rather than editing neo-query.xml directly, though, I'd recommend looking at using the appropriate ServiceFactory interface. Jochem has done a lot of good stuff documenting this: http://spike.oli.tudelft.nl/jochemd/index.cfm?PageID=12 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
> > CFMX does not support dynamic dsn's. That functionality is > > only available in CF5. > > Hmm, I would beg to differ. I assumed that the datasource > data of a given CFMX installation is stored as an XML file > and the CFMX engine and/or the CFMX Admin tool would look for > it. So, if this assumption is correct and the knowledge that > CFMX for Windows does not use Window's registry for > datasource is valid, then, one would be able to > add/edit/remove datasource with this particular XML file (of > course verification etc. would also be involved), else, I > would find it hard to believe. I think that the previous poster is referring to the ability to specify a CONNECTSTRING attribute within a CFQUERY tag, which is a slightly different thing than what you're interested in. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
if you are running MX 6.1 then there are some CFC's which should help with this. -Original Message- From: Chunshen (Don) Li [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 14:36 To: CF-Talk Subject: Re:Adding remote datasource dynamically Hmm, I would beg to differ. I assumed that the datasource data of a given CFMX installation is stored as an XML file and the CFMX engine and/or the CFMX Admin tool would look for it. So, if this assumption is correct and the knowledge that CFMX for Windows does not use Window's registry for datasource is valid, then, one would be able to add/edit/remove datasource with this particular XML file (of course verification etc. would also be involved), else, I would find it hard to believe. Don Li >CFMX does not support dynamic dsn's. That functionality is only available >in CF5. > > _ > >From: Chunshen (Don) Li [mailto:[EMAIL PROTECTED] >Sent: Thursday, December 11, 2003 9:11 AM >To: CF-Talk >Subject: Adding remote datasource dynamically > > >Hi, > >My CF environment is CF6.0 For Windows (Prof. Edition). I believe I >understand CFMX uses XML for datasource manipulation, I vaguely remember >there's some XML file for that laying around under CFMX installation, run a >quick search yielded nothing. Refresh my memory, thanks. > >Your old man, "Joe" :) (Don Li) > _ > > _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
> Thomas, you also seem to be an old man :), how could the Unix > 'grep' command would be applicable to a normal Window's env? I think that he's just saying that on his Unix system, the file that he found is "neo-query.xml". If you want to use grep on your Windows machine, though, I'd recommend installing Cygwin. Rather than editing neo-query.xml directly, though, I'd recommend looking at using the appropriate ServiceFactory interface. Jochem has done a lot of good stuff documenting this: http://spike.oli.tudelft.nl/jochemd/index.cfm?PageID=12 Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
On Thursday 11 Dec 2003 14:25 pm, Chunshen (Don) Li wrote: > Thomas, you also seem to be an old man :), how could the Unix 'grep' > command would be applicable to a normal Window's env? cygwin -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.*** [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Adding remote datasource dynamically
CFMX does not support dynamic dsn's. That functionality is only available in CF5. _ From: Chunshen (Don) Li [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 9:11 AM To: CF-Talk Subject: Adding remote datasource dynamically Hi, My CF environment is CF6.0 For Windows (Prof. Edition). I believe I understand CFMX uses XML for datasource manipulation, I vaguely remember there's some XML file for that laying around under CFMX installation, run a quick search yielded nothing. Refresh my memory, thanks. Your old man, "Joe" :) (Don Li) _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Adding remote datasource dynamically
On Thursday 11 Dec 2003 14:11 pm, Chunshen (Don) Li wrote: > there's some XML file for that laying around under CFMX installation, run a > quick search yielded nothing. Refresh my memory, thanks. neo-query.xml Least that's what cd /opt/bea/user_projects/lv_platform/ceo_platform/WEB-INF/cfusion find . -name '*xml' -exec grep -iH database {} \; says :-) -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.*** [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Adding remote datasource dynamically
Hi, My CF environment is CF6.0 For Windows (Prof. Edition). I believe I understand CFMX uses XML for datasource manipulation, I vaguely remember there's some XML file for that laying around under CFMX installation, run a quick search yielded nothing. Refresh my memory, thanks. Your old man, "Joe" :) (Don Li) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]