The forum will be down for scheduled maintenance on Saturday, March 4 beginning at 10am EST. Actual downtime is unknown but may be several hours.

Hi,

I am using SQL Anywhere 16 and connecting to the same using jconn4.jar which is pure jdbc. I am exporting data using follow command

UNLOAD SELECT * FROM TABLE_NAME TO 'D:\sales.csv'

And want to import in same table of other schema. Using following query

INPUT INTO TABLE_NAME FROM 'D:\sales.csv' while I am executing the above query using java(jdbc) its giving following error Cause: java.sql.SQLException: SQL Anywhere Error -131: Syntax error near 'INPUT' on line 1

So can you please suggest solution so that i can import the same file using java rather than parsing/ reading csv file and then insering data row by row And same query is working fine on ineractive sql.

asked 22 Nov '13, 04:00

Rajeev's gravatar image

Rajeev
115369
accept rate: 100%


To import data exported with the UNLOAD command you might want to use the LOAD TABLE statement. INPUT, like OUTPUT, is only available within Interactive SQL (aka ISQL).

permanent link

answered 22 Nov '13, 06:40

Reimer%20Pods's gravatar image

Reimer Pods
4.1k324278
accept rate: 12%

Thanks Reimer,

But When I tried to load the same data using

LOAD TABLE TABLE_NAME FROM 'D:\sales.csv';

This use to execute for unlimited time and finally I have to stopped it, So its also not working for me.

So can you please suggest the solution for the same or how can i load the imported data using LOAD(mean exact query may be what am I doing is not correct.)

(25 Nov '13, 01:52) Rajeev

unload is supported in the jConnect driver. The error should be the statement itself. Please use : UNLOAD SELECT * FROM TABLE_NAME TO 'D:\\sales.csv' or UNLOAD SELECT * FROM TABLE_NAME TO 'D:/sales.csv'

permanent link

answered 22 Nov '13, 23:16

Xiong%20He's gravatar image

Xiong He
162
accept rate: 0%

edited 22 Nov '13, 23:17

1

The problem is with INPUT which is not a SQL statement... it is a command only recognized by the client application ISQL.

(24 Nov '13, 15:32) Breck Carter
1

Thanks. Unload and Load should work. But not INPUT and OUTPUT.

(24 Nov '13, 20:04) Xiong He

Yes UNLOAD is working fine with the jdbc. But I have tried to LOAD table too its execution for indefinite time. And I dont know why its not working.

(25 Nov '13, 01:55) Rajeev
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×66

question asked: 22 Nov '13, 04:00

question was seen: 2,236 times

last updated: 25 Nov '13, 01:57