Perl::DBIのAutoCommit
PerlとDBIを使い始めて長くなるが、
DBI->connectする際にAutoCommit=0を指定していないと、
想定外のCommitが行われて、
データの不整合が起こることに気づいたときは
自分の無知さに辟易したもの(w。
;################################### ;# db 接続関係 ;################################### ;# - connect sub dbConnect() { my ($msg,$in); my ($SID, $USR,$PW) = &getPwd; my($DSN) = 'dbi:Oracle:' . $SID; for ( my $i=0;$i<$DBCONNECTRETRY;$i++) { $DBH = DBI->connect($DSN,$USR,$PW, { RaiseError => 0, PrintError => 0, AutoCommit => 0}); if ($DBI::errstr eq '') { last; } } if ($DBI::errstr ne '') { $msg = $DBI::errstr; &poolDmlMsg('000', 'DBConnect', $msg); print "connect error\n"; return ('error', $msg); } else { return ('ok'); } }