• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF2016 CLI - Datasource could not be found

New Here ,
Aug 30, 2017 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

Views

1.6K

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
community guidelines

correct answers 1 Correct answer

Advocate , Aug 30, 2017 Aug 30, 2017

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

Votes

Translate

Translate
LEGEND ,
Aug 30, 2017 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,

^ _ ^

Votes

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
community guidelines
New Here ,
Aug 30, 2017 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.

Votes

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
community guidelines
Advocate ,
Aug 30, 2017 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

Votes

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
community guidelines
New Here ,
Aug 30, 2017 Aug 30, 2017

Copy link to clipboard

Copied

LATEST

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"

}

};

}

Votes

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
community guidelines
Resources
Documentation