[freetds] odbc connection configuration

Roger Reynolds rogerr at softix.com
Thu Apr 15 20:28:46 EDT 2004


Thanks for your reply, just a couple of followup points...

I have progressed somewhat...
I think maybe it is a problem with the odbc unittests?


I can call SQLDriverConnect, and pass the connection
string containing the following:

  SERVERNAME=MyServer; UID=insight; PWD=mypwd; DATABASE=testdb2

and this seems to connect correctly.

However, the unittests (eg connect) compose a connection
string like so:

  DSN=MyServer;UID=insight;PWD=mypwd;DATABASE=testdb2;

Note the difference being that I use SERVERNAME and the connect
test uses DSN.

Note that after this one fails and bails out, there are further
code snippets that do as I've done above and work.


However, the generic connection routine used by the other tests,
which is called Connect, uses SQLConnect, which doesn't work for me,
and thus none of the tests work.

I hacked that routine to use SQLDriverConnect as shown above,
and now most of my ODBC tests work.

So, I'm working - but it took some hacking.

There are a few failures in the tests, but I'll investigate those,
and possibly post separate questions later.

Thanks for listening...
roger


where
  MyServer is the entry in the freetds.conf file
  insight and mypwd are the is the username 
  
I think that if I am not using a driver manager, and if the
application is linked with libtdsodbc.so, as the tests appear to be,
there should be no need for an odbc.ini file, right?

Nonetheless, if it wants one it wants one.
I just don't know what to put in it exactly.
I created a $HOME/.odbc.ini file, with the contents

[FreeTDS]
Driver=/home/rsr/freetds/lib/libtdsodbc.so


-----Original Message-----
From: ZIGLIO, Frediano, VF-IT [mailto:Frediano.Ziglio at vodafone.com]
Sent: Thursday, April 15, 2004 6:13 PM
To: FreeTDS Development Group
Subject: RE: [freetds] odbc connection configuration


> 
> Hi list gang - its my first post here, please be gentle:)
> 

Hi Roger!

> I'm using freetds-0.62.3, on solaris 8, connecting to MSSQL 2000.
> 
> I think I may need just a little bit of help getting the ODBC bits 
> of freetds configured properly.
> 
> I have established and verified connectivity from my solaris system
> to my MSSQL server using the freetds tsql utility:)
> 
> I am trying to use freetds without a driver manager, and have 
> configured
> it as specified in the tutorial. That is - I downloaded and 
> unpacked the 
> unixODBC package, and pointed to that destination when 
> configuring freetds,
> like so:
> 
>   --with-odbc-nodbm=/home/rsr/unixODBC-2.2.8
> 

Not the suggested configuration however it should work. Mind that driver
manager does a lot of test before calling ODBC API so some wrong
arguments can lead to strange results.

> 
> Like I say, I have succeeded in building freetds, and have 
> used tsql to
> connect, 
> query, and update my MSSQL database.
> 
> My freetsd.conf file contains this entry 
> 
> [MyServer]
> 	host = isengard
> 	port = 1433
> 	tds version = 8.0
> 
> The problems start with trying to use ODBC.
> I am starting with trying to run the tests in 
> src/odbc/unittests, but am
> failing, apparently not having the right odbc.ini, 
> odbcinst.ini, and/or
> freetds.conf
> files or contents or something.
> 

ODBC driver need a odbc.ini. I don't know where is should reside if you
compiled with --with-odbc-nodbm=/home/rsr/unixODBC-2.2.8 (perhaps in
/home/rsr/unixODBC-2.2.8/etc/odbc.ini ??) however $HOME/.odbc.ini should
work. Another way is to use SQLDriverConnect and a DSN-less
configuration (see http://www.freetds.org/userguide/dsnless.htm) and do
not use DRIVER entry (used only by driver manager).

> My PWD file contains the following
> 
> UID=insight
> PWD=mypassword
> SRV=MyServer
> DB=testdb2
> 

This file is used only for testing purpose.

> 
> For my purposes,  I'd be happy to bypass the various odbc.ini 
> type files,
> and all of the config files and compose and pass a DSN to SQLConnect
> directly, 
> if that is easier, but what should it look like?
> 
> What is/are the proper args to pass to SQLConnect in order to 
> establish a connection given the info above?
> 
> Or, what do I put in which odbi.ini type files to correspond to this?
> 
> Thanks very much for any help, I won't be able to use freetds if I 
> can't get this first bit figured out.
> 
> roger
> 

bye
  freddy77
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



More information about the FreeTDS mailing list