[freetds] Problem connecting to SQL server on linux

Frederik Teerlinck largowww at gmail.com
Tue Sep 26 10:08:23 EDT 2006


Well there was a problem with my driver, so I reinstalled the unixodbc
driver and rebuild freeTDS. It helps me a step further, but I'm not there
yet:

tsql -S MYDBNAME -U MYUID -P MYPWD
This works perfect.

However:
isql -v MYDBNAME MYUID MYPWD
This gives me:
[unixODBC]Client unable to establish connection
[ISQL]ERROR: Could not SQLConnect

I guess this should work first before my own program will work. However I
have no clue why the isql command doesn't work.
Here's my odbc.ini and odbcinst.ini:

::::::::::::::
odbc.ini
::::::::::::::
[MYDBNAME ]
Driver          = TDS
Description     = ODBC connection via FreeTDS
Trace           = No
Servername      = MYDBNAME
Database        = MYDBNAME
::::::::::::::
odbcinst.ini
::::::::::::::
[TDS]
Description             = FreeTDS
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
CPTimeout               =
CPReuse         =
FileUsage               = 1
UsageCount = 1


2006/9/26, Frederik Teerlinck <largowww at gmail.com>:
>
> Ths helps me a bit further. With the function SQLGetDiagRec I get the
> information:
>
> FreeTDS: cannot open shared object file: No such file or directory
> Specified driver could not be loaded
> Specified driver could not be loaded
>
> So there's something wrong with the odbc driver. I'll try to find now
> what's wrong with the documentation sources you've mentioned.
>
>
> 2006/9/25, Lowden, James K <james.k.lowden at alliancebernstein.com>:
> >
> > > From: Jeff Dahl
> > > Sent: Monday, September 25, 2006 1:19 PM
> > >
> > > Frederik Teerlinck wrote:
> > > > ret = SQLDriverConnect(connection, NULL, (SQLCHAR *)
> > > > "DRIVER=FreeTDS;Address=<IPaddress of the SQL
> > > > server>;UID=<login>;PWD=<pwd>;DATABASE=<DBname>;port=<port>;",
> > > > SQL_NTS, outConnectionString, 1024, &len, SQL_DRIVER_NOPROMPT);
> > > > ....
> > > >
> > > Did you replace <IPaddress of the SQL server>, <login>, <pwd>,
> > > <DBname>, and <port> with the correct values
> > >
> > (i.e."DRIVER=FreeTDS;Address=my.servers.ip.address;UID=myLogin;PWD=myPas
> >
> > sword;DATABASE=myDatabaseName;port=myDatabasePort;"
> > > )?
> >
> > The fact that SQLAllocHandle returns SQL_ERROR indicates a problem
> > before the connection is even attempted.
> >
> > I think the function you want is SQLGetDiagRec.
> >
> > If you have access to a Windows machine, download the latest Microsoft
> > Data Access SDK and look at its ODBC documentation.  If not, try
> > searching for SQLAllocHandle on ibm.com; they have pretty good
> > documentation for their DB2 ODBC driver, which conforms to ODBC
> > standards, such as they are.  In any case, you need some documentation,
> > because ODBC is a complicated beast.
> >
> > If you're flexible about which API to use, I always recommend db-lib as
> > the best documented and easiest to use.  YMMV, of course.
> >
> > HTH.
> >
> > --jkl
> >
> > -----------------------------------------
> > The information contained in this transmission may be privileged and
> > confidential and is intended only for the use of the person(s) named
> > above. If you are not the intended recipient, or an employee or agent
> > responsible
> > for delivering this message to the intended recipient, any review,
> > dissemination,
> > distribution or duplication of this communication is strictly
> > prohibited. If you are
> > not the intended recipient, please contact the sender immediately by
> > reply e-mail
> > and destroy all copies of the original message. Please note that we do
> > not accept
> > account orders and/or instructions by e-mail, and therefore will not be
> > responsible
> > for carrying out such orders and/or instructions.  If you, as the
> > intended recipient
> > of this message, the purpose of which is to inform and update our
> > clients, prospects
> > and consultants of developments relating to our services and products,
> > would not
> > like to receive further e-mail correspondence from the sender, please
> > "reply" to the
> > sender indicating your wishes.  In the U.S.: 1345 Avenue of the
> > Americas, New York,
> > NY 10105.
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS at lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> >
>
>



More information about the FreeTDS mailing list