Using MySQL

From NeoWiki

Revision as of 06:42, 15 August 2005 by ( | contribs)
Jump to: navigation, search

Contents

Enabling NeoOffice/J or OpenOffice.org/X11 to connect to MySQL databases

Using JDBC and Connector/J

Installation

  • 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

  1. 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).
  2. 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).
  3. Extract it.
  4. Copy the .jar file to wherever you like (I chose ~/lib).
  5. Open Neooffice/J.
  6. Go to the following Menu: Tools | Options...
  7. 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.
  8. This changes the panel on the right. At the bottom is a Java section. Click the Browse button.
  9. 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).
  10. Click the Add button.
  11. Browse to the directory the Connector/J 3.0 jar file is in. Select the .jar file and click the Open button.
  12. Click the OK button.
  13. Exit NeoOffice/J.
  14. Restart NeoOffice/J.
  15. Go to the following Menu: Tools | Data Sources...
  16. Above the panel on the left is a button that says New Data Source. Click it.
  17. Change the URL to: mysql://localhost:3306/test
  18. Click the JDBC tab.
  19. Set the JDBC Driver class to: com.mysql.jdbc.Driver
  20. Set the user name and check the password box, if required.
  21. Click the Tables tab.
  22. Fill out your password if necessary.
  23. Observe 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

Personal tools