Faq/Base/008

    From The Document Foundation Wiki
    < Faq‎ | Base

    How can I connect to a MySQL database?

    We have just introduced a new, addtional for MySQL. But, unless you use the MySQL connector extension (see below), you always have to know what type of connection you want to use. Please refer to the MySQL specifications page http://dba.openoffice.org/specifications/MySQL_data_source_page.html ,

    First of all you have to decide which driver you are going to use. At this point there are three possibilities. You can use an ODBC driver, the JDBC driver, or install the MySQL Connector extension.

    ODBC

    You can get a first glimpse of the driver on the site unixODBC in the documentation section.

    JDBC

    The following steps are only valid for a MySQL connection.

    • Get the new JDBC driver from http://www.mysql,com (or your distribution repository)
    • Start LibreOffice and open the dialogue box "Options" under "Utils > Options". Here choose "Security" and press the "Add" button to the *.jar files for your driver.
    • Re-open LibreOffice
    • Under "Utils > Data sources" over the database administration dialogue box
    • Press the button "New Database" and enter a valid name like MySQLJDBD and set the type to JDBC.
    • Enter the URL of the MySQL server, for example mysql://localhost/DatabaseName
    • Select the JDBC tab. Enter the name of the driver class. For the MySQL driver you should put "com.mysql.jdbc.Driver". If you use some other driver you should refer to your manual for the correct name of the driver.
    • Now you enter the username and, if you have a password, mark the checkbox.
    • To ensure your parameters are recorded, press the "Apply" button.
    • To test whether you can connect to MySQL, click the Tables tab.


    MySQL Connector Extension

    Go to MySQL Connector for the installation and use of the MySQL database connector. If all goes well, you should now see the tables in the database. If the connection did not succeed, the control table in the middle will be inactive.