FW: Handling idle database connections
DBI-dev , can you please take a look and opine? Thanks a lot !! Manikantan _ From: Manikantan, Madhunapanthula_Naaga Sent: Saturday, January 26, 2013 1:31 AM To: 'dbi-us...@perl.org' Subject: Handling idle database connections Hello dbi-users, I have a ton of PERL scripts that open a database connection, do some database related work for 5 to 10 mts and go on with other work for 2 to 3 days. This means, the database connection will be idle after 5 mts but still exists for 2-3 days. This can potentially choke my server once all the available threads are consumed. I think the right approach is for the developer to disconnect once he is done with database work. Since I have no control over the scripts, I want to explore the below. I was wondering if there is any option to DBI that will say if the connection is idle for say 'X' mts disconnect automatically and set state accordingly. On subsequent call to $dbh it can check the state and re-establish connection as necessary. This will alleviate lot of my issues and any help/suggestion in this regard is greatly appreciated !!! Thanks a lot !!! Manikantan.
DBI : Extend 'ChopBlanks' support to variable length character types
Hello DBI-Dev, After getting inputs from Martin and reading DBI documentation it became clear to me that 'ChopBlanks' attribute is designed to work for fixed length character types. Can you please let me know if this feature can be extended to variable length character types as well? Thanks a lot! Manikantan. _ From: Manikantan, Madhunapanthula_Naaga Sent: Friday, June 01, 2012 5:26 PM To: dbi-dev@perl.org; dbi-us...@perl.org Cc: martin.ev...@easysoft.com Subject: FW: :ODBC {ChopBlanks=1} option issue Forwarding to DBI-dev , DBI-users as an fyi. Thanks _ From: Manikantan, Madhunapanthula_Naaga Sent: Friday, June 01, 2012 5:02 PM To: 'Martin J. Evans' Subject: DBD::ODBC {ChopBlanks=1} option issue Hello Martin, I hope you are doing well. ChopBlanks option, doesn't seem to work with DBD::ODBC. Can you please help? I checked out latest version of DBD::ODBC from svn.perl.org and tested the below script on solaris and Linux. Please let me know if you need further information. O/p from my test manik...@finop2.nyc:~/Driver$mailto:manik...@finop2.nyc:~/Driver$ perl -I blib/lib/ -I blib/arch/ ~/chopblanks.pl $VAR1 = [ [ ' ' # has once space ] ]; SQL --- # Create table create table test (v varchar(128)) # set permissions grant all on public to test # populate data insert into test values(' ') -- one space Environment:- --- OS :- Red Hat Enterprise Linux 6 Perl :- 5.10.1 DBI :- 1.609 Test Script - use DBI; use Data::Dumper; $dbh = DBI-connect('dbi:ODBC:DSN=DBTEST-es','','***',{ChopBlanks = 1}); #$dbh-{TraceLevel}=15; $sth = $dbh-prepare('select v from sandbox.dbo.test'); $sth-execute(); $rows = $sth-fetchall_arrayref(); print Dumper($rows); Regards, Mani. Ps: FTR, I read the below extract from DBD::ODBC documentation --- I am at present unsure if ChopBlanks processing on Unicode strings is working correctly on UNIX. If nothing else the construct L' ' in dbdimp.c might not work with all UNIX compilers. Reports of issues and patches welcome. ---
FW: :ODBC {ChopBlanks=1} option issue
Forwarding to DBI-dev , DBI-users as an fyi. Thanks _ From: Manikantan, Madhunapanthula_Naaga Sent: Friday, June 01, 2012 5:02 PM To: 'Martin J. Evans' Subject: DBD::ODBC {ChopBlanks=1} option issue Hello Martin, I hope you are doing well. ChopBlanks option, doesn't seem to work with DBD::ODBC. Can you please help? I checked out latest version of DBD::ODBC from svn.perl.org and tested the below script on solaris and Linux. Please let me know if you need further information. O/p from my test manik...@finop2.nyc:~/Driver$mailto:manik...@finop2.nyc:~/Driver$ perl -I blib/lib/ -I blib/arch/ ~/chopblanks.pl $VAR1 = [ [ ' ' # has once space ] ]; SQL --- # Create table create table test (v varchar(128)) # set permissions grant all on public to test # populate data insert into test values(' ') -- one space Environment:- --- OS :- Red Hat Enterprise Linux 6 Perl :- 5.10.1 DBI :- 1.609 Test Script - use DBI; use Data::Dumper; $dbh = DBI-connect('dbi:ODBC:DSN=DBTEST-es','','***',{ChopBlanks = 1}); #$dbh-{TraceLevel}=15; $sth = $dbh-prepare('select v from sandbox.dbo.test'); $sth-execute(); $rows = $sth-fetchall_arrayref(); print Dumper($rows); Regards, Mani. Ps: FTR, I read the below extract from DBD::ODBC documentation --- I am at present unsure if ChopBlanks processing on Unicode strings is working correctly on UNIX. If nothing else the construct L' ' in dbdimp.c might not work with all UNIX compilers. Reports of issues and patches welcome. ---
FW: DBD::ODBC fetch is returning string for integer
Forwarding this to DBI dev as well. Any help is very much appreciated !! Thanks _ From: Manikantan, Madhunapanthula_Naaga Sent: Friday, May 18, 2012 7:11 PM To: mjev...@cpan.org Cc: dbi-us...@perl.org Subject: DBD::ODBC fetch is returning string for integer Hello Evans/DBi-users, DBD::ODBC is returning strings for integers. This results in incorrect values for bit wise operators. (for ex:- $e='16'; $f = '32' print $e $f returns 12 instead of zero ). Is there a setting that can help us return integers as 'integers'. I am using EasySoft Driver via DBD::ODBC to connect to Microsoft SQL Server 2008 R2 from Linux RHEL 6.2. Version information --- Perl : 5.10.1 DBI : 1.609 DBD::ODBC : 1.30_5 Please use the below code to reproduce the issue and let me know if I you need more information. Help much appreciated !! Thanks # Create temp_check and inserted one row with values (100, 10.234 and 'test') CREATE TABLE temp_check ( a int, b float, c varchar (100) ) INSERT INTO temp_check VALUES (100, 10.234000, 'test') PERL snippet -- use DBI; use Data::Dumper; $dbh = DBI-connect('dbi:ODBC:DSN=SERVER1','***','***'); $dbh-{TraceLevel}=15; $sth = $dbh-prepare('select * from sandbox..temp_check where a=100'); #$sth = $dbh-prepare('select * from sandbox..temp_check where a=100', {odbc_describe_parameters = 0}); $sth-execute(); for ($i = 1; $i = $sth-{NUM_OF_FIELDS}; $i++) { print Column $sth-{NAME}-[$i -1] is of type $sth-{TYPE}-[$i -1]\n; } $rows = $sth-fetchall_arrayref(); print Dumper($rows); Column a is of type 4 Column b is of type 6 Column c is of type 12 $VAR1 = [ [ '100', '10.234', 'test' ] ];