|
Using MySQL
From NeoWiki
Revision as of 00:01, 4 September 2005 (edit) ( | contribs) m (→Detailed Installation) ← Previous diff |
Revision as of 23:26, 16 September 2005 (edit) (undo) Sardisson (Talk | contribs) (work on conformance to Neo/J style guide, add intro) Next diff → |
||
Line 1: | Line 1: | ||
- | + | While NeoOffice/J 1.1 and OpenOffice.org/X11 do not include a separate database component like Microsoft Access, it is possible to use either program to connect to existing MySQL databases and enter or manipulate data, including creating detailed forms and reports. This article contains information on installing, configuring, and using a MySQL database with NeoOffice/J or OpenOffice.org/X11. | |
- | + | ''If you do not have a MySQL database, you can [[Creating a Database|create a simple database]] in NeoOffice/J or OpenOffice.org/X11—or even use a Calc table if your needs are very simple.'' | |
- | ==== Installation ==== | + | ==Enabling NeoOffice/J or OpenOffice.org/X11 to connect to MySQL databases== |
+ | |||
+ | ===Using JDBC and Connector/J=== | ||
+ | |||
+ | ====Installation Overview==== | ||
* Download Connector/J 3.0 from the [http://www.mysql.com/products/connector/ MySQL website]. | * Download Connector/J 3.0 from the [http://www.mysql.com/products/connector/ MySQL website]. | ||
** The included README gives much information. | ** The included README gives much information. | ||
Line 10: | Line 14: | ||
*** the URL format: <tt>jdbc:mysql://host.domain/database_name</tt> | *** the URL format: <tt>jdbc:mysql://host.domain/database_name</tt> | ||
** You will need a version of Connector/J that supports Java 1.3.x, since that is the version of Java used in NeoOffice/J. | ** You will need a version of Connector/J that supports Java 1.3.x, since that is the version of Java used in NeoOffice/J. | ||
- | *** Note: Connector/J 3.1 and, presumably, later versions are not Java 1.3.x compatible. | + | *** Note: Connector/J 3.1 and, presumably, later versions are not Java 1.3.x compatible. |
*The jar file location: | *The jar file location: | ||
Line 20: | Line 24: | ||
==== Detailed Installation ==== | ==== Detailed Installation ==== | ||
- | # If you haven't already, install NeoOffice/J | + | # If you haven't already, install NeoOffice/J (I am using v1.1, downloaded 2005-08-14) and MySQL (I am using 4.1.13-standard). |
# Download Connector/J 3.0 from http://www.mysql.com and save it to the Desktop. (I downloaded v3.0.17, the tar.gz version). | # Download Connector/J 3.0 from http://www.mysql.com and save it to the Desktop. (I downloaded v3.0.17, the tar.gz version). | ||
- | # Extract | + | # Extract the Connector/J jar from the tar.gz archive. |
# Copy the .jar file to wherever you like (I chose <tt>~/lib</tt>). | # Copy the .jar file to wherever you like (I chose <tt>~/lib</tt>). | ||
- | # | + | # Launch NeoOffice/J. |
- | # | + | # From the '''NeoOffice/J''' menu, choose '''Preferences…'''. |
- | # On the left is a tree of items. At the very top is NeoOffice/J. Indented and underneath is a list of other items. Click on Security. | + | # On the left is a tree of items. At the very top is "NeoOffice/J". Indented and underneath is a list of other items. Click on "Security". |
- | # This changes the panel on the right. At the bottom is a Java section | + | # This changes the panel on the right. At the bottom of the right panel is a "Java" section; click the "Browse" button in that section. |
- | # Make sure that there are no other Connector/J versions installed (e.g., 3.1) or they will make life messy. To remove them, click the jar file to select, then click Delete. Repeat as necessary. (Note: not all items here are necessarily Connector/J archives, use some caution). | + | # This opens the "Select Archives" window. Make sure that there are no other Connector/J versions installed (e.g., 3.1) or they will make life messy. To remove them, click the jar file to select, then click Delete. Repeat as necessary. (Note: not all items here are necessarily Connector/J archives, use some caution). |
- | # Click the Add button. | + | # Click the "Add" button. |
- | # Browse to the directory the Connector/J 3.0 jar file | + | # Browse to the directory where you installed the Connector/J 3.0 jar file (in step 4). Select the .jar file and click the "Open" button. |
- | # Click the OK button. | + | # Click the "OK" button. |
# Exit NeoOffice/J. | # Exit NeoOffice/J. | ||
# Restart NeoOffice/J. | # Restart NeoOffice/J. | ||
- | # | + | # From the '''Tools''' menu, select '''Data Sources...'''; this opens the "Data Source Administration" window. |
- | # Above the panel on the left is a button that says New Data Source. Click it. | + | # Above the panel on the left is a button that says '''New Data Source'''. Click it. |
- | # | + | # In the right panel, select "MySQL" for "Database Type" and click "Apply". |
- | # Click the MySQL tab. | + | # Click the "MySQL" tab at the top of the right panel. |
- | # | + | # In the "Type of connection" section, select the radio button next to "Use Connector/J3". |
- | # Set the JDBC | + | # Set the "MySQL JDBC driver class" to: <tt>com.mysql.jdbc.Driver</tt> |
- | # | + | # In the "General" section, change the non-grey part of the "Data source URL" to: <tt>localhost:3306/test</tt> |
# Set the user name and check the password box, if required. | # Set the user name and check the password box, if required. | ||
- | # Click the Tables tab. | + | # Click the "Tables" tab at the top of the right panel. |
# Fill out your password if necessary. | # Fill out your password if necessary. | ||
- | # | + | # Ensure that no error message appears and that there is an entry in the white box. |
==== Configuration ==== | ==== Configuration ==== |
Revision as of 23:26, 16 September 2005
While NeoOffice/J 1.1 and OpenOffice.org/X11 do not include a separate database component like Microsoft Access, it is possible to use either program to connect to existing MySQL databases and enter or manipulate data, including creating detailed forms and reports. This article contains information on installing, configuring, and using a MySQL database with NeoOffice/J or OpenOffice.org/X11.
If you do not have a MySQL database, you can create a simple database in NeoOffice/J or OpenOffice.org/X11—or even use a Calc table if your needs are very simple.
Contents |
Enabling NeoOffice/J or OpenOffice.org/X11 to connect to MySQL databases
Using JDBC and Connector/J
Installation Overview
- Download Connector/J 3.0 from the MySQL website.
- The included README gives much information.
- The most important keypoints are:
- the class name of the JDBCdriver: com.mysql.jdbc.Driver
- the URL format: jdbc:mysql://host.domain/database_name
- You will need a version of Connector/J that supports Java 1.3.x, since that is the version of Java used in NeoOffice/J.
- Note: Connector/J 3.1 and, presumably, later versions are not Java 1.3.x compatible.
- The jar file location:
- for OOo/X11: you can put it where you want. To let OOo know, you shoud go to "Tools->Options" menu item. Then in the "security" pane, there is a place to add directories to classpath. Click on browse and find your jar file.
- for Neo/J: I had to put it in the <NeoOffice>/Contents/MacOS/classes folder to get it found. Didn't check with recent release if the previous classpath setting does work.
- FYI. I just tried adding the MySQL jar file using the Security pane in the Tools->Options menu item Neo/J 1.1 Alpha 2. After adding the jar file in that pane and restarting Neo/J, I successfully connected to my MySQL database.
- This works with Neo/J 1.1 final. The former option is probably better for providing it to all users, whereas this is well suited for
- There is also an attachment (.sxw) to OpenOffice.org Issue 13753 which contains screenshots and a different location for placing the Connector/J file.
Detailed Installation
- If you haven't already, install NeoOffice/J (I am using v1.1, downloaded 2005-08-14) and MySQL (I am using 4.1.13-standard).
- Download Connector/J 3.0 from http://www.mysql.com and save it to the Desktop. (I downloaded v3.0.17, the tar.gz version).
- Extract the Connector/J jar from the tar.gz archive.
- Copy the .jar file to wherever you like (I chose ~/lib).
- Launch NeoOffice/J.
- From the NeoOffice/J menu, choose Preferences….
- On the left is a tree of items. At the very top is "NeoOffice/J". Indented and underneath is a list of other items. Click on "Security".
- This changes the panel on the right. At the bottom of the right panel is a "Java" section; click the "Browse" button in that section.
- This opens the "Select Archives" window. Make sure that there are no other Connector/J versions installed (e.g., 3.1) or they will make life messy. To remove them, click the jar file to select, then click Delete. Repeat as necessary. (Note: not all items here are necessarily Connector/J archives, use some caution).
- Click the "Add" button.
- Browse to the directory where you installed the Connector/J 3.0 jar file (in step 4). Select the .jar file and click the "Open" button.
- Click the "OK" button.
- Exit NeoOffice/J.
- Restart NeoOffice/J.
- From the Tools menu, select Data Sources...; this opens the "Data Source Administration" window.
- Above the panel on the left is a button that says New Data Source. Click it.
- In the right panel, select "MySQL" for "Database Type" and click "Apply".
- Click the "MySQL" tab at the top of the right panel.
- In the "Type of connection" section, select the radio button next to "Use Connector/J3".
- Set the "MySQL JDBC driver class" to: com.mysql.jdbc.Driver
- In the "General" section, change the non-grey part of the "Data source URL" to: localhost:3306/test
- Set the user name and check the password box, if required.
- Click the "Tables" tab at the top of the right panel.
- Fill out your password if necessary.
- Ensure that no error message appears and that there is an entry in the white box.
Configuration
With the above basic setup, the connection should work. Then you come to the fine tuning stuff: charset, etc...
There are additional pointers available in this thread on trinity on other MySQL configuration issues.
Using OBDC
mansky posts some steps for getting OBDC to work with MySQL and OpenOffice.org/X11 in this post on trinity; it also contains other OOo/MySQL pointers.
kervalen posts some steps for getting OBDC to work with MySQL and NeoOffice/J in this post on trinity.
Using the Database with your NeoOffice/J Documents
information on how to use the database