Awesome Open Source
Awesome Open Source

Cosyan DB

Cosyan DB is an SQL based transactional RDBMS with sophisticated multi table constraint logic and language enhancements building heavily on foreign keys.

Users, contributors and constructive feedback is welcome! Please don't forget to hit a star if you like the project.

The long term goal of the project is to substitute the business logic layer (like what you would do in Java EE). This approach comes with some immediate benefits:

  • Faster development cycle: no need for coding in Java EE, wait for releases, new deployment, just submit the logic as an SQL statement.
  • Dependency tracking: no need to think about which constraint can be broken by a particular insert, update or delete on a certain table. This is something triggers usually do not cover.
  • Performance: no need for multiple queries to check constraints. More, this integrated can optimize constraint evaluation by caching.


Cosyan DB can be used as a standalone database server, or it can be embedded in a JVM app.

Standalone database server

  • Install Java 8 or later.
  • Download a release from here, or clone this repo and compile from source with Gradle.
  • Unpack the JAR and web files into a destDir.
  • Configure under the destDir/conf dir.
  • Start and stop the database with and
  • Use the built in Web UI or use the HTTP API to submit queries or edit the data directly.

Embed in your JVM project

Alternatively you can embed it into a Java project and submit queries through the Java API.

Config config = new Config("destDir/conf");
DBApi dbApi = new DBApi(config);
Session session = dbApi.newAdminSession();
JSONObject result = session.execute("select * from table;").toJSON();


In addition to SQL, extra features are introduced to help with multi-table constraints:

  • Columns in other tables can be directly referred to via chains of foreign keys.
  • Aggregated views can be defined on one to many relationships - i.e. reverse foreign keys - and used in constraints.

Cosyan DB supports the following SQL DML features:

  • Select
  • Distinct
  • Where
  • Group by
  • Having
  • Order by
  • Inner, left and right join
  • Arithmetic and logical expressions
  • Insert
  • Delete
  • Update

DDL features:

  • Create/drop table
  • Create/drop index (on one attribute)
  • Alter table add/drop column
  • Alter table add/drop constraint

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
java (31,749
database (1,253
sql (741
nosql (179
constraints (45
rdbms (22