Skip to content

Model Configuration

dataSource()

dataSource() — returns void

Available in: model Category: Miscellaneous Functions

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

NameTypeRequiredDefaultDescription
datasourcestringyes—The data source name to connect to.
usernamestringno—The username for the data source.
passwordstringno—The password for the data source.
// In models/User.cfc.
config() {
	// Tell Wheels to use the data source named `users_source` instead of the default one whenever this model makes SQL calls.
	dataSource("users_source");
}