PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Commit error on DBD::Sybase with MSSQL...
Date: Aug 18 2008 6:02PM

I think that this happens when the AutoCommit attribute is first  
initialized. This triggers the call to commit, even though no  
transactions are in progress.

I'm hoping to find some time in the next couple of weeks to fix a  
number of problems with DBD::Sybase, so this will be one of them...

Michael

On Aug 18, 2008, at 5:56 PM, Wechsler, Steven wrote:

> Hi, I'm using DBD::Sybase v. 1.08 connecting to Sybase and MSSQL  
> 2000, using FreeTDS v. 0.82. SQL Server is set up for TDS version  
> 8.0 in freetds.conf
>
> Anyway, it works fine for Sybase, but with when connecting to SQL  
> Server, if I use the default autocommit setting (1), I get the  
> following message:
>
> Msg 3902, Severity 16, State 1:
> Server 'DEVMSSQL01', Line: 2:
> The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION
>
> This message comes before the output from whatever query I am  
> running (and note that the query is only a SELECT). I ran with  
> DBI_TRACE turned on, and note that COMMIT TRAN appears to be sent  
> explicitly by DBD::Sybase:
>
>
>     DBI 1.602-ithread default trace level set to 0x0/3 (pid 22384)  
> at DBI.pm line 273 via run_sql.pl line 61
>     -> DBI->connect(dbi:Sybase:server=devmssql01, sa, ****,  
> HASH(0x17429150))
>     -> DBI->install_driver(Sybase) for linux perl=5.008008 pid=22384  
> ruid=2001 euid=2001
>     syb_init() -> DBD::Sybase 1.08 initialized
>     OpenClient version: freetds v0.82 (threadsafe, default tds  
> version=5.0)
>        install_driver: DBD::Sybase version 1.08 loaded from /usr/ 
> lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/Sybase.pm
>
>     New 'DBI::dr' (for DBD::Sybase::dr, parent='', id=undef)
>      
> dbih_setup_handle 
> (DBI::dr=HASH(0x17428fa0)=>DBI::dr=HASH(0x17428e30),  
> DBD::Sybase::dr, 0, Null!)
>     dbih_make_com(Null!, 0, DBD::Sybase::dr, 152, 0) thr#16dce010
>     <- install_driver= DBI::dr=HASH(0x17428fa0)
>     !! warn: 0 CLEARED by call to connect method
>     -> connect for DBD::Sybase::dr  
> (DBI::dr=HASH(0x17428fa0)~0x17428e30 'server=devmssql01' 'sa' ****  
> HASH(0x16f73460)) thr#16dce010
>
>     New 'DBI::db' (for DBD::Sybase::db,  
> parent=DBI::dr=HASH(0x17428e30), id=undef)
>      
> dbih_setup_handle 
> (DBI::db=HASH(0x174948f0)=>DBI::db=HASH(0x17494840),  
> DBD::Sybase::db, 16fd7400, Null!)
>     dbih_make_com(DBI::dr=HASH(0x17428e30), 17469dc0,  
> DBD::Sybase::db, 2872, 0) thr#16dce010
>     syb_db_login() -> using global CS_LOCALE data
>     syb_db_login() -> checking for chained transactions
>     syb_db_login() -> ct_option is supported
>     syb_db_login() -> chained transactions are  supported
>     get_server_version() -> ct_command(select @@version)
>     get_server_version() -> ct_results(4040)
>     get_server_version() -> version = Microsoft SQL Server  2000 -  
> 8.00.2039 (Intel X86)
>         May  3 2005 23:18:38
>         Copyright (c) 1988-2003 Microsoft Corporation
>         Enterprise Edition on Windows NT 5.2 (Build 3790: Service  
> Pack 1)
>
>     get_server_version() -> version = Unknown
>     get_server_version() -> ct_results(4046)
>     <- connect= DBI::db=HASH(0x174948f0) at DBI.pm line 637
>     -> STORE for DBD::Sybase::db (DBI::db=HASH(0x17494840)~INNER  
> 'PrintError' 1) thr#16dce010
>     STORE DBI::db=HASH(0x17494840) 'PrintError' => 1
>     <- STORE= 1 at DBI.pm line 689
>     -> STORE for DBD::Sybase::db (DBI::db=HASH(0x17494840)~INNER  
> 'AutoCommit' 1) thr#16dce010
>     syb_db_commit() -> ct_command(
> COMMIT TRAN
> )
>     syb_db_commit() -> ct_send() OK
> Msg 3902, Severity 16, State 1:
> Server 'DEVMSSQL01', Line: 2:
> The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
>
> If I run it with AutoCommit set to 0, I get a message about a  
> ROLLBACK with no corresponding BEGIN TRAN. I suspect that the reason  
> that we don't see these messages with Sybase is that ASE will just  
> ignore a COMMIT or ROLLBACK if there's no corresponding BEGIN TRAN.
>
> How can I fix this?
>
> Steve Wechsler | steven.wechsler@mtvstaff.com
> Sybase/SQL Server/MySQL Database Administrator
> 212-846-5683
>
> MTV Networks
>
>

Michael Peppler              -                    Peppler Consulting  
SaRL
mpeppler@peppler.org         -                     http://www.peppler.org
Sybase DBA/Developer         -      TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ          -      http://www.peppler.org/FAQ/linux.html