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
Aqua Data Studio 11.0.0
Build #: 26573
Built on: 2012-Apr-27 05:59:50 PM
// 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.