[unixODBC-dev] (no subject)

Stefan Radman Stefan.Radman at CTBTO.ORG
Wed Nov 16 09:03:07 GMT 2005


Igor, 

> and SQLDataSources() return the library name for the driver 
> in the 6th parameter.
SQLDataSources does not read odbcinst.ini
What you describe will only happen if you specify the library name as
"Driver=" attribute in your DSN e.g.

  odbc.ini:
  ---------
  [TestDSN]
  Description     = this DSN does not reference odbcinst.ini
  Driver          = /usr/lib/libodbcpsql.so
  Database        = foo
  Servername      = foo.bar.com
  Username        = bar

instead of 

  odbc.ini:
  ---------
  [TestDSN]
  Description     = this DSN references a driver in odbcinst.ini
  Driver          = PostgreSQL
  Database        = testdb
  Servername      = testdb.acme.com
  Username        = test

  odbcinst.ini:
  -------------
  [PostgreSQL]
  Description     = guess which driver this is
  Driver          = /usr/lib/libodbcpsql.so
  Setup           = /usr/lib/libodbcpsqlS.so

How do your odbc.ini and odbcinst.ini look like?
Are you sure the right ones are used? Check with "odbcinst -j"
 
Stefan

> -----Original Message-----
> From: unixodbc-dev-bounces at easysoft.com 
> [mailto:unixodbc-dev-bounces at easysoft.com] On Behalf Of Igor Korot
> Sent: Wednesday, 16 November, 2005 01:43
> To: Development issues and topics for unixODBC; Development 
> issues and topics for unixODBC
> Subject: RE: [unixODBC-dev] (no subject)
> 
> Nick, Stefan and others,
> When I earlier said that I have more work to, I meant that I 
> need to find a function that will give me a list of DSN names 
> for specified driver.
> On Windows I could easily do it as:
> 
> SQLDrivers( HENV, SQL_FETCH_FIRST, driverDesc, length1, 
> &descrLength, atrib, length2, &atrLength );
> SQLDataSources( HENV, direction, dsn, lengthDsn, &cb1, 
> dsnDesc, lengthDesc, &cb2 );
> if( driverDesc == dsnDesc )
> // found the DSN for the driver specified
> 
> But apparently on unixODBC this is not the case, as 
> SQLDrivers() returns the driver name in the 3rd parameter, 
> and SQLDataSources() return the library name for the driver 
> in the 6th parameter.
> 
> So, now I am stuck. Is it possible to get such info without 
> modifying the code significantly?
> 
> Thank you in advance.
> 
> -----Original Message-----
> From: Stefan Radman <Stefan.Radman at ctbto.org>
> Sent: Nov 15, 2005 3:38 AM
> To: Development issues and topics for unixODBC 
> <unixodbc-dev at easysoft.com>
> Subject: RE: [unixODBC-dev] (no subject)
> 
> > commented comments? But maybe somebody did it on purpose? Can 
> > anybody clarify that particular piece of code?
> If I may.
> 
> Obviously the behaviour was fixed after 2.2.6 to comply with the specs
> on MSDN
> http://cvs.sourceforge.net/viewcvs.py/unixodbc/unixODBC/Driver
> Manager/SQ
> LDataSources.c?r1=1.5&r2=1.6 
> 
> IMHO the confusion came from the word "Description":
> 
> In the ODBC specs on MSDN the word "Description" is used for 
> the unique
> driver name as found in the registry under
>   HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
> E.g.
>   HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\SQL Server
> On Windows this serves as the unique driver name and driver 
> description
> at the same time.
> There is no additional "Description" attribute specified (for 
> drivers).
> 
> In unixODBC the driver name (specified in square brackets) 
> serves as the
> unique driver identifier and is therefore functionally equivalent to
> what the ODBC specs call driver "Description".
> The additional unixODBC driver attribute "Description" is not 
> mandatory
> and is not meant to be unique e.g.
> 
>   [PostgreSQL]
>   Description     = guess which driver this is
>   Driver          = /usr/lib/libodbcpsql.so
>   Setup           = /usr/lib/libodbcpsqlS.so
> 
>   [MySQL]
>   Description    = guess which driver this is
>   Driver         = /usr/lib/libmyodbc.so
>   Setup          = /usr/lib/libodbcmyS.so
> 
> is perfectly valid and the changes you proposed would render
> SQLDataSources() and SQLDrivers() completely useless.
> 
> Stefan
>   
> > -----Original Message-----
> > From: unixodbc-dev-bounces at easysoft.com 
> > [mailto:unixodbc-dev-bounces at easysoft.com] On Behalf Of Nick Gorham
> > Sent: Tuesday, 15 November, 2005 08:53
> > To: Igor Korot; Development issues and topics for unixODBC
> > Subject: Re: [unixODBC-dev] (no subject)
> > 
> > Igor Korot wrote:
> > 
> > >
> > >This is from the latest MSDN, and I believe that this code 
> > was always in that implementation. Now, the correct code is 
> > in place for the file 
> > "unixODBC/DriverManager/SQLDataSources.c", but it's commented 
> > out (lines 301-307 in 2.2.12), and the code that returns the 
> > library name with the full path is returned instead (lines 
> > 309-314 of the same file).
> > >  
> > >
> > Yes, but what does "Description" mean, show me that entry in the MS 
> > registry and I will show you the name of the driver that 
> > relates to the 
> > odbcinst.ini line. If your ini has the path of the lib 
> instead of the 
> > section entry in odbcinst.in you will get what you describe.
> > 
> > >Could somebody please fix it according to the MSDN, and the 
> > commented comments? But maybe somebody did it on purpose? Can 
> > anybody clarify that particular piece of code?
> > >  
> > >
> > You do always have the option of modifying your copy if you 
> > want it to 
> > work in a different way, we do have day jobs you know?
> > 
> > >I will fix it in my code, and see if it will be consistent 
> > with the way MSDN describes it.
> > >  
> > >
> > Ok.
> > 
> > -- 
> > Nick
> > _______________________________________________
> > unixODBC-dev mailing list
> > unixODBC-dev at easysoft.com
> > http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
> > 
> > 
> 
> _______________________________________________
> unixODBC-dev mailing list
> unixODBC-dev at easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
> 
> _______________________________________________
> unixODBC-dev mailing list
> unixODBC-dev at easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
> 
> 




More information about the unixODBC-dev mailing list