My experience with the Informix JSON Listener and Mongo PHP driver for app development was not what I expected. It was in fact easier and more pleasant than I thought it would be. I had some experience with traditional relational databases before my internship, but only here at IBM Lenexa did I use Informix for the first time. When first assigned to work on a project that used both SQL and NoSQL technologies simultaneously, it seemed daunting. I had no idea how NoSQL worked, let alone combine it with regular SQL queries. Once I started to research more about MongoDB (whose driver was used to communicate with Informix via the JSON Listener), those feelings rapidly went away.
The concept behind the JSON Listener was very intuitive. It allows you to communicate to Informix, which is a relational database by nature, as a document collection database. Having previously worked with JSON for web pages that use AJAX and libraries such as JQuery, learning this Mongo syntax felt very familiar. In addition to this, the JSON Listener allows you to pass SQL statements to the database through the use of a special SQL collection. By doing this you can perform certain SQL only operations and still get logical results. This opened up new possibilities for developing apps by allowing to choose different models for different jobs. All this was provided without the need to install and PDOs, drivers or extensions besides the Mongo driver.
I used PHP for the back-end of the applications I worked on. From PHP’s point of view, the server “thinks” it is communicating with a MongoDB instance via the Mongo driver. In reality, the JSON Listener interfaces with the PHP server and the Informix server. However, both the collection model and regular relational table models are accessible via both the Mongo syntax JSON queries or the SQL statements via the SQL collection. This hybrid environment allowed me to use the advantages of each model when necessary, and quickly prototype certain functions using collections with flexible schemas. From the traditional SQL perspective, I have the power of transactions, joins, data types, sharding, analytics and other features present in Informix. If I needed a specific SQL function I could simply use the special SQL collection and pass it the SQL query. In these cases though one would need to sanitize statements manually due to the lack of PDOs which have built in functions that prepare the statements.
The Mongo side of the development perspective was useful for various reasons. As a developer I felt I could extract information directly from the web pages and store them on the database with no hassle. Using JavaScript objects and passing them to the server, they were already in the format that it would be stored. In PHP I could do validation if necessary before entering the data in the database. Furthermore, these document collections are queried using JSON objects via the Mongo PHP driver. This makes creating queries based on selected fields in the web pages very easy and eliminates the need to use prepared statements and sanitizing entries for fear of SQL injection. However, the real beauty of it all is that it is actually backed up not by MongoDB, but by a Informix database. The JSON Listener took care of the translations and operations behind the scene.
This is just the beginning of the possibilities for this hybrid development structure. I believe this structure will be more common in the future of app creation than simply choosing only SQL or only NoSQL. The more tools are given to developers, the more creative they can be and more choices they have for tackling their problems. That is what developers want, reliable and varied tools to solve their problems. Informix is working hard to provide that with the JSON Listener. This technology will help drive the next generation of web based applications in an industry where time is precious, rapid prototyping is preferred and scalability is key. With NoSQL capabilities infused to IDS, Informix is off to a great start.