Highlighted

CF2016 CLI - Datasource could not be found

New Here ,
Aug 30, 2017

Copy link to clipboard

Copied

I have written a basic page as a Proof of Concept that runs a basic query from a single table.  If I run the page via web browser the page displays the resultset form query but from CLI it fails with the error about the datasource not being found.

Do I have to configure something to enable the CLI to be able to read the datasources?

If I cannot figure this out, then I will have to switch languages to provide a CLI option for getting data into my system.

Thank you for any information you can provide.

Greg Howard

The CLI spins up a mini server when its run, it has no concept of the datasources you require so they need to be setup when the CLI is run.

You need to set up an Application.cfc with the datasources being created here. Then used later in your code.

Command Line Interface in ColdFusion 2016 | Adobe Developer Connection

See examples of setting up datasources here - ColdFusion Help | Application variables

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

CF2016 CLI - Datasource could not be found

New Here ,
Aug 30, 2017

Copy link to clipboard

Copied

I have written a basic page as a Proof of Concept that runs a basic query from a single table.  If I run the page via web browser the page displays the resultset form query but from CLI it fails with the error about the datasource not being found.

Do I have to configure something to enable the CLI to be able to read the datasources?

If I cannot figure this out, then I will have to switch languages to provide a CLI option for getting data into my system.

Thank you for any information you can provide.

Greg Howard

The CLI spins up a mini server when its run, it has no concept of the datasources you require so they need to be setup when the CLI is run.

You need to set up an Application.cfc with the datasources being created here. Then used later in your code.

Command Line Interface in ColdFusion 2016 | Adobe Developer Connection

See examples of setting up datasources here - ColdFusion Help | Application variables

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 30, 2017 0
LEGEND ,
Aug 30, 2017

Copy link to clipboard

Copied

I know nothing of CLI in CF, however a quick Google search did come up with a few things.

After the install, did you run wsconfig?

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2017 0
New Here ,
Aug 30, 2017

Copy link to clipboard

Copied

Thanks for the suggestion.  I ran wsconfig when we performed the install, but wsconfig is what configures ColdFusion to run with your preferred web server (hence the ws in wsconfig).  Nothing in the wsconfig mentioned Command Line Interface.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2017 0
Advocate ,
Aug 30, 2017

Copy link to clipboard

Copied

The CLI spins up a mini server when its run, it has no concept of the datasources you require so they need to be setup when the CLI is run.

You need to set up an Application.cfc with the datasources being created here. Then used later in your code.

Command Line Interface in ColdFusion 2016 | Adobe Developer Connection

See examples of setting up datasources here - ColdFusion Help | Application variables

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2017 0
New Here ,
Aug 30, 2017

Copy link to clipboard

Copied

Thank you so much!  Defining an application.cfc with this.datasources fixed my error.  In case anyone else needs help with this, I placed an application.cfc in the same directory as my .cfm page and a sample of the application.cfc are below.  I copied the URL string straight out of my neo-datasources.xml of my CF server for the needed datasource.

component {

this.datasources = {

MyDSN = {

driver = "MSSQLServer"

, username = "MyUserName"

, password = "ValidPassword"

, url = "jdbc:macromedia:sqlserver://172.1.1.1:1433;databaseName=MyDSN;SelectMethod=direct;sendStringParametersAsUnicode=false;queryTimeout=0;MaxPooledStatements=100;jdbcbehavior=0"

}

};

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 30, 2017 0