Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does any embedded DB support JSON datatype?

I'm developing a Spring based web application with postgresql as database. I'm using JSON Datatype in postgresql. I have configured the entity with hibernate custom user type to support JSON Datatype.

Now i want to test my DAO objects using any embedded DB. Is there any embedded DB that support JSON data type which can be used in spring application.

like image 482
Shaheer Avatar asked Oct 07 '15 18:10

Shaheer


People also ask

Which databases support JSON?

For the record, MongoDB is not the only JSON native database. Several databases, including RethinkDB, deal with JSON natively. A big difference between the JSON support in MySQL, Postgres, and MongoDB is that in MongoDB, this is the native transport across the wire as well.

Can we store JSON in database?

You can store JSON documents in SQL Server or SQL Database and query JSON data as in a NoSQL database. This article describes the options for storing JSON documents in SQL Server or SQL Database.

Does Oracle support JSON data type?

Oracle Database supports JavaScript Object Notation (JSON) data natively with relational database features, including transactions, indexing, declarative querying, and views.

Does MySQL support JSON data type?

MySQL supports a native JSON data type defined by RFC 7159 that enables efficient access to data in JSON (JavaScript Object Notation) documents. The JSON data type provides these advantages over storing JSON-format strings in a string column: Automatic validation of JSON documents stored in JSON columns.


1 Answers

When you use database specific features - like JSON support in PostgreSQL, for safety you have to use the same type of database for testing. In your case you want to test your DAO objects:

  • assume that PostgreSQL is installed on localhost and make sure that it is the case for all environments where tests run
  • or even better - try using otj-pg-embedded which downloads and starts PostgreSQL for JUnit tests (I haven't used it in real life projects)

Update

If you are able to run Docker in your test environment instead of embedded databases use real Postgres via TestContainers

like image 160
Maciej Walkowiak Avatar answered Sep 20 '22 14:09

Maciej Walkowiak