Navalla Supporting the evolution of a new free world.

 

ODBC DBE Driver


DOCUMENTATION


NAME

DBE::Driver::ODBC - ODBC driver for the Perl Database Express Engine

SYNOPSIS

  use DBE;
  
  $dsn = "Driver=ODBC;DataSource=northwind";
  $con = DBE->connect( $dsn );
  
  # or connect with DSN
  $odbc_dsn = 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=northwind.mdb';
  $dsn = "Driver=ODBC;DSN='$odbc_dsn'";
  $con = DBE->connect( $dsn );
  
  $res = $con->query( 'SELECT * FROM table' );

EXAMPLE

  use DBE;
  
  # connect with parameters as hash
  $con = DBE->connect(
      'driver' => 'ODBC',
      'datasource' => 'northwind',
  );
  
  # create a table
  $con->do(
      qq/
      CREATE TABLE cfg_config (
          cfg_name VARCHAR(64) PRIMARY KEY,
          cfg_value VARCHAR(64)
      )
      /
  );
  
  # insert an entry
  $con->do(
      "INSERT INTO cfg_config (cfg_name,cfg_value) VALUES(?,?)",
      'foo', 'bar'
  );
  
  # select the entry
  $res = $con->query(
      "SELECT cfg_value FROM cfg_config WHERE cfg_name = 'foo'"
  );
  
  ($foo) = $res->fetch_row();
  print "\$foo = '$foo'\n";
  
  # output:
  # $foo = 'bar'

DESCRIPTION

DBE::Driver::ODBC is a ODBC database driver for the Perl Database Express Engine.

CONNECT

  use DBE;
  
  DBE->connect( 'Driver=ODBC;Datasource=northwind' );

The following parameters are specified:

  • PROVIDER | DRIVER [ODBC]

    Driver must be "ODBC".

  • SERVER | DATASOURCE [name]

    Data source name. The data might be located on the same computer as the program, or on another computer somewhere on a network.

  • USER | UID [user]

    User identifier.

  • AUTH | PWD | PASSWORD [pwd]

    Authentication string (typically the password).

  • DSN [string]

    DSN is an alternative to DATASOURCE, USER and PASSWORD. It contains a full connection string, a partial connection string, or an empty string.

    A connection string has the following syntax:

    connection-string ::= empty-string[;] | attribute[;] | attribute; connection-string empty-string ::=attribute ::= attribute-keyword=attribute-value | DRIVER=[{]attribute-value[}]attribute-keyword ::= DSN | UID | PWD | driver-defined-attribute-keywordattribute-value ::= character-stringdriver-defined-attribute-keyword ::= identifier

    where character-string has zero or more characters; identifier has one or more characters; attribute-keyword is not case-sensitive; attribute-value may be case-sensitive; and the value of the DSN keyword does not consist solely of blanks.

    Because of connection string and initialization file grammar, keywords and attribute values that contain the characters []{}(),;?*=!@ not enclosed with braces should be avoided. The value of the DSN keyword cannot consist only of blanks and should not contain leading blanks. Because of the grammar of the system information, keywords and data source names cannot contain the backslash (\) character.

    Applications do not have to add braces around the attribute value after the DRIVER keyword unless the attribute contains a semicolon (;), in which case the braces are required. If the attribute value that the driver receives includes braces, the driver should not remove them but they should be part of the returned connection string.

    A DSN or connection string value enclosed with braces ({}) containing any of the characters []{}(),;?*=!@ is passed intact to the driver. However, when using these characters in a keyword, the Driver Manager returns an error when working with file DSNs but passes the connection string to the driver for regular connection strings. Avoid using embedded braces in a keyword value.

    The connection string may include any number of driver-defined keywords. Because the DRIVER keyword does not use information from the system information, the driver must define enough keywords so that a driver can connect to a data source using only the information in the connection string. The driver defines which keywords are required to connect to the data source.

    The following list describes the attribute values of the DSN, FILEDSN, DRIVER, UID, PWD, and SAVEFILE keywords.

    • DSN

      Name of a data source.

    • FILEDSN

      Name of a .dsn file from which a connection string will be built for the data source. These data sources are called file data sources.

    • DRIVER

      Description of the driver. For example, Rdb or SQL Server.

    • UID

      A user ID.

    • PWD

      The password corresponding to the user ID, or an empty string if there is no password for the user ID (PWD=;).

    • SAVEFILE

      The file name of a .dsn file in which the attribute values of keywords used in making the present, successful connection should be saved.

  • LOB_MAX_SIZE [int]

    The maximum size of data to fetch directly from large objects. Defaults to 1024.

  • LOB_TRUNCATE [1|0|Yes|No|True|False]

    If TRUE large objects are truncated at LOB_MAX_SIZE. On FALSE value large objects bigger then LOB_MAX_SIZE are returned as IO handle, which can be read via Perl IO function read and getc. Default value is FALSE.

AUTHORS

Written by Christian Mueller

COPYRIGHT

The DBE::Driver::ODBC module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

 
UNITE FOR CHILDREN - UNITE AGAINST AIDS
 
Generated with Perl 5.10.0 and Perl-CGI 1.0 over FastCGI within 19.28ms in memory safe mode.