[freetds] Problem connecting to SQL server on linux

Lowden, James K james.k.lowden at alliancebernstein.com
Mon Sep 25 16:34:00 EDT 2006


> 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.



More information about the FreeTDS mailing list