From: Maury M. <mau...@gm...> - 2012-06-13 15:28:22
|
I'm using iODBC as installed on OSX. I'm looking over some sample code in ODBCkit (3rd party) and come across a problem. I'm trying to better understand the nature of issue... When one opens a connection to a database server, say MSSQL, you do not have to select a *database* within it. One can do that with USE, or in the case of ODBC, by using one of the available flags in the DSN. But what if you don't? You still have a valid *connection*, but you aren't talking to an actual DB... right? Is that legal under ODBC? The code in question assumes such a connection to the DB exists if a connection to the server exists. It then goes on and attempts to read the schema of the DB, which fails. I'd like to fix this, but I see problems... Does ODBC maintain some sort of state indicating whether it is connected to a DB (in the sense above)? If not, is there an easy way to tell if you are connected to a DB? Does this state change when the user selects a different DB? If not, does the same basic check allow one to notice such a change? Thanks! |