Timberline ODBC Error with TEMP Environment variable

0

I have stumper that's been causing intermittent error at a client which has been increasing in frequency.

I have an application that processes data, and reads from an accounting package called Timberline, running on Windows Server 2008. The Timberline system uses a Pervasive database, and my app communicated with it via and ODBC driver using a DSN.

I have pared down my application and written a simple test app so that I can reproduce this issue with the simplest steps I can think of. My test app is in C#, and it can do 3 things:

1) Open an ODBC Connection using a DSN- this always works 2) Run a simple SELECT query without an ORDER BY clause - works 3) Run a simple SELECT query with an ORDER BY clause - error!

The error is cryptic:

System.Data.Odbc.OdbcException (0x80131937): ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]Unable to open SWPFile.
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]File Manager: Unable to open file.Operating system LastError = 123
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]Bad operation for current SWP mode
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]function i32AddColumn was called in Closed mode
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]General Error in Internal Tables
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]Unable to open SWPFile.
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]Bad operation for current SWP mode
    ERROR [HY000] [Sage Timberline Office][Sage Timberline Office ODBC Driver]General Error in Internal Tables

This is not very helpful. But watching with ProcessMonitor, I see that my app is accessing the folder set in the TEMP environment variable:

C:\Users\Partners\AppData\Local\Temp\3

This issue arises when there is a FILE named "3", in that location rather than a FOLDER named "3". So some process is expecting a folder called "3", or the ability to create such a folder. If the file "3" exists, then I get that error. I can reproduce this reliably. I also think the ORDER BY clause is not directly related to the problem, just a side-effect of the underlying issue.

The simple solution is to delete the "3" file. However, this program runs a few times a day, and that "3" file mysteriously appears every so often. Does anyone have an idea what might be creating this file? If I could find the source of that file, then I might be able to stop it. Simply deleting it every time before my process runs is a perfectly valid solution, but kludgy.

Note that I have no control over the ODBC client or the Pervasive database. My application does not own that system, merely communicates with it.

c#
odbc
pervasive
asked on Stack Overflow Jul 5, 2011 by Daniel Williams • edited Jul 5, 2011 by Daniel Williams

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0