The Win32::ODBC FAQ is now available! (be patient, it is still under construction)


Part I

Part II

Module Description

Business Stuff

ODBC extension for Win32 PERL
Latest version: Version 961011
by Dave Roth (
Courtesy of Roth Consulting.

Based on code by Dan DeMaggio ( -- Thanks Dan!


Copyright © 1996 Dave Roth. All rights reserved.
This program is free software; you can redistribute it or modify it under the same terms as PERL itself.


I do not guarantee ANYTHING with this package. If you use it you are doing so AT YOUR OWN RISK! I may or may not support this depending on my time schedule and I am neither an ODBC nor SQL guru so do not ask me questions regarding them!

GNU General Public License

Larry Wall's "Artistic License"

Version History


Date Changes
96.03.27 Initial Release (rothd)
96.04.08 Changed Data() to accept an array of field names, returning an array or scalar (joc)
Various bug fixes (joc)
96.04.10 Fixed the RowCount() to default to the current connection (droth)
96.04.15 Changed version numbers to a date format (rothd)
96.05.07 Fixed Data(): If returning an array, the array consisted of the requested fieldnames + the values. Now only returns the values. Thanks to Dan Westerlund <>! (rothd)
96.07.22 Added MoreResults(): Checks to see if there are any more records that have not been retrieved. (dunfordshore)
96.07.22 Changed Error(): Errors are tracked differently now. Any error will record the error number ($ErrNum) and error text ($ErrText) in the object's name space and can be retrieved by calling $Database->Error(). Error() will also return the ODBC connection number that caused the error. If the context of the call is not an array then a string with this information will be returned. The Win32::ODBC name space will always have the last error info made, even if it is an error returned by the new method. You can call Win32::ODBC::Error() to get that. (rothd)


Date Changes
96.04.10 Fixed a "memory bug": we were using SQL_CLOSE when closing an ODBC statement. This kept the cursor alive in memory so it can be cached in the event the same SQL statement is issued. We are now using SQL_DROP. This may lessen speed if the same SQL statements are issued again and again per connection. (rothd)
Cleaned up some code. (rothd)
96.04.12 Added GetStmtCloseType() and SetStmtCloseType() functions. (rothd)
Added some constants. (rothd)
96.04.13 ** We now are trying to include a version for builds up to and including 105 and another for builds 106 and greater (for now).
96.04.15 Fix Bug in ODBCFetchRow(): when retrieving a field with a NULL value the value from the previous field was reported. (jmk)
Changed version numbers to a date format.
96.04.22 Fix the SDWORD wrap-around bug in ODBCFetchRow(): when a column of size 2147483647 adding 1 (for a NULL byte in szBuf) yields -2147483648 (not easy to "net UCHAR (-2147483648)"!!) (jmk)
96.04.22 Inspired by Jutta, I have increased the max limit for SetMaxBufSize() to 2,147,483,647 bytes. (rothd)
96.05.03 Set the lowest allocated char array to be 20 bytes in ODBCFetchRow(). Evidentally sometimes the ODBC manager will report too few chars that are needed to represent an autonumber field. (rothd)
96.05.08 Convert all results from ODBCTableList() to uppercase since different ODBC drivers impliment this differently (some uppercase some lower). Thanks again to Jutta M. Klebe. (rothd)
*** This patch is open for suggestions!!! ***
96.07.22 Added ODBCMoreResults(): Checks to see if there are any more records that have not been retrieved. (dunfordshore)

Author List

Abbreviation Name EMail
rothd Dave Roth
joc Joe Casadonte
jmk Jutta M. Klebe
dunfordshore Brian Dunfordshore




Installation Instructions

  1. Copy the ODBC.PM file into the \PERL\LIB\WIN32 directory.
  2. Copy the ODBC.PLL file into the \PERL\LIB\AUTO\WIN32\ODBC\ directory.
  3. Define a DSN (Data Source Name) and ensure that you have everything you need to use it normally (ODBC drivers, database files, etc.)
  4. You are now ready to ODBC all over town!

Bug Reports

Please send bug reports to Dave Roth. Include the following (if appropriate):

What version of Perl and ODBC do I have?

Obtaining the Latest Versions

For More Information on Perl

CPAN - Comprehensive Perl Archive Network - Selected Sites

This page maintined by Joe Casadonte. Please let me if something is wrong or does not make sense. Send these or other comments to:

Copyright © Dave Roth and Joseph L. Casadonte Jr. 1996. All rights reserved.
Win32::ODBC / 07 May 1996 /