Cannot Connect To Teradata via AquaScript

by Nov 4, 2012

Hi. I setup an aquascript to pull some data from teradata and export it to a text file. I ran the process via the export window and it worked as expected. I am now trying to run the script from the editor (and browser) and am getting an error right off the bat saying 

“Error on line 2: Wrapped com.aquafold.openapi.AQException: Connection not found: edwin2 (#2)”
 
Is there something I need to configure in preferences to make this run? 
 
I have the server in question registered in the Servers panel and have been successfully using it all morning (and am currently connected it) while trying to run this script.
 
Any help would be appreciated.
 
Here’s my ADS info:

Aqua Data Studio 11.0.0
Build #: 26573
Built on: 2012-Apr-27 05:59:50 PM

 
Here’s the whole script:
 

// specify connection

var conn = aqua.project.getServerConnection(‘alvin’);

conn.connect();

conn.changeDatabase(‘mydb’);

 

function createWriter()

{

    var wr = aqua.io.newTextWriter();

    wr.setCellDelimiter(\t);

    wr.setQuoteIdentifier(\”);

    wr.setOpenDateQuoteIdentifier(\”);

    wr.setCloseDateQuoteIdentifier(\”);

    wr.setFirstLineContainsColumnNames(true);

    wr.setLineDelimiter(\r\n);

    wr.setDefaultDateTimeFormat(‘yyyy-MM-dd:HH:mm:ss’);

    wr.setDefaultDateFormat(‘yyyy-MM-dd’);

    wr.setDefaultTimeFormat(‘hh:mm:ss’);

    wr.setDecimalSymbol(‘.’);

    return wr;

}

 

// export select

var rs = conn.executeQuery(‘select top 10 * from zip’);

var wr = createWriter();

wr.setFile(‘/Users/wevodau/Documents/Teradata_Extract/zip.txt’);

wr.write(rs);

wr.close();

aqua.console.println(‘Export completed.’);

 

 

 

Response

Sachin Prakash over 10 years ago
Hi,

“Error on line 2: Wrapped com.aquafold.openapi.AQException: Connection not found: edwin2 (#2)”

You’re getting this error message because the aquascript cannot find a server connection by the name of “edwin2” under the Project -> Servers folder. (See attachment for reference).

One other point of note. In the example script you provided:

// specify connection

var conn = aqua.project.getServerConnection(‘alvin’);

The connection name is “alvin”. However, the error message is complaining about “edwin2” — a copy/paste error?

Aaron Wevodau over 10 years ago
I’m an idiot. Found and read a whitepaper and added my server to the servers folder in the Projects tab.

Aaron Wevodau over 10 years ago
Thanks for the help.

Got it sorted out now. Much obliged.