Thread: iODBC

iODBC

From
"Nick Hofstede"
Date:
Hi, this is a conversation I had with the maintainer of iODBC ...

As you will read I still have a problem ... any idea's?

Nick Hofstede

-------------conversation----------------

Hi

yes, I'm very sure :)
Any more ideas I could try?

Nick Hofstede

> Hi
>
> I do not see why this would not work especially as Postgres has documented
> that ~/.odbc.ini is the correct method for locating the DSN information.
Are
> you sure the .odbc.ini file is located in the login directory of the user
> you are logged in as ?
>
> I do not know the attributes for the Postgres ODBC driver for passing as a
> connect string, they should be documented on their WEB site. I shall
enquire
> from our consultants if they know what these should be.
>
> Best Regards,
> Hugh Williams
> Executive Vice President Professional Services
> OpenLink Software
> Web: http://www.openlinksw.com
> Universal Database Connectivity Technology Providers
>
>
>
> Hi,
>
> I looked up the documentation on the postgresql ODBC-driver, and you were
> right. It looks for ~/.odbc.ini, so I created a symlink from ~/.odbc.ini
to
> /etc/odbc.ini, but this didn't help. The same weird behavior continues.
> url postgresql-doc: http://www.postgresql.org/docs/programmer/odbc6278.htm
>
> I didn't try it with all the connection attributes, since I only know 3
> (DSN, UID and PWD) (There have to be others, like port etc .. no?). My db
> doesn't require authentication, so I only have the DSN-attribute which I
> already used by default, so ...
>
> Could you check wether or not you have the same problem without the
symlink?
> If not, there's probably something wrong with my verison of the
> postgres-driver (this is version libpsqlodbc.so.0.25 btw)
>
> I really appreciate the time you're putting into this.
>
> Nick Hofstede
>
>
> > Hi
> >
> > Two possible solutions as we have tested Postgres in-house, I have just
> > confirmed with one of our consultants:
> >
> > 1. Check the Postgres docs. and confirm where the Postgres ODBC driver
> looks
> > for odbc.ini as it may be different to iODBC, for which you have created
> an
> > /etc/odbc.ini. Postgres may be looking for this in ~/.odbc.ini or in the
> > current directory. You can than either copy your current odbc.ini to
this
> > location, create a sym link or set the environment variable ODBCINI to
> point
> > to the location Postgres looks for this file as iODBC will use whatever
> > ODBCINI is set to.
> >
> > 2. If you know the full connection attributes the Postgres ODBC driver
> > needs, you can pass them as a semi-colon delimited list of attributes to
> the
> > connect string as indicated in my initial e-mail
> >
> > Hope this helps ...
> >
> > Best Regards,
> > Hugh Williams
> > Executive Vice President Professional Services
> > OpenLink Software
> > Web: http://www.openlinksw.com
> > Universal Database Connectivity Technology Providers
> >
> > -----Original Message-----
> > From: Nick Hofstede [mailto:FnH@dma.be]
> > Sent: 04 February 2000 12:18
> > To: Hugh Williams
> > Subject: Re: iODBC and postgres
> >
> >
> > Hi,
> >
> > I tried mending
> > (wasn't really sure what I was doing, since this is the first time I'll
be
> > programming with ODBC - I just replaced
> >
> > status = SQLDriverConnect (hdbc, 0, (UCHAR *) dataSource, SQL_NTS,
> >       (UCHAR *) buf, sizeof (buf), &buflen, SQL_DRIVER_COMPLETE);
> >
> > with
> >
> > status = SQLConnect (hdbc, (UCHAR *) dataSource, sizeof(dataSource), "",
> > sizeof(""), "", sizeof(""));
> >
> > since my db wouldn't need a username nor passwd, and that's it)
> > the source of odbctest, but it didn't work (I got [iODBC][Driver
> > Manager]Invalid string or buffer length, SQLSTATE=S1090 )
> >
> > I really would appreciate it if you kept me informed.
> >
> > Sincerely,
> > Nick Hofstede
> >
> > > Hi Nick,
> > >
> > > Hmmm ... , I think we need to download the Postgres ODBC Driver and
test
> > > this in-house, I shall let you know our findings.
> > >
> > > One final suggestion can you try amending the odbctest program and
> calling
> > > SQLConnect() rather than SQLDriverConnect() ?
> > >
> >
> > >
> > > odbctest doesn't return anything. It just wishes me a nice day and
> quits.
> > >
> > > Nick Hofstede
> > >
> > > > Hi
> > > >
> > > > Yes, this worries me as well as I have never seen SQLDriverConnect()
> > > return
> > > > SQL_NO_DATA_FOUND. What is the error returned by the odbctest
program
> ?
> > > >
> > > >
> > > >
> > > > Hi, thanks for the pointer,
> > > > now I get the following in my tracefile. But I don't know if this is
> > good.
> > > > Does this mean everything is working fine and that I can start
coding
> > > using
> > > > this library and these settings, or is something still wrong? (The
> > > > SQL_NO_DATA_FOUND bothers me)
> > > >
> > > > Thanks in advance,
> > > >
> > > > Nick Hofstde
> > > >
> > > >
> > > > -------tracefile -----
> > > >
> > > > SQLAllocEnv ( ... )
> > > > SQL_SUCCESS
> > > >
> > > > SQLAllocConnect ( ... )
> > > > SQL_SUCCESS
> > > >
> > > > SQLDriverConnect ( ... )
> > > > SQL_NO_DATA_FOUND
> > > >
> > > > SQLError ( ... )
> > > > SQL_NO_DATA_FOUND
> > > >
> > > > SQLError ( ... )
> > > > SQL_NO_DATA_FOUND
> > > >
> > > > SQLFreeConnect ( ... )
> > > > SQL_SUCCESS
> > > >
> > > > SQLFreeEnv ( ... )
> > > > SQL_SUCCESS
> > > >
> > > > -------end tracefile--------
> > > >
> > > > > Hi
> > > > >
> > > > > You should use the DSN attribute as part of the connect string of
> the
> > > > > odbctest program to specify the DSN ie
> > > > >
> > > > > Enter ODBC connect string (? shows list):DSN=testpg
> > > > >
> > > > > The connect string takes a semi-colon delimited list of
attributes,
> > thus
> > > > if
> > > > > you need to specify a username/password, this would be of the
form:
> > > > >
> > > > > DSN=<dsnname>;UID=<username>;PWD=<password>
> > > > >
> > > > >
> > > > >
> > > > > Hi,
> > > > > I did the following:
> > > > >
> > > > > - installed postgres
> > > > > - confirmed it worked properly (psql worked)
> > > > > - installed iODBC V3.0.2
> > > > > - created a new database testpg
> > > > > - confirmed this with psql
> > > > > - created an /etc/odbc.ini as follows:
> > > > >
> > > > > ;
> > > > > ; odbc.ini
> > > > > ;
> > > > > [ODBC Data Sources]
> > > > > testpg = test
> > > > >
> > > > > [testpg]
> > > > > Trace = On
> > > > > TraceFile= tracefile
> > > > > Driver = /usr/lib/libpsqlodbc.so
> > > > > SERVER = localhost
> > > > > PORT = 5432
> > > > > DATABASE = testpg
> > > > >
> > > > > - tried to confirm this worked by running odbctest
> > > > > - Got this output:
> > > > >
> > > > > OpenLink ODBC Demonstration program
> > > > > This program shows an interactive SQL processor
> > > > >
> > > > >
> > > > > Enter ODBC connect string (? shows list): ?
> > > > >
> > > > > DSN | Description
> > > > > ---------------------------------------------------------------
> > > > > testpg |
> > > > >
> > > > > Enter ODBC connect string (? shows list): testpg
> > > > > [iODBC][Driver Manager]Dialog failed, SQLSTATE=IM008
> > > > >
> > > > > Have a nice day.
> > > > >
> > > > > - What now?