Thread: Non-Proprietary ODBC Examples on Win32?
Hi, Is there a C++ example somewhere of accessing an ODBC datasource under win32 using only public/free libraries? I think I can find the ODBC driver libraries OK, but finding a free, public-source driver manager for win32 seems to be problematic. iODBC and unixODBC don't run under win32 as far as I know. Of course I may be totally hosed. I am completely new to postgresql and ODBC programming. If my mental model is flawed and I'm asking the wrong questions, please educate me. -- % Randy Yates % "And all that I can do %% Fuquay-Varina, NC % is say I'm sorry, %%% 919-577-9882 % that's the way it goes..." %%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO http://home.earthlink.net/~yatescr
> -----Original Message----- > From: pgsql-odbc-owner@postgresql.org > [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Randy Yates > Sent: 28 September 2004 14:50 > To: pgsql-odbc@postgresql.org > Subject: [ODBC] Non-Proprietary ODBC Examples on Win32? > > Hi, > > Is there a C++ example somewhere of accessing an ODBC > datasource under win32 using only public/free libraries? I > think I can find the ODBC driver libraries OK, but finding a > free, public-source driver manager for win32 seems to be > problematic. iODBC and unixODBC don't run under win32 as far > as I know. > > Of course I may be totally hosed. I am completely new to > postgresql and ODBC programming. If my mental model is flawed > and I'm asking the wrong questions, please educate me. Modern Windows versions have a driver manager built in. I know it's not Open Source, but then neither is the rest of the OS. Also, as Microsoft wrote the standard, their implementation is pretty compliant :-) Check out msdn.microsoft.com for the ODBC SDK and documentation. Regards, Dave.
Get yourself an ODBC driver for Windows -- from the PostgreSQL site -- I recommend version 7.3.2. Set yourself up a Data Source Name. You can alternatively check the PostgreSQL documentation on creating a connection string. Then use MSDN or google up SQLAllocHandle and SQLConnect. There should be C++ examples aplenty. Dave Page wrote: > > > > >>-----Original Message----- >>From: pgsql-odbc-owner@postgresql.org >>[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Randy Yates >>Sent: 28 September 2004 14:50 >>To: pgsql-odbc@postgresql.org >>Subject: [ODBC] Non-Proprietary ODBC Examples on Win32? >> >>Hi, >> >>Is there a C++ example somewhere of accessing an ODBC >>datasource under win32 using only public/free libraries? I >>think I can find the ODBC driver libraries OK, but finding a >>free, public-source driver manager for win32 seems to be >>problematic. iODBC and unixODBC don't run under win32 as far >>as I know. >> >>Of course I may be totally hosed. I am completely new to >>postgresql and ODBC programming. If my mental model is flawed >>and I'm asking the wrong questions, please educate me. >> >> > >Modern Windows versions have a driver manager built in. I know it's not >Open Source, but then neither is the rest of the OS. Also, as Microsoft >wrote the standard, their implementation is pretty compliant :-) > >Check out msdn.microsoft.com for the ODBC SDK and documentation. > >Regards, Dave. > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > >
Attachment
Greg/Dave, First, thanks for your responses. The value of having real people to discuss these things with should not be underestimated. I had already installed the postgres ODBC driver. The problem is in programmatically interfacing to it. Using ODBC inevitably comes down to making some calls to a library function (either static or dynamic via import libraries). I don't want to depend on MSVC++ CDatabase class or any of the other MS crap. I want to interface with a free ODBC library. Part of the reason is that I want to be able to target the application for either a unix or win32 host. Am I making sense? --RY "Greg Campbell" <greg.campbell@us.michelin.com> writes: > Get yourself an ODBC driver for Windows -- from the PostgreSQL site -- > I recommend version 7.3.2. > > Set yourself up a Data Source Name. You can alternatively check the > PostgreSQL documentation on creating a connection string. > > Then use MSDN or google up SQLAllocHandle and SQLConnect. There should > be C++ examples aplenty. > > > Dave Page wrote: > >> >>>-----Original Message----- >>> From: pgsql-odbc-owner@postgresql.org >>> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Randy Yates >>>Sent: 28 September 2004 14:50 >>>To: pgsql-odbc@postgresql.org >>>Subject: [ODBC] Non-Proprietary ODBC Examples on Win32? >>> >>>Hi, >>> >>> Is there a C++ example somewhere of accessing an ODBC datasource >>> under win32 using only public/free libraries? I think I can find >>> the ODBC driver libraries OK, but finding a free, public-source >>> driver manager for win32 seems to be problematic. iODBC and >>> unixODBC don't run under win32 as far as I know. Of course I may be >>> totally hosed. I am completely new to postgresql and ODBC >>> programming. If my mental model is flawed and I'm asking the wrong >>> questions, please educate me. >> >>Modern Windows versions have a driver manager built in. I know it's not >>Open Source, but then neither is the rest of the OS. Also, as Microsoft >>wrote the standard, their implementation is pretty compliant :-) >> >>Check out msdn.microsoft.com for the ODBC SDK and documentation. >> >>Regards, Dave. >> >>---------------------------(end of broadcast)--------------------------- >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >> > > -- > Greg Campbell <greg.campbell@us.michelin.com> Work: 803-951-5561 > Systems Engineer Fax: 803-951-5531 > Michelin North America > ENG-IT > 2420 Two Notch Road > Lexington, SC 29071 -- % Randy Yates % "Though you ride on the wheels of tomorrow, %% Fuquay-Varina, NC % you still wander the fields of your %%% 919-577-9882 % sorrow." %%%% <yates@ieee.org> % '21st Century Man', *Time*, ELO http://home.earthlink.net/~yatescr
> -----Original Message----- > From: Randy Yates [mailto:yates@ieee.org] > Sent: 28 September 2004 19:14 > To: Greg Campbell > Cc: Dave Page; pgsql-odbc@postgresql.org > Subject: Re: [ODBC] Non-Proprietary ODBC Examples on Win32? > > Greg/Dave, > > First, thanks for your responses. The value of having real > people to discuss these things with should not be underestimated. > > I had already installed the postgres ODBC driver. The problem > is in programmatically interfacing to it. Using ODBC > inevitably comes down to making some calls to a library > function (either static or dynamic via import libraries). I > don't want to depend on MSVC++ CDatabase class or any of the > other MS crap. I want to interface with a free ODBC library. > Part of the reason is that I want to be able to target the > application for either a unix or win32 host. > > Am I making sense? Yes, but theres no need. There is no non-Microsoft DM (that I've ever come across) because the one they provide is on virtually every version of Windows and works just fine. All you need to do is make appropriate calls to odbc32.dll or whatever the equivalent library is on your unix boxes. You can either use the ODBC API directly from your own code, or look for some cross platform ODBC wrapper classes (you might want to look at http://www.wxWidgets.org for a complete cross platform API, including ODBC support - we use it for pgAdmin for example). Regards, Dave.