man DBD::MaxDB () - MySQL MaxDB database driver for the DBI module version 7.5.0 BUILD 032-000-000-000
NAME
DBD::MaxDB - MySQL MaxDB database driver for the DBI module version 7.5.0 BUILD 032-000-000-000
SYNOPSIS
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.
DESCRIPTION
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>
MODULE DOCUMENTATION
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:
CW$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.
- Define the connection URL
-
Use the following format:
CWdbi: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
- 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:
CW<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.
- Examples
- Definition of the parameter url for a connection to the database TST on the computer REMOTESERVER CW 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.) CW dbi:MaxDB:servermachine:7673/TST Definition of the parameter url for a connection to the database TST on the local computer CW 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: CW dbi:MaxDB:TST?sqlmode=ORACLE&timeout=120
Datasources
CW@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>
CW$errcode = $h->err; Returns the error code.
CW$errstr = $h->errstr; Returns the error text.
CW$sqlstate = $h->state; Returns the sql state.
DBI HANDLE ATTRIBUTES
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 CWCHAR/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 CWORACLE | 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 CWCONCUR_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 CWSCROLL_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 CWSELECT FOR UPDATE commands only).
METADATA SUPPORT
Supported by the driver as proposed by DBI. The driver supports parameters for CWtable_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 CWTABLE_CAT is ignored as a selection criterion. Search patterns are supported for CWTABLE_SCHEM and CWTABLE_NAME. CWTABLE_TYPE may contain a comma-separated list of table types. The following table types are supported: CWTABLE, VIEW, RESULT, SYNONYM, SEQUENCE The result set is ordered by CWTABLE_TYPE, TABLE_SCHEM, TABLE_NAME. Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter CWTABLE_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 CWTABLE_CAT is ignored as a selection criterion and the CWTABLE_CAT field of a fetched row is always CWNULL. Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter CWTABLE_CAT is ignored as a selection criterion and the CWTABLE_CAT field of a fetched row is always CWNULL. Supported by the driver as proposed by DBI. Since MaxDB does not support catalogs so far the parameter CWTABLE_CAT is ignored as a selection criterion and the CWTABLE_CAT field of a fetched row is always CWNULL.
INSTALLATION
Please see the README file which comes with the module distribution.
MAILING LIST SUPPORT
This module is maintained and supported on a mailing list,
CWmaxdb@lists.mysql.com
To subscribe to this list, send a mail to
CWmaxdb-subscribe@lists.mysql.com
or
CWmaxdb-digest-subscribe@lists.mysql.com
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
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
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:
CWperldoc DBI
Information on the MySQL MaxDB database can be found on the WWW at
<http://www.mysql.com/maxdb>