I am trying to run SQL like the following from a java app.

result = stmt.executeQuery( "CREATE TABLE #test(ID unsigned int);LOAD INTO #test (ID '\x09\x0a') from '/path/to/file.bcp' " );

I know the query works. I ran it in isql without and issue. I am using the iAnywhere JDBC driver that came with SQL Anywhere 11 (jodbc.jar). In my java project I am using jodbc.jar from SQL Anywhere 11. My connection string is pretty simple. "jdbc:ianywhere:DSN=dw". I can get a connection, but I now get the following error: [Sybase][ODBC Driver][Sybase IQ]Syntax error near 'LOAD'.

Previously I tried using jconnect and got the same error.

Any Ideas?

asked 06 Oct '11, 21:47

Jon's gravatar image

Jon
25226
accept rate: 0%

edited 07 Oct '11, 08:34

Graeme%20Perrow's gravatar image

Graeme Perrow
9.6k379124


IMHO, your LOAD TABLE statement simply misses the word TABLE - it's the word INTO that is optional:

CREATE TABLE #test(ID unsigned int);
LOAD INTO TABLE #test (ID) from '/path/to/file.bcp';
permanent link

answered 07 Oct '11, 03:24

Volker%20Barth's gravatar image

Volker Barth
40.1k361549819
accept rate: 34%

Volker, that was the issue. Thanks! I really appreciate the help. This has been holding me back for a day and a half now. It's strange to me that LOAD INTO worked when using isql. Thanks again.

(07 Oct '11, 07:50) Jon
Replies hidden
1

I'm glad to hear that.

What exactly "isql" tool are you using - DBISQL or dbisqlc? (Or a IQ-specific tool?)

In my tests, both DBISQL and dbisqlc (v11.0.1.2527) raise the expected syntax error (SQLCODE -131) when LOAD TABLE is used without "TABLE".

(07 Oct '11, 08:29) Volker Barth

Interactive SQL Java version 9.0.1, build 2097. It is a Java GUI that came as part of Adaptive Server IQ 12.6.

(07 Oct '11, 09:42) Jon

In addition to what Volker said, this forum is about SQL Anywhere, not IQ.

IQ's syntax for the LOAD TABLE statement differs from SQL Anywhere's; here's the IQ syntax: http://manuals.sybase.com/onlinebooks/group-iq/iqg1250e/iqref/@Generic__BookTextView/55329;pt=61646

Having said that, Volker's answer is probably the right one.

permanent link

answered 07 Oct '11, 04:29

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%

Breck,

Thank you for the link. Reviewing now.

(07 Oct '11, 07:51) Jon
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:

×86
×41
×19

question asked: 06 Oct '11, 21:47

question was seen: 8,417 times

last updated: 07 Oct '11, 09:42