ODBC Error "CoInitialize has not been called"
843859Aug 26 2006 — edited Aug 27 2006I'm connecting via the JDBC-ODBC bridge to a custom ODBC driver which is called in a System DSN. The application is a small GUI that retrieves the results of a SQL query and displays it in a JTable. This process works as designed the first time it executes. However, any subsequent attempt to requery, using the same driver (but not necessarily the same DSN), results in an exception, which reports that the ODBC driver (not JDBC, which does connect to the DSN) failed to connect to the database, for the reason given in the message subject.
Research indicates that this message is the result of accessing the driver with multiple threads. Since I'm using JDBC and not, say, ADO, I don't have the option to insert a call to CoInitialize when I make the connection. That's the usual advice for solving the issue.
So, I'm looking for advice on how I can kill that connection or thread so that the ODBC driver will be able to reconnect. Or, any alternatives that will result in my being able to make multiple successive queries. It's a bit annoying having to kill the UI and restart the application every time one wants to make a new query.
One thought I had was to restart the UI from within itself. Is that possible? How would I do it?
Thanks.
mp