Reference

DBD::MaxDB(3pm)

DBD::MaxDB - MySQL MaxDB database driver for the DBI module version 7.5.0 BUILD 032-000-000-000

  use DBI;
  $dbh = DBI->connect("dbi:MaxDB:$hostname/$dbname", "$user", "$password")
           or die "Can't connect $DBI::err $DBI::errstr\n";
  $sth = $dbh->prepare("SELECT 'Hello World' as WELCOME from dual")
           or die "Can't prepare statement $DBI::err $DBI::errstr\n";
  $res = $sth->execute()
           or die "Can't execute statement $DBI::err $DBI::errstr\n";
  @row = $sth->fetchrow_array();
  ...

See the DBI module documentation for full details. DBD::MaxDB is a Perl module which provides access to the MySQL MaxDB databases using the DBI module. It is an interface between the Perl programming language and the MaxDB programming API SQLDBC that comes with the MySQL MaxDB relational database management system. The DBD::MaxDB module needs to link with MaxDB's common database interface SQLDBC which is not included in this distribution. You can download it from the MySQL homepage at: <http://www.mysql.com/maxdb> This section describes the driver specific behavior and restrictions. It does not describe the DBI interface in general. For this purpose please consult the DBI documentation.
Connect To connect to a database with a minimum of parameters, use the following syntax: "$dbh = DBI->connect($url, $user, $password);" The URL contains the name of the database instance, and, if you are connecting to a remote computer, the name of this computer. Additionally the URL may contain some other connection options described below. Use the following format:

"dbi:MaxDB:/<database_server>[:<port>]/<database_name>[?<options>]"

  Parameter            Description
  ----------------------------------------------------
  <database_server>    Name of the database computer
                       (default localhost)

  <port>               Socket port to which you want
                       to connect. Specify this port
                       only if the X Server (MaxDB 
                       remote communication server) 
                       has been configured with a port 
                       that is not the system default 
                       port.

  <database_name>      Name of the database instance

  <options>            See the following section
                       Connection Options

You can use connection options to define the properties of a database instance connection. You can specify these options as part of the connection URL. In this case, you must specify them with the following format:

"<name>=<value>[&<name>=<value>...]"

You can define the following options:

  Option              Description
  -------------------------------------------------------
  user                Name of the database user

  password            User password

  sqlmode             SQL mode, possible values are
                      ORACLE | INTERNAL.The system
                      default is INTERNAL.

  timeout             Command timeout of the connection
                      (in seconds)

  isolationlevel      Isolation level of the connection

  statementcachesize  The number of prepared statements
                      to be cached for the connection
                      for re-use. Possible values are:
                      <n>: desired number of statements,
                      0: no statements are cached,
                      UNLIMITED: unlimited number of
                      statements are cached.

  unicode             The user name, password and SQL
                      statements are sent to the database
                      in UNICODE.

Definition of the parameter url for a connection to the database TST on the computer REMOTESERVER

" dbi:MaxDB:REMOTESERVER/TST "

Definition of the parameter url for a connection to the database TST on the remote computer REMOTESERVER using the port 7673. (This definition requires the X Server to be configured with the same port.)

" dbi:MaxDB:servermachine:7673/TST "

Definition of the parameter url for a connection to the database TST on the local computer

" dbi:MaxDB:TST "

Definition of the parameter url for a connection to the database TST on the local computer; the SQL mode is ORACLE and a command timeout of 120 seconds is defined:

" dbi:MaxDB:TST?sqlmode=ORACLE&timeout=120 "
Datasources "@data_sources = DBI->data_sources('MaxDB');" The driver supports this method. Note that only data sources on the local computer will be listed.
Error messages In case of an error the driver returns an error code, an error text and if appropriate an error state. Details concerning the meaning of an error can be found in the database messages reference at <http://www.mysql.com/products/maxdb/docs.html> "$errcode = $h->err;" Returns the error code. "$errstr = $h->errstr;" Returns the error text. "$sqlstate = $h->state;" Returns the sql state. Example:

  ... = $h->{<attribute>};         # get/read
  $h->{<attribute>} = <value> ;    # set/write

