Re: what am I missing?
"Andrew H. Wakefield" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <1306282178.1807.2.camel@linux-laptop> |
Chris,
You are showing the freetds.conf file in /usr/local/etc -- but the first
place freetds will look, I think, is in your home folder. What is in
the .freetds.conf file there?
On Tue, 2011-05-24 at 15:43 -0700, Chris Bartram wrote:
>
> Many thanks for the logging/debug tips. With that I was able to figure out (I
> think) what's happening:
>
>
> When connecting via dsn name it appears it’s reaching the correct server and
> using the correct TCP port – but using TDS version 5 instead of the version 8 as
> defined in the freetds.conf file… ???
>
> Perl code I’m using to connect:
>
> $dbh = DBI->connect("dbi:ODBC:SQLServer",$username,$userpass);
>
> In this attempt was passing NT domain authentication credentials for username
> and password. Got similar results when I also tried with a local SQL
> user/pass.
>
>
>
> -bash-3.2$ cat /tmp/freetds.log
> log.c:190:Starting log file for FreeTDS 0.82
> on 2011-05-24 13:43:42 with debug flags 0x4fff.
> iconv.c:197:names for ISO-8859-1: ISO-8859-1
> iconv.c:197:names for UTF-8: UTF-8
> iconv.c:197:names for UCS-2LE: UCS-2LE
> iconv.c:197:names for UCS-2BE: UCS-2BE
> iconv.c:363:iconv to convert client-side data to the "ISO-8859-1" character set
> iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
> net.c:210:Connecting to xxx.xxx.xxx.xxx port 1433 (TDS version 5.0)
> net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
> net.c:303:tds_open_socket() succeeded
> util.c:162:Changed query state from DEAD to IDLE
> login.c:537:NT login not support using TDS 4.x or 5.0
> util.c:162:Changed query state from IDLE to DEAD
> util.c:334:tdserror(0x6876720, 0x6879140, 20002, 0)
> odbc.c:2032:msgno 20002 20003
> util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
> util.c:389:tdserror: returning TDS_INT_CANCEL(2)
> mem.c:563:tds_free_all_results()
> error.c:574:SQLError((nil), 0x6877b90, (nil), 0x7fff934bd5e0, 0x7fff934bd5f4,
> 0x7fff934bd0c0, 513, 0x7fff934bd5fe)
> error.c:510:_SQLGetDiagRec(2, 0x6877b90, 1, 0x7fff934bd5e0, 0x7fff934bd5f4,
> 0x7fff934bd0c0, 513, 0x7fff934bd5fe)
> error.c:574:SQLError((nil), 0x6877b90, (nil), 0x7fff934bd5e0, 0x7fff934bd5f4,
> 0x7fff934bd0c0, 513, 0x7fff934bd5fe)
> error.c:510:_SQLGetDiagRec(2, 0x6877b90, 1, 0x7fff934bd5e0, 0x7fff934bd5f4,
> 0x7fff934bd0c0, 513, 0x7fff934bd5fe)
> error.c:574:SQLError((nil), 0x6877b90, (nil), 0x7fff934bd5e0, 0x7fff934bd5f4,
> 0x7fff934bd0c0, 513, 0x7fff934bd5fe)
> error.c:510:_SQLGetDiagRec(2, 0x6877b90, 1, 0x7fff934bd5e0, 0x7fff934bd5f4,
> 0x7fff934bd0c0, 513, 0x7fff934bd5fe)
> odbc.c:3680:SQLFreeHandle(2, 0x0x6877b90)
> odbc.c:3706:_SQLFreeConnect(0x6877b90)
> odbc.c:3680:SQLFreeHandle(1, 0x0x68766c0)
> odbc.c:3744:_SQLFreeEnv(0x68766c0)
>
>
> -bash-3.2$ cat /usr/local/etc/freetds.conf
>
> # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
> #
> # This file is installed by FreeTDS if no file by the same
> # name is found in the installation directory.
> #
> # For information about the layout of this file and its settings,
> # see the freetds.conf manpage "man freetds.conf".
>
> # Global settings are overridden by those in a database
> # server specific section
> [global]
> # TDS protocol version
> ; tds version = 4.2
>
> # Whether to write a TDSDUMP file for diagnostic purposes
> # (setting this to /tmp is insecure on a multi-user system)
> dump file = /tmp/freetds.log
> debug flags = 0xffff
>
> # Command and connection timeouts
> ; timeout = 10
> ; connect timeout = 10
>
> # If you get out-of-memory errors, it may mean that your client
> # is trying to allocate a huge buffer for a TEXT field.
> # Try setting 'text size' to a more reasonable limit
> text size = 64512
>
> # A typical Sybase server
> [egServer50]
> host = symachine.domain.com
> port = 5000
> tds version = 5.0
>
> # A typical Microsoft server
> [egServer70]
> host = ntmachine.domain.com
> port = 1433
> tds version = 7.0
>
> [SQLServer]
> host = scomsqlclus.domain.org
> port = 1433
> tds version = 8.0
>
>
>
> -bash-3.2$ cat .odbc.ini
> [SQLServer]
> Driver=FreeTDS
> Description=SCOM Database
> Trace=No
> TraceFile=/tmp/odbc.trace
> Server=SCOMSQLCLUS.domain.org
> Port=1433
> Database=OperationsManager
> "The purpose of life is not to be happy. It is to be useful, to be honorable,
> to be compassionate, to have it make some difference that you have lived and
> lived well". (Ralph Waldo Emerson)
>
>
>
>
> ________________________________
> From: Chris Bartram <[email protected]>
> To: [email protected]; FreeTDS Development Group <[email protected]>
> Sent: Tue, May 24, 2011 7:42:46 AM
> Subject: Re: [freetds] what am I missing?
>
>
> The destination host in my case is Microsoft SQL (2005 cluster); but I did try
> with both a dbi:ODBC:nameinfreetds.conf; as well as the
> dbi:ODBC:DRIVER={freetds};server=sqlservclus.domain.org (also tried IP address
> instead of the hostname). Same errors...
>
> Using the tsql program though I can make a connection and retrieve data from the
>
> database just fine??
>
> -Chris
>
> "The purpose of life is not to be happy. It is to be useful, to be honorable,
> to be compassionate, to have it make some difference that you have lived and
> lived well". (Ralph Waldo Emerson)
>
>
>
>
> ________________________________
> From: Konrad J Hambrick <[email protected]>
> To: FreeTDS Development Group <[email protected]>
> Sent: Tue, May 24, 2011 5:33:58 AM
> Subject: Re: [freetds] what am I missing?
>
>
> Chris --
>
> I believe Randy nailed it. Your DBI->connect() string must include
> the $TDSHOST ( the Name in Brackets in /usr/local/etc/freetds.conf ).
>
> Like so:
>
> If your freetds.conf contains a server config:
>
> [Win2k3]
> host = win2k3.kjh.lan
> port = 1433
> tds version = 8.0
>
> then your DBI->connect() string should be (note the server= in the connect
> string):
>
> my $dbh = = DBI->connect( "DBI:Sybase:maxConnect=100:server=Win2k3",
> $TDSUser,
> $TDSPass,
> { PrintError => 0,
>
> # Option #1
> AutoCommit => 1,
>
> # Option #2, etc
> } ) ;
>
> HTH
>
> -- kjh
>
> Randy Syring wrote, On 05/23/2011 11:10 PM:
> > Try TDSDUMPCONFIG to see all the connection params that TDS is using.
> >
> > http://www.freetds.org/userguide/logging.htm
> >
> > I don't see a server name or IP address, might that be the issue?
> >
> > --------------------------------------
> > Randy Syring
> > Intelicom
> > Direct: 502-276-0459
> > Office: 502-212-9913
> >
> > For the wages of sin is death, but the
> > free gift of God is eternal life in
> > Christ Jesus our Lord (Rom 6:23)
> >
> >
> > On 05/23/2011 11:51 PM, Chris Bartram wrote:
> >> Thanks! Took care of the Perl .so loading issues...
> >>
> >> /usr/local/bin/tsql connection now working; I can connect and query data that
> >> way.
> >>
> >> Perl dbi:ODBC fails with following error codes:
> >>
> >> DBI connect('SQLServer','user',...) failed: [unixODBC][FreeTDS][SQL
> >> Server]Unable to connect to data source (SQL-08001) [state was 08001 now
> >01000]
> >> [unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed (SQL-01000)
> >> [unixODBC][FreeTDS][SQL Server]Unexpected EOF from the server (SQL-01000) at
> >> ./testscom.pl line 9
> >>
> >> Source looks like this:
> >>
> >> $dbh = DBI->connect("dbi:ODBC:SQLServer","user",$userpass);
> >>
> >> (also tried the DRIVER={};Server= format; same errors.)
> >>
> >> Target server is a SQL 2005 cluster; default instance – not a named
> >> instance.Calling from perl on a RHEL system.
> >>
> >>
> >> Any suggestions?
> >>
> >> -Chris Bartram
> >> "The purpose of life is not to be happy. It is to be useful, to be
> >>honorable,
> >> to be compassionate, to have it make some difference that you have lived and
> >> lived well". (Ralph Waldo Emerson)
> >>
> >>
> >>
> >>
> >> ________________________________
> >> From: James K. Lowden<[email protected]>
> >> To: [email protected]
> >> Sent: Wed, May 18, 2011 11:04:43 PM
> >> Subject: Re: [freetds] what am I missing?
> >>
> >> On Tue, 17 May 2011 19:30:17 -0700 (PDT)
> >> Chris Bartram<[email protected]> wrote:
> >>
> >>> When I try the ODBC connection in a Perl program I get
> >>> errors that the .so is not found; yet an ls shows the file(s) right
> >>> where it's supposed to be looking. tsql looks like it might be
> >>> working?
> >> http://www.freetds.org/91/userguide/linker.how.htm
> >>
> >> If Perl says it can't find the .so, it's telling the truth. Because
> >> Perl::DBI is using dlopen(3), nothing in the Perl executable nor the
> >> DBI library affects where the runtime linker looks. You have to tell
> >> it. LD_LIBRARY_PATH is your friend, but you may have to resort to
> >> LD_PRELOAD.
> >>
> >> HTH.
> >>
> >> --jkl
> >> _______________________________________________
> >> FreeTDS mailing list
> >> [email protected]
> >> http://lists.ibiblio.org/mailman/listinfo/freetds
> >> _______________________________________________
> >> FreeTDS mailing list
> >> [email protected]
> >> http://lists.ibiblio.org/mailman/listinfo/freetds
> > _______________________________________________
> > FreeTDS mailing list
> > [email protected]
> > http://lists.ibiblio.org/mailman/listinfo/freetds
>
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds