Skip to content

Database Access Layer

Brian Gormanly edited this page Sep 25, 2016 · 3 revisions

Choosing your Database

4DFLib currently supports using

  • HyperSQL (configured by default)
  • MySQL
  • PostgreSQL

In order to set which database you want the library to use and tell it how and were to connect you can instantiate the FdfSettings singleton where before you initialize the library:

// get the 4dflib settings singleton
FdfSettings fdfSettings = FdfSettings.getInstance();

See FdfSettings for more details on how to configure your specific database or the Getting Started section of the wiki.

Implementing a custom database connection

If you wish to use a datastore besides HyperSQL, MySQL or PostgreSQL, see the following package for detail on how to implement it.

Queries

Queries are created by 4DFLib for any persistence implemented in 4DFLib with the CorePersistenceImpl interface.

See any of the currently implemented persistence stores for details and examples, such as the following MySQL ones:

Pull requests for additional database implementations are always welcome, we plan on adding more soon.