Using Perl DBI to test ODBC Connections

If you have the DBI perl module, and the Win32 ODBC pm (optional), this little script can be used to check your connections and give a database DSN a quick test.

 

   #!perl -w   use DBI;   use Win32::ODBC;      print "ODBC Drivers \n";   my @drivers = DBI->available_drivers;   print join(", ", @drivers), "\n";      print "-------------------------------------------------------------------------\n";      my $d = join("", @drivers);   print "DBD::ODBC";   print "not" if ($d !~ /ODBC/);   print "installed\n";      print "-------------------------------------------------------------------------\n";      my @dsns = DBI->data_sources('ODBC');   foreach my $d (@dsns)   {   print "$d\n";   }      print "-------------------------------------------------------------------------\n";      my $dbh = DBI->connect('dbi:ODBC:DBASE02', 'browser', 'browser');   $dbh->disconnect() if ($dbh);      print "-------------------------------------------------------------------------\n";      my $dbh32 = DBI->connect('dbi:Win32-ODBC:DBASE02', 'browser', 'browser');   $dbh32->disconnect() if ($dbh32); 

 

 

System DSN on Windows 2008r2 64 bit

Setting up a 32bit VB/Oracle app on a Win2008r2 64bit OS/Server can prove to be problematic.

Heres a link to my discussionfrom the Oracle OTN forum.

https://forums.oracle.com/forums/thread.jspa?messageID=10346952#10346952

The key is using the windows 32 bit panel here c:\windows\sysWOW64\odbcad32.exe to create your connections using the Oracle 32 bit client/driver.

In addition theres a gotcha where you may have to configure, rather than add, an existing System DSN connection to get it to work.

 

Updated 8 May 2013:

ODBC connections can be very finnicky regarding white space. When creating a DSN make sure there is no whitespace at the end of the DSN Alias! It sounds stupid, and it is yes, but this can take a while to figure out 🙁

Beyond Compare Regex Strings

One of the most useful features of Beyond Compare is the ability to ignore unimportant data or string.

Tools->Pick Rules-> New Rule

Call the rule “Unimportant Text”

Select “Importance” tab

[New] Unimportant Text

Now we can add text strings to mark as unimportant…

ignore HH:MM:SS is ([0-1]?\d|2[0-3]):([0-5]?\d):([0-5]?\d)