Cannot create working datasource.

Super ColdBox (latest version) newbie here. For the life of me, I can’t get it to recognize my local SQL Server datasource. Here’s what I have so far:

Coldbox.cfc

component {
function configure() {

viewCaching = false,

datasources = { alias1 = {name=“rddata”, username=“xyz”, password=“pdq”} }
}

My handler file:

function index(event,rc,prc){
event.setView(“main/index”);

prc.data = getModel( “rd_mainDAO” ).getAll();

}

My DAO file:

component singleton accessors=“true”{

property name=“dsn1” inject=“coldbox:datasource:alias1”;

query function getAll(){
var q = new Query(datasource="#dsn1.name#",sql=“SELECT * FROM rddata”);
return q.execute().getResult();
}

rd_mainDAO function init(){

return this;
}

}

And my result thus far:

Event: main.index
Routed URL: N/A
Layout: Main.cfm (Module: )
View: main/index
Timestamp: 02/08/2018 09:05:50 AM

Is this ColdBox 5? The datasources dsl was removed, I believe.

Cheers,
Eric

Yes, it’s 5.0.0, but all that code was in the example documentation. So, how does one go about creating a datasource then?

We have an upgrade guide. Have you read it?

https://coldbox.ortusbooks.com/content/full/introduction/upgrading-to-coldbox-5.html

Luis Majano
CEO
Ortus Solutions, Corp

P/F: 1-888-557-8057

I did and that helped, though I shall not reveal the true issue so as not to embarrass myself. Thanks!

Hi Luis,

I am also getting the same issue as Brian.

Issue 1:

I have just today upgraded to ColdBox 5 from 4.30 and I am getting the same issue. I have also read the ColdBox 5 upgrade document as well and moved my datasources to settings in Coldbox.cfc.

The DSL provided was not valid: {REF={null}, REQUIRED={true}, ARGNAME={}, DSL={coldbox:settings:cwdatasource}, JAVACAST={null}, NAME={mydsn}, TYPE={any}, VALUE={null}, SCOPE={variables}}

I am injecting as follows: property name=“dsn” inject=“coldbox:configsettings:cwdatasource”;.

Issue 2:

Yesterday I upgraded Lucee to 5.2.60 the latest version and then I started to get injection issues to which I then upgraded to ColdBox 5 to try and resolve the issue e.g.

Component […] has no accessible Member with name [DSN].

I have cleared caches, restarted, etc. with no luck. I am also not sure if this is a Lucee issue or a ColdBox/WireBox issue or neither.

Any help would be great.

Kind regards,
Chuck