Re:Adding remote datasource dynamically
Jochem van Dieten wrote: I just got an email from Rafael Quinones confirming that JavaCast() should work: cfset DBpassword=mypassword cfscript factory = CreateObject(java, coldfusion.server.ServiceFactory); ds_service = factory.datasourceservice; dsources = ds_service.datasources; /cfscript cfset encryptedDBpassword = #ds_service. encryptPassword(JavaCast(String, #DBpassword#))# Thanks, Jochem.There seems a couple of possible problems: * passed parameters for MS SQL Server (currently) are: a) new datasource name; b) database name; c) server name; d) username; e) password I thought they should be sufficient * in object hierarchy. Currently, CFOBJECT ACTION=""> TYPE=JAVA CLASS=coldfusion.server.ServiceFactory NAME=factory cfscript 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.password = ds_service.encryptPasword(#FORM.pwd#); // ds.password = ds_service.encryptPasword(javaCast(string,FORM.pwd)); ds.CONNECTIONPROPS = StructNew(); CONNECTIONPROPS.DATABASE = FORM.dbName; CONNECTIONPROPS.HOST = FORM.serverName; CONNECTIONPROPS.PORT = 1433; CONNECTIONPROPS.SELECTMETHOD = direct; CONNECTIONPROPS.SENDSTRINGPARAMETERSASUNICODE = false; // You might need to fix the following line, don't know if URLMAP // is the correct name ds.urlmap = ds.CONNECTIONPROPS; { Alternatively, urlP = StructNew(); urlLevel2 = urlP; urlLevel2 = StructNew(); urlLevel2.CONNECTIONPROPS = StructNew(); urlLevel2.CONNECTIONPROPS.DATABASE = FORM.dbName; urlLevel2.CONNECTIONPROPS.HOST = FORM.serverName; urlLevel2.CONNECTIONPROPS.PORT = 1433; urlLevel2.CONNECTIONPROPS.SELECTMETHOD = direct; urlLevel2.CONNECTIONPROPS.SENDSTRINGPARAMETERSASUNICODE = false; // You might need to fix the following line, don't know if URLMAP // is the correct name ds.urlmap = urlLevel2; failed as well end Alternatively } ds_service[datasources][FORM.dsName] = ds; /cfscript cfset dspwd = #ds_service.encryptPasword(javaCast(string,FORM.pwd))# LINE of ds_service[datasources][FORM.dsName] = ds; Complained java.lang.IllegalArgumentException for HOST=127.0.0.1 changed the LINE to ds_service[datasources][#FORM.dsName#] = ds does not help. It seems the new datasource has not been captured/recorded even if initial password was set to nothing. There could other cause of problem, I just lost train of thought.Thanks again. Don [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re:Adding remote datasource dynamically
I appreciate your effort though, probably you don't want to wake up your buddy at MM, that's OK. Don Jochem van Dieten wrote: 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
I'm on this list and I'm not this list.I disalbed email for the list, hence, did not get Andrew Scott's last email in my mail box.There are times I'm blind, at the moment I seem not. Thanks though. Cheers, Don 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 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re:Adding remote datasource dynamically
Jochem, are you dropping the ball? Don 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
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
Oops, Java was not a friend of mine :) Same result same err msg after using javaCast string function. Could you use your MM resources (MM your buddy) for more inside scoop?Many thanks. Don 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
Oops, was probably half asleep when composing the following msg. cfset foo = 1433 is the same as cfset foo = 1433 But personally I would stick with the later all the time. Also, How come urlPath.PORT = 1433; instead of urlPath.PORT = 1433? Shouldn't 1433 be a string, which requires quotes? And I did not get any error msg. Thanks. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re:Adding remote datasource dynamically
What's your email address?I'm on CFMX 6.0.Thanks. Don 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
I've realized without MM inside knowledge one can't accomplish the task. Have you done anything similar?If so, care to share?Thanks. Don Li [EMAIL PROTECTED] 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
Revised code: CFOBJECT ACTION=""> TYPE=JAVA CLASS=coldfusion.server.ServiceFactory NAME=factory !-- new ds insert -- cfscript ds = 'coldfusion.server.ServiceFactory.DataSourceService.datasources'; // neither work; // ds = '#factory#.DataSourceService.datasources'; ds = StructNew(); StructInsert(ds, CLASS, macromedia.jdbc.MacromediaDriver); StructInsert(ds, DRIVER, MSSQLServer); StructInsert(ds, NAME, #FORM.dsName#); // StructInsert(ds, DATABASE, #FORM.dbName#); // StructInsert(ds, HOST, #FORM.serverName#); // from the ds dump it seems that urlmap is parallel to CLASS etc, // hence, I changed it to the following, structure inside structure urlPath = 'coldfusion.server.ServiceFactory.DataSourceService.datasources.urlmap.CONNECTIONPROPS'; urlPath = StructNew(); StructInsert(urlPath, DATABASE, #FORM.dbName#); StructInsert(urlPath, HOST, #FORM.serverName#); StructInsert(urlPath, PORT, 1433); StructInsert(urlPath, SELECTMETHOD, direct); StructInsert(urlPath, SENDSTRINGPARAMETERSASUNICODE, false); StructInsert(ds, username, #FORM.un#); StructInsert(ds, password, coldfusion.server.ServiceFactory..DataSourceService.encryptPasword(FORM.pwd)); // StructInsert(ds, password, #CFencrypt(FORM.pwd)#); /cfscript cfdump var = #factory.DataSourceService.datasources# cfoutput #var# /cfoutput p !--- Get datasource service --- CFSET dsService=factory.getDataSourceService() !--- Validate DSN --- CFSET result=dsService.verifyDatasource(#FORM.dsName#) !--- If any error, return FALSE --- CFCATCH TYPE=any CFSET result=#cfcatch.detail# /CFCATCH /CFTRY P cfoutput result: '#result#' /cfoutput Execution results: 1) cfdump displays all datasources of the CFMX installation YET the new ds is not added; 2) error code/msg/detail is EMPTY IMHO, password encryption is critical as well.Much appreciated. Don 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
OK, I messed up with objects.With your code, the password encryption failed.Err msg: '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); Thanks. Don CFOBJECT ACTION="" TYPE=JAVA CLASS=coldfusion.server.ServiceFactory NAME=factory cfscript 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; /cfscript cfdump var = #factory.DataSourceService.datasources# 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
Also, How come urlPath.PORT = 1433; instead of urlPath.PORT = 1433? Shouldn't 1433 be a string, which requires quotes? And I did not get any error msg. Thanks. CFOBJECT ACTION="" TYPE=JAVA CLASS=coldfusion.server.ServiceFactory NAME=factory cfscript 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; /cfscript cfdump var = #factory.DataSourceService.datasources# 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
Same result after ds.password = ds_service.encryptPasword(#FORM.pwd#); Don 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
Jochem, pls keep the ball rolling, thanks. Don 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
Thomas, you also seem to be an old man :), how could the Unix 'grep' command would be applicable to a normal Window's env? Don 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]
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
That's why life seems so harsh at the moment, :( tears keeps on dropping down Hmm, just thought of something, how nice it would be if a keyboard would allow one to enter letters in different sizes easily (to allow more expressions for one thing), for instance, the . dot above, I really wanted it to be BIG, smaller, smaller ... follow me? Cheers, Don 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
Helpful info, thank you. 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
Thanks. 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]
Re:Adding remote datasource dynamically
But the subject line clearly says Adding datasource dynamically (on the fly). 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. cfquery name=q datasource=proxy select * from connection string to database.table /cfquery 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
Yes, I agree Jochem has done a lot of good stuff on this subject. 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, then, for this method to work, it would require some mandate parameters such as Data source name, database name, server name, user name and password, it may have a default value for data access method (DIRECT), and default SQL permission such as SELECT, UPDATE, DELETE etc. How would its syntax look like? coldfusion.server.ServiceFactory.AddDataSourceService('ds name','db name','fqdn-server-name','un','pwd')? Then, encrypt the password, Jochem mentioned about encryptPassword() method, would its syntax be like coldfusion.server.ServiceFactory.DataSourceService['thisDS'].encryptPasword()? Where are we?Thanks. Don Li 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
The following guess game/syntax did not work, MM or any one close to MM please step in.TIA Don Li Yes, I agree Jochem has done a lot of good stuff on this subject. 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, then, for this method to work, it would require some mandate parameters such as Data source name, database name, server name, user name and password, it may have a default value for data access method (DIRECT), and default SQL permission such as SELECT, UPDATE, DELETE etc. How would its syntax look like? coldfusion.server.ServiceFactory.AddDataSourceService('ds name','db name','fqdn-server-name','un','pwd')? Then, encrypt the password, Jochem mentioned about encryptPassword() method, would its syntax be like coldfusion.server.ServiceFactory. DataSourceService['thisDS'].encryptPasword()? Where are we?Thanks. Don Li 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
Thanks.Getting close, but password encryption step failed, I tried to encrypt it during pwd insertion also failed, any idea what's going on? CFOBJECT ACTION=""> TYPE=JAVA CLASS=coldfusion.server.ServiceFactory NAME=factory !-- new ds insert -- cfscript ds = 'coldfusion.server.ServiceFactory.DataSourceService.datasources'; ds = StructNew(); StructInsert(ds, CLASS, macromedia.jdbc.MacromediaDriver); StructInsert(ds, DRIVER, MSSQLServer); StructInsert(ds, NAME, #FORM.dsName#); StructInsert(ds, DATABASE, #FORM.dbName#); StructInsert(ds, HOST, #FORM.serverName#); StructInsert(ds, username, #FORM.un#); StructInsert(ds, password, #FORM.pwd#); // chPWD = '#factory.DataSourceService.encryptPasword()#'; // encPWD StructUpdate(ds, password,#factory.DataSourceService.encryptPasword()#); /cfscript 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
Nope. I sort of realized the StructUpdate would fail for one thing (ID seems unclear).Just tried, StructInsert(ds, password, #factory.DataSourceService.encryptPasword(FORM.pwd)#); failed. Hmm, what else could I try? Thanks. Don 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]