cancel
Showing results for 
Search instead for 
Did you mean: 

[Sybase][ODBC Driver][Sybase IQ]Syntax error near 'LOAD'

Former Member
8,991

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\
') 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?

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

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';
Former Member
0 Kudos

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.

VolkerBarth
Contributor

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".

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Breck_Carter
Participant

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.

Former Member
0 Kudos

Breck,

Thank you for the link. Reviewing now.