Tuesday, October 23, 2018

Disk Cache Error (Exceeds Maximum Limit) in ODBC

NetSuite ODBC is called from C# code for ADO.Net ODBC objects that will generate a report and an error is received:

[HY000] [DataDirect][ODBC OpenAccess SDK driver][OpenAccess SDK SQL Engine]Disk cache error. Field length:197012 exceeds maximum limit of 65535.[10232]

This error will be received if there are lots of records to retrieve. The error is not actually about the Field length but it is query timeout problem. To fix this, the Command Timeout must be set to maximum or to 0. Add the line for the CommandTimeout as shown below on the C# code:

            string query = "SELECT * FROM MESSAGE";

            //Create the connection
            OdbcConnection conn = new OdbcConnection("dsn=NetSuite.com; uid=bruce@banner.com; pwd=Passw0rd");

            OdbcCommand comm = new OdbcCommand(query, conn);
            comm.CommandTimeout = 0;

            //Establish the connection to database
            Console.WriteLine("Connection Successful!\n");      

No comments:

Post a Comment