By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Error when writing to DB2 from SQL DB via VB.net

P: 33
Complete newbie here so bear with me. I'm look at code written by a.n.other employee who is no longer around.

Using VB.net 2012, within one solution we have a routine which can successfully read data from a file on ISeries and populate a table in a sql db.
When we attempt to write to a file on the ISeries we receive the error "ERROR [42000][IBM][Iseries Access ODBC Driver][DB2 UDB]SQL0104 - Token DEFAULT was not valid. Valid tokens::<INTEGER>.

We can delete data from that same file however unable to write to the file. Permissions all look ok and we are using the same ODBCServerConnectionString.

Do you know if there is anything specific required for Update which is not required for Deletion or Read? Many tks.
Aug 23 '13 #1

✓ answered by LaRedSox

Quizzed - I have had the same problem recently. I think the problem is that the standard Microsoft ODBC classes don't generate the Update commands correctly. The solution was to use the IBM DB2 UDB classes that ship with the Client Access drivers.
1. During the CA install, ensure that the .NET Data Provider component is ticked
2. Add a Reference to this component within in Visual Studio
[NB. If it doesn't appear in the list of available .NET components, you can reference the .DLL directly from the CA install folder, called IBM.Data.DB2.iSeries.dll]
3. The classes use the same structure / naming convention as the equivalent Microsoft ODBC classes, with iDB2 prefices instead of ODBC e.g. iDB2DataAdapter, iDB2Command, iDB2Connection
4. Functionally these appear to work the same as the MS classes although there are some differences with the structure of the Connection String for instance.
5. For more details you could check out the IBM RedBook on the subject at http://www.redbooks.ibm.com/redbooks/pdfs/sg246440.pdf
Once I implemented these classes, I was able to Update the DB2 tables successfully.
Hope this helps.
LaRedSox

Share this Question
Share on Google+
1 Reply


P: 1
Quizzed - I have had the same problem recently. I think the problem is that the standard Microsoft ODBC classes don't generate the Update commands correctly. The solution was to use the IBM DB2 UDB classes that ship with the Client Access drivers.
1. During the CA install, ensure that the .NET Data Provider component is ticked
2. Add a Reference to this component within in Visual Studio
[NB. If it doesn't appear in the list of available .NET components, you can reference the .DLL directly from the CA install folder, called IBM.Data.DB2.iSeries.dll]
3. The classes use the same structure / naming convention as the equivalent Microsoft ODBC classes, with iDB2 prefices instead of ODBC e.g. iDB2DataAdapter, iDB2Command, iDB2Connection
4. Functionally these appear to work the same as the MS classes although there are some differences with the structure of the Connection String for instance.
5. For more details you could check out the IBM RedBook on the subject at http://www.redbooks.ibm.com/redbooks/pdfs/sg246440.pdf
Once I implemented these classes, I was able to Update the DB2 tables successfully.
Hope this helps.
LaRedSox
Sep 4 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.