8

In Coldfusion 9 to get the application datasource outside application.cfc, I've used application.getApplicationSettings().datasource.

In Coldfusion 10 getApplicationSettings() has been replaced with ApplicationGetMetadata(). So naturally I tried ApplicationGetMetaData().datasource, but the ApplicationGetMetaData() function doesn't currently work... (see documentation and comments).

So how can I get the application datasource name (this.datasource in application.cfc) from outside the application.cfc in CF10?

James A Mohler
  • 10,562
  • 14
  • 41
  • 65
jan
  • 2,614
  • 2
  • 17
  • 21
  • ColdFusion 10 Backport: GetApplicationMetadata - http://misterdai.yougeezer.co.uk/2012/03/16/coldfusion-10-backport-arrayslice-getapplicationmetadata/ – Henry Sep 29 '12 at 00:42

1 Answers1

14

There is no ColdFusion function called ApplicationGetMetaData. The correct function name is GetApplicationMetaData().

You can get the application's datasource by calling GetApplicationMetaData().datasource.

Scott
  • 20,335
  • 7
  • 59
  • 71
Rupesh Kumar
  • 156
  • 1
  • 2
  • 4
    apparently the function was renamed between CF10 prerelease and the final release (https://bugbase.adobe.com/index.cfm?event=bug&id=3208541) The old documentation for applicationGetMetadata was still online until exactly today :) – jan Sep 28 '12 at 14:04
  • Indeed: http://bit.ly/USX0UZ (the cached version of the docs page for `ApplicationGetMetaData()`) – Adam Cameron Sep 28 '12 at 14:49
  • 1
    @Adam: Please don't use URL shorteners here. They're not necessary. Worse, they're often blocked by enterprise firewalls because they can be a vector for malware. – ale Sep 28 '12 at 17:57
  • I can't help but think there might be better things to do with your time, Al, but here's the original unabridged URL: – Adam Cameron Sep 28 '12 at 19:18
  • Sigh... I overran my 5min edit timeout. S/O can be really nazi at times. *HERE* is the original unabridged URL: http://webcache.googleusercontent.com/search?q=cache:KHSJN8PAYX4J:help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b6c43bda313671e094bb-8000.html+&cd=1&hl=en&ct=clnk&gl=uk I'm pleased you think I might be the sort of person to spread malware. Thanks for that. – Adam Cameron Sep 28 '12 at 19:25
  • 1
    @Adam - I think you misread Al's comment. He is not saying *you* are spreading malware, just that some corporate firewalls are extremely restrictive. Ridiculously so at times. If they see a shortened url they automatically block it - no exceptions. (It does not matter that it might point to a perfectly legitimate site.) So anyone reading S.O. from behind such a firewall wouldn't be able to access the site you referenced. – Leigh Sep 28 '12 at 20:05