How to connect to MySQL databases with YajHFC


This short guide describes how to connect to MySQL databases with YajHFC for phone books. For instructions on how to connect to PostgreSQL, please see here.

  1. Download the MySQL JDBC driver:

    It is called "Connector/J" and can be downloaded from http://dev.mysql.com/downloads/connector/j/. Inside the downloaded archive, you will find the actual driver as a JAR file, which is called mysql-connector-java-[version]-bin.jar.
    Save this jar file somewhere on your harddisk.

  2. Load the driver in YajHFC:

    Open the options, go to Plugins & JDBC, click Add JDBC driver and select the jar file from step 1.

  3. Connect to the database:

    Open the YajHFC phone book window, select Phone book->Add to list->JDBC phonebook.

    Enter the following values in the New phone book window:

    Driver class: com.mysql.jdbc.Driver
    Database URL: jdbc:mysql://[host]/[database]
    User name: The user name to connect to the database
    Password: The password to connnect to the database

    Then, click Test connection.

    If everything is working well, you should get a message that the connection has been established successfully and you should be able to select the database tables from the table combo box.

    If you get an error message here, there is no point in continuing, as the phone book will not work.

  4. Select the table you want to get the phone book entries from and set the database field mapping:

    For every field combo box, select which database field corresponds to it.
    E.g.: If the database field for the first name is called FNAME in the database, select FNAME in the First name combo box.

    If the database does not have a corresponding field for a phone book field, simply leave its mapping as <none>.

  5. Click OK.

    Now you should be able to access your phone book from the phone book window.


Created by: Jonas Wolz

Last modification: Monday, 12-Dec-2016 11:52:07 CET