开发者

Read Application.DataSource in CF9

How can I read the default application.datasource from 开发者_JS百科my code?

A dump of application does not show me the datasource, and trying to read application.datasource gives an error.


Try dumping application.getApplicationSettings()


Try re-start the applciation. You can't just dump application and see the datasource. But if you have this set in application.cfc it "should" be working.

component output="false" { this.name = "MyDemo"; this.datasource = "DemoDB"; }

Edit: Nice Tony I didn't know that.


The this scope in the Application.cfc only persists for the duration of the onApplicationStart(), onSessionStart() onRequestStart() etc.

If you want to expose variables, in your onApplicationStart(), simply store the in the application scope.

application.myVariable = myVariable;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