OpenOffice.org video based manual
Plan-B for OpenOffice.org, learning office productivity software with videos


Tech Support for OpenOffice.org
Applications
Go to Open Office Writer Index
Go to Open Office Impress Index
Go to Open Office Math Index
Go to Open Office Draw Index
Go to Open Office Calc Index
Go to Open Office Base Index
Go to Open Office Online Help Index

Help Sections:
General
Writer
Impress
Math
Draw
Calc
Base
Basic

JDBC

Specifies the options for accessing JDBC databases.

JDBC Examples

OpenOffice.org can communicate with a database through a JDBC driver class, that is provided by the database manufacturer. Below are two examples of JDBC driver classes.

The driver classes must be added to OpenOffice.org in Tools - Options - OpenOffice.org - Java.

Oracle database

Use JDBC to access an Oracle database from Solaris or Linux, and ODBC to access the database from Microsoft Windows.

Under UNIX, ensure that the Oracle database client is installed with JDBC support. The JDBC driver class from the Solaris Oracle client version 8.x is located in the <Oracle client>/product/jdbc/lib/classes111.zip directory. You can also download the latest version from the Oracle web site:

http://otn.oracle.com/tech/java/sqlj_jdbc/content.html

Enter the location of the Oracle database server in the Data source URL box. The syntax of the URL depends on the database type. See the documentation that came with the JDBC driver for more information.

For an Oracle database, the syntax of the URL is:

oracle:thin:@hostname:port:database_name

Where:

  • hostname is the name of the machine that runs the Oracle database. You can also replace hostname with the IP address of the server.

  • port is the port where the Oracle database listens. Ask your database administrator for the correct port address.

  • database_name is the name of the Oracle database. Ask your database administrator for the correct name.

MySQL database

Use the mm.mysql-2.0.4-bin.jar driver archive available on the following web site:

http://mmmysql.sourceforge.net/oldDist.html

The syntax for a MySQL database is:

mysql://hostname:port/database_name

Where:

  • hostname is the name of the machine that runs the MySQL database. You can also replace hostname with the IP address of the server.

  • port is the default port for MySQL databases, namely 3306.

  • database_name is the name of the database.

JDBC Driver Class

Enter the name of the JDBC driver.

Before you can use a JDBC driver, you need to add its class path. Choose Tools - Options - OpenOffice.org - Java, and click the Class Path button. After you add the path information, restart OpenOffice.org.

URL

Enter the URL for connecting to the database, for example, for the MySQL-JDBC-Driver, enter "jdbc:mysql://<Servername>/<DB-Name>", where "DB-Name" is the name of the database. For more information on the JDBC driver, consult the documentation that came with the driver.

User Name

Type the user name for accessing the database.

Password required

Prevents an unauthorized user from accessing the database. You only need to enter the password once per session.

General

Retrieve generated values

Enables OpenOffice.org support of auto-incremented data fields for the current ODBC or JDBC data source. Select this check box if the database does not support the auto-increment feature in its SDBCX layer. In general, the auto-increment is selected for the primary key field.

Auto-increment statement

Enter the SQL command specifier that instructs the data source to auto-increment a specified Integer data field. For example, a typical SQL statement to create a data field is:

CREATE TABLE "table1" ("id" INTEGER)

To auto-increment the "id" data field in a MySQL database, change the statement to:

CREATE TABLE "table1" ("id" INTEGER AUTO_INCREMENT)

In other words, enter AUTO_INCREMENT into Auto-increment statement box.

Query of generated values

Enter an SQL statement that returns the last auto-incremented value for the primary key data field. For example:

SELECT LAST_INSERT_D();

Use SQL92 naming constraints

Only allows names that use characters that conform to the SQL92 naming constraints in the data source. All other characters are rejected. Each name must begin with a lower or upper case letter, or an underline ( _ ). The remaining characters can be ASCII letters, underlines, and numbers.

Index

This help text is published from the OpenOffice-Help files under the Public Documentation License 1.0.

Get OpenOffice.org - Free!