Skip to Content.
Sympa Menu

freetds - Re: [freetds] what am I missing?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Chris Bartram <chrisrbartram AT yahoo.com>
  • To: konrad AT payplus.com, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] what am I missing?
  • Date: Tue, 24 May 2011 06:41:34 -0700 (PDT)


I don't have a Sybase database available to try... ? Unless that will also
work
connecting to a MS SQL Server cluster?

-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 <konrad AT payplus.com>
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Sent: Tue, May 24, 2011 8:45:11 AM
Subject: Re: [freetds] what am I missing?


Chris --

Oops ... I did not notice that you were trying to use ODBC ...

Are you able connect via DBI:Sybase instead of ODBC ?

Below is a short perl test program I use to test connection
parameters on our customer's servers ...

It invokes DBD::Sybase instead of going thru ODBC.

-- kjh

################################# cut here ################################
#!/usr/bin/perl
#
use strict ;
use warnings ;
use DBI ;

if ( $#ARGV < 2 )
{
print STDERR "usage: $0 Host User Pass\n" ;
exit( 1 );
}
my $TarHost = $ARGV[0] ; shift ;
my $TarUser = $ARGV[0] ; shift ;
my $TarPass = $ARGV[0] ; shift ;
my $LastMess = "" ;

my $DBH = DBI->connect( "DBI:Sybase:loginTimeout=5:server=$TarHost",
$TarUser,
$TarPass,
{ PrintError => 1,
AutoCommit => 1, # B01015-00 Default = 1
} );

unless ( $DBH )
{
$LastMess = ( $DBI::errstr != '' ) ? $DBI::errstr : "no DBI::errstr" ;
print STDERR "cannot access TarHost = $TarHost ... Error = $LastMess\n" ;
exit( 1 ) ;
}

my $Param = 99 ; # bind this
my $Result = 0 ; # get this back

my $STH = $DBH->prepare( "select ?" ) ;

$STH->bind_param( 1, $Param );

if ( ! $STH->execute )
{
$LastMess = ( $DBI::errstr != '' ) ? $DBI::errstr : "no DBI::errstr" ;
print STDERR "cannot execute the SQL Query ... Error = $LastMess\n" ;
exit( 1 ) ;
}
$Result = $STH->fetchrow_array ;
$STH->finish ;

print "Query Result = $Result\n" ;

exit( 0 ) ;
################################# cut there ################################

Chris Bartram wrote, On 05/24/2011 06:42 AM:
>
> 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<konrad AT payplus.com>
> To: FreeTDS Development Group<freetds AT lists.ibiblio.org>
> 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<jklowden AT freetds.org>
>>> To: freetds AT lists.ibiblio.org
>>> 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<chrisrbartram AT yahoo.com> 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
>>> FreeTDS AT lists.ibiblio.org
>>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>> _______________________________________________
>>> FreeTDS mailing list
>>> FreeTDS AT lists.ibiblio.org
>>> http://lists.ibiblio.org/mailman/listinfo/freetds
>> _______________________________________________
>> FreeTDS mailing list
>> FreeTDS AT lists.ibiblio.org
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

>From konrad AT payplus.com Tue May 24 09:45:25 2011
Return-Path: <konrad AT payplus.com>
X-Original-To: freetds AT lists.ibiblio.org
Delivered-To: freetds AT lists.ibiblio.org
Received: by lists.ibiblio.org (Postfix, from userid 20217)
id 3CF0DE83EC; Tue, 24 May 2011 09:45:25 -0400 (EDT)
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
mailman1.ibiblio.org
X-Spam-Level:
X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham
version=3.2.5
Received: from mail2.payplus.com (www.payplus.com [64.66.85.230])
by lists.ibiblio.org (Postfix) with ESMTP id 31AA6E83EA
for <freetds AT lists.ibiblio.org>; Tue, 24 May 2011 09:45:23 -0400 (EDT)
Received: from localhost (localhost.localdomain [127.0.0.1])
by mail2.payplus.com (Postfix) with ESMTP id 3B58E454594
for <freetds AT lists.ibiblio.org>; Tue, 24 May 2011 08:45:23 -0500 (CDT)
Received: from mail2.payplus.com ([127.0.0.1])
by localhost (mail2.payplus.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 29383-01 for <freetds AT lists.ibiblio.org>;
Tue, 24 May 2011 08:45:16 -0500 (CDT)
Received: from [192.168.0.115] (mail.kjh-com.com [71.42.227.218])
by mail2.payplus.com (Postfix) with ESMTP id 14AE9454C8F
for <freetds AT lists.ibiblio.org>; Tue, 24 May 2011 08:45:15 -0500 (CDT)
Message-ID: <4DDBB66B.6020007 AT payplus.com>
Date: Tue, 24 May 2011 08:45:15 -0500
From: Konrad J Hambrick <konrad AT payplus.com>
Organization: PayPlus Software, Inc
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US;
rv:1.9.2.17) Gecko/20110429 Thunderbird/3.1.10
MIME-Version: 1.0
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
References: <461427.10452.qm AT web126006.mail.ne1.yahoo.com>
<20110518230443.6a25577e.jklowden AT freetds.org>
<692515.29129.qm AT web126012.mail.ne1.yahoo.com>
<4DDB2FAC.9040207 AT inteli-com.com> <4DDB7B86.50405 AT payplus.com>
<503414.57479.qm AT web126004.mail.ne1.yahoo.com>
<4DDBA857.5000305 AT payplus.com>
<441894.52770.qm AT web126013.mail.ne1.yahoo.com>
In-Reply-To: <441894.52770.qm AT web126013.mail.ne1.yahoo.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: amavisd-new at mail2.payplus.com
Subject: Re: [freetds] what am I missing?
X-BeenThere: freetds AT lists.ibiblio.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: konrad AT payplus.com,
FreeTDS Development Group <freetds AT lists.ibiblio.org>
List-Id: FreeTDS Development Group <freetds.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/freetds>,
<mailto:freetds-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/freetds>
List-Post: <mailto:freetds AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/freetds>,
<mailto:freetds-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Tue, 24 May 2011 13:45:25 -0000


Chris --

Yes it does work with SQL Server.

-- kjh(<G> I don't have a Sybase Server either <G>)


Chris Bartram wrote, On 05/24/2011 08:41 AM:
>
> I don't have a Sybase database available to try... ? Unless that will also
> work
> connecting to a MS SQL Server cluster?
>
> -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<konrad AT payplus.com>
> To: FreeTDS Development Group<freetds AT lists.ibiblio.org>
> Sent: Tue, May 24, 2011 8:45:11 AM
> Subject: Re: [freetds] what am I missing?
>
>
> Chris --
>
> Oops ... I did not notice that you were trying to use ODBC ...
>
> Are you able connect via DBI:Sybase instead of ODBC ?
>
> Below is a short perl test program I use to test connection
> parameters on our customer's servers ...
>
> It invokes DBD::Sybase instead of going thru ODBC.
>
> -- kjh
>
> ################################# cut here ################################
> #!/usr/bin/perl
> #
> use strict ;
> use warnings ;
> use DBI ;
>
> if ( $#ARGV< 2 )
> {
> print STDERR "usage: $0 Host User Pass\n" ;
> exit( 1 );
> }
> my $TarHost = $ARGV[0] ; shift ;
> my $TarUser = $ARGV[0] ; shift ;
> my $TarPass = $ARGV[0] ; shift ;
> my $LastMess = "" ;
>
> my $DBH = DBI->connect( "DBI:Sybase:loginTimeout=5:server=$TarHost",
> $TarUser,
> $TarPass,
> { PrintError => 1,
> AutoCommit => 1, # B01015-00 Default = 1
> } );
>
> unless ( $DBH )
> {
> $LastMess = ( $DBI::errstr != '' ) ? $DBI::errstr : "no DBI::errstr" ;
> print STDERR "cannot access TarHost = $TarHost ... Error =
> $LastMess\n" ;
> exit( 1 ) ;
> }
>
> my $Param = 99 ; # bind this
> my $Result = 0 ; # get this back
>
> my $STH = $DBH->prepare( "select ?" ) ;
>
> $STH->bind_param( 1, $Param );
>
> if ( ! $STH->execute )
> {
> $LastMess = ( $DBI::errstr != '' ) ? $DBI::errstr : "no
> DBI::errstr" ;
> print STDERR "cannot execute the SQL Query ... Error = $LastMess\n"
> ;
> exit( 1 ) ;
> }
> $Result = $STH->fetchrow_array ;
> $STH->finish ;
>
> print "Query Result = $Result\n" ;
>
> exit( 0 ) ;
> ################################# cut there ################################
>
> Chris Bartram wrote, On 05/24/2011 06:42 AM:
>>
>> 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<konrad AT payplus.com>
>> To: FreeTDS Development Group<freetds AT lists.ibiblio.org>
>> 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<jklowden AT freetds.org>
>>>> To: freetds AT lists.ibiblio.org
>>>> 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<chrisrbartram AT yahoo.com> 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






Archive powered by MHonArc 2.6.24.

Top of Page