Attributes common to all handles The driver supports all of the general DBI handle attributes provided by DBI. Differences from standard behaviour are listed below. Supported by the driver as proposed by DBI, but due to the fact that MaxDB cannot handle trailing blanks the driver will always chop blanks for "CHAR/VARCHAR" columns.
Database Handle Attributes The driver supports all of the DBI database handle attributes provided by DBI. Additionally the driver provides some MaxDB specific database handle attributes. Gets/Sets the isolation level of the current connection. Gets the version of the database instance used at the current connection. Gets the version of the MaxDB SQLDBC software development kit used by the driver. Gets/Sets the SQL mode of the current connection. Possible values are "ORACLE | INTERNAL". Indicates whether the current connection supports unicode (true) or not (false)
Statement Handle Attributes The driver supports all of the DBI statement handle attributes provided by DBI. Additionally the driver provides some MaxDB specific statement handle attributes. Gets/Sets the maximum number of rows that can be fetched at once. Use this to manipulate the number of rows fetched in one chunk via the order interface. Use a value > 0 to set the maximum number of rows. Use a value <= 0 to reset this limit to the default value. The default value is 'unlimited' (32767). Setting this value does not affect an already executed SQL statement. Gets/Sets the number of rows of a ResultSet. The number of rows of the result set is truncated if the result of a query statement is larger than this limit. The default setting is 'unlimited' (0). Setting this limit does not affect an already executed SQL statement. Gets/Sets the type of the result set concurrency. There are two kinds of concurrency: The result set can be updated. The result set is read-only.

The default setting for the concurrency is "CONCUR_READ_ONLY" Sets the type of a result set. A result set is only created by a query command. There are three kinds of result sets: The result set can only be scrolled forward. The result set is scrollable but may change. The result set is scrollable and not change.

The default for the result set type is "SCROLL_INSENSITIVE" Returns the number of rows affected by the executed SQL statement. This method returns a non-zero value if more than one row was addressed by the SQL statement. If the return value is lower than zero, more than one rows was addressed but the exact number of addressed rows cannot be determined. Retrieves the table name (for "SELECT FOR UPDATE" commands only). Supported by the driver as proposed by DBI. The driver supports parameters for "table_info()". Currently is in MaxDB (like in Oracle) the concept of user and schema the same. Because database objects are owned by an user, the owner names in the data dictionary views correspond to schema names. This may be changed in future releases when real schema support is added.

MaxDB also does not support catalogs so the parameter "TABLE_CAT" is ignored as a selection criterion.

Search patterns are supported for "TABLE_SCHEM" and "TABLE_NAME".

"TABLE_TYPE" may contain a comma-separated list of table types. The following table types are supported: "TABLE, VIEW, RESULT, SYNONYM, SEQUENCE"

The result set is ordered by "TABLE_TYPE, TABLE_SCHEM, TABLE_NAME". Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter "TABLE_CAT" is ignored as a selection criterion. Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter "TABLE_CAT" is ignored as a selection criterion and the "TABLE_CAT" field of a fetched row is always "NULL". Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter "TABLE_CAT" is ignored as a selection criterion and the "TABLE_CAT" field of a fetched row is always "NULL". Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter "TABLE_CAT" is ignored as a selection criterion and the "TABLE_CAT" field of a fetched row is always "NULL". Please see the README file which comes with the module distribution. This module is maintained and supported on a mailing list, "[email protected]" To subscribe to this list, send a mail to "[email protected]" or "[email protected]" Mailing list archives are available at <http://lists.mysql.com/maxdb> Additionally you might try the dbi-user mailing list for questions about DBI and its modules in general. Copyright 2000-2005 by SAP AG This program is free software; you can redistribute it and/or modify it under the terms of either the Artistic License, as specified in the Perl README file or the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Additional information on the DBI project can be found at the following URL: <http://dbi.perl.org> where documentation, links to the mailing lists and mailing list archives and links to the most current versions of the modules can be used. Information on the DBI interface itself can be gained by typing: "perldoc DBI" Information on the MySQL MaxDB database can be found on the WWW at <http://www.mysql.com/maxdb>

History