Odbc Logging To Ibm Iseries


Recommended Posts


I am attempting to log data to a DB2 database in an IBM iSeries. I've set up a library on the IBM that the ODBC maps to.

I get the following error on DAQFactory.

C1011 Could not create table for logging. Msg: SQL0104 - Token ; was not valid. Valid tokens: <END-OF-STATEMENT>

If I look on the IBM side, the following error is generated.

Additional Message Information

Message ID . . . . . . : SQL0104 Severity . . . . . . . : 30

Message type . . . . . : Diagnostic

Date sent . . . . . . : 12/08/31 Time sent . . . . . . : 09:52:36

Message . . . . : Token ; was not valid. Valid tokens: <END-OF-STATEMENT>.

Cause . . . . . : A syntax error was detected at token ;. Token ; is not a

valid token. A partial list of valid tokens is <END-OF-STATEMENT>. This

list assumes that the statement is correct up to the token. The error may

be earlier in the statement, but the syntax of the statement appears to be

valid up to this point.

Recovery . . . : Do one or more of the following and try the request again:

-- Verify the SQL statement in the area of the token ;. Correct the

statement. The error could be a missing comma or quotation mark, it could

be a misspelled word, or it could be related to the order of clauses.

-- If the error token is <END-OF-STATEMENT>, correct the SQL statement

because it does not end with a valid clause.

Anybody have a setup sequence for IBM ODBC? Has this been implemented before, and if so, what is the procedure?



Link to comment
Share on other sites

DAQFactory uses the standard semi-colon as the end of line character for all SQL statements. Apparently DB2 wants a different EOL character. I would look for a way to change this, either in your DB2 settings, or more likely in your ODBC driver, which might have an option to convert ;'s to whatever DB2 wants for an EOL character.

Link to comment
Share on other sites

OK. But MySQL, MSSQL and other databases that DAQFactory customers typically use require the ;, so its hard coded in. If you have no way of removing it from the ODBC server side, you will likely have to use the DB. functions and script to access this database. Those functions allow you to fully specify your SQL statement however you want, so you can skip the semicolon.

Link to comment
Share on other sites

Excellent, I was hoping there would be a way around this. I was going to ask if there was a way to do ODBC SQL statements using script. Thank you!

So I could use a script to call a function that would log in and do an 'Insert' into the database? I will certainly give it a try.

Link to comment
Share on other sites

You can use script in DAQFactory to execute any SQL function. Use db.execute() for all commands other than select. Use db.query(), or better yet, db.queryToClass() for SELECT statements. QueryToClass might not work with your DB, but if it does, it is much faster than query.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.