Skip to content

Miscellaneous

dataSource()

dataSource() — returns any

Use this method to override the data source connection information for this model.

NameTypeRequiredDefaultDescription
datasourcestringyesThe data source name to connect to.
usernamestringyesThe username for the data source.
passwordstringyesThe password for the data source.
dataSource(datasource [, username, password ]) <!--- In models/User.cfc --->
<cffunction name="init">
    <!--- Tell Wheels to use the data source named `users_source` instead of the default one whenever this model makes SQL calls  --->
              <cfset dataSource("users_source")>
</cffunction>