Product Documentation

FairCom Hibernate SQL for Java

Previous Topic

Next Topic

Installing and Running the Tutorials

Different open source projects exist that implement the JPA specification. Popular projects include Hibernate and EclipseLink. This driver was developed using Hibernate version 5.4.12 and Java version 8.

Inside the drivers\java.sql.hibernate folder you will find the following files and folders:

  • ctreeACEDialect.jar - The dialect/driver that enables Hibernate to communicate with FairCom DB SQL.
  • tutorials - A folder containing an example project using the Gradle build system.

Requirements

You do not need to install Gradle for the tutorial to work. But you do need a working internet connection, because the tutorial build script will download all the necessary files for it to work.

Make sure you have Java version 8 installed and then access the tutorials folder using a command-line interface. You must have version 8 of the Java JDK, and not an earlier or later version. On Windows, you can use the “Apps & Features” control to list the installed programs, and it will show if you have JDK version 8 installed.

Setup

Run the following from the drivers\java.sql.hibernate\tutorials folder to install the demonstration table in the c-tree database and then to run the tutorial:

For Windows: BuildTutorials.bat

For Unix/Linux: make build; make run

You will be asked to press the <Enter> key several times as the batch file performs the various steps. Successful completion of the tutorial will be indicated by output that looks like this:

1000 Bryan Williams

1001 Michael Jordan

1002 Joshua Brown

1003 Keyon Dooling

Troubleshooting

error in tcp bind 10060
error(-20212): Error in Network Daemon
* or *
Caused by: ctree.jdbc.CtreeSQLException: Connection refused: connect

This error means that the driver could not reach the server. The most common cause is the FairCom Database Engine is not running on your machine. The most likely cause is that the c-tree evaluation license times out after 3 hours and shuts down the server. The solution is to restart the server. See Starting the FairCom Database Engine.

This error could also be caused by the FairCom Database Engine being blocked by the firewall.

Also, please make sure the hibernate.connection.url in hibernate.properties is correct.

ResourceException: Can't connect to database

This error means that the driver could reach the server but the database defined in persistence.xml does not exist. To fix this issue please either create the database for example using the FairCom SQL Explorer or adjust the database name in persistence.xml to match an existing database.

Adjusting the Connection Information

The connection information is stored in the hibernate.properties file. It can be found here:

drivers\java.sql.hibernate\tutorials\src\main\resources\hibernate.properties

How to Start Your Own Project

Gradle has become very popular. Many Java IDEs natively support Gradle-based projects now. Among those IDEs are IntelliJ and Eclipse.

A very good way to start a new project using the FairCom Hibernate driver for FairCom DB SQL is as follows:

  1. Copy the tutorials folder.
  2. Rename the project name in the settings.gradle file.
  3. Copy the FairCom DB JDBC and dialect jar files to a lib subfolder.
  4. Modify the build.gradle file and adjust the new driver files location.

Good luck and do not hesitate to reach out to FairCom if you need further help.

TOCIndex