From: Ted T. Jr <tth...@op...> - 2012-06-13 17:43:25
|
Hi, Maury -- On Jun 13, 2012, at 11:28 AM, Maury Markowitz wrote: > 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 "server" typically refers the DBMS engine instance, which may host multiple "catalogs" and/or "schemas" either (or neither) of which the DBMS engine may consider to be a "database". When you connect to the "server", you typically connect to the *default* "catalog" or "schema" or "database", as set by the DBMS server for the user as whom you've connected. This default may be DBMS admin configurable, on many possible bases. The "USE ..." SQL statement changes the "catalog" or "schema" or "database" which subsequent statements address. > 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! If I'm understanding you correctly, I think the issue(s) you're hitting is(are) DBMS- or possibly client-application-specific, and not tied to ODBC per se. And I think the info I gave above may obviate these lower questions... Of course, more details of what you're doing and your resultant experiences may change my understanding. Be seeing you, Ted -- A: Yes. http://www.guckes.net/faq/attribution.html | Q: Are you sure? | | A: Because it reverses the logical flow of conversation. | | | Q: Why is top posting frowned upon? Ted Thibodeau, Jr. // voice +1-781-273-0900 x32 Senior Support & Evangelism // mailto:tth...@op... // http://twitter.com/TallTed OpenLink Software, Inc. // http://www.openlinksw.com/ 10 Burlington Mall Road, Suite 265, Burlington MA 01803 Weblog -- http://www.openlinksw.com/blogs/ LinkedIn -- http://www.linkedin.com/company/openlink-software/ Twitter -- http://twitter.com/OpenLink Google+ -- http://plus.google.com/100570109519069333827/ Facebook -- http://www.facebook.com/OpenLinkSoftware Universal Data Access, Integration, and Management Technology Providers |