* How does BIRT connect to MongoDB?

Key words : BIRT MongoDB JDBC

MongoDB is different from Oracle, MySQL and other relational databases. It does not provide JDBC connection, and the query language is not SQL, but a set of somewhat complex script language.

How to connect MongoDB in BIRT is usually in two ways:

1. Create a new scripted data source, define its data set, write JavaScript in the open and fetch events, and call Mongo Java driver to fetch data from MongoDB.

2. Later, BIRT added a special MongoDB data source type, so that there was a special MongoDB data set definition interface, and it saved the trouble of writing MongoDB script for simple query, but it still can’t handle grouping aggregation and join.

Is there any JDBC of MongoDB? esProc JDBC provides the third connection method. Here is two table join as an example:

1.    Write esProc SPL script, and store it as a file of c1c2Join.dfx.


A

1

=mongo_open("mongodb://127.0.0.1:27017/raqdb")

2

=mongo_shell(A1,"c1.find()").fetch()

3

=mongo_shell(A1,"c2.find()").fetch()

4

=A2.join(user1:user2,A3:user1:user2,output)

5

>A1.close()

The execution result is:

user1

user2

income

output

1

2

0.56

0.3

1

3

0.26

0.4

The Mongo script with the same function is as follows:

1png

2. Deploy esProc JDBC in BIRT, and then call the above file name in the statement executed by JDBC:

2png

In fact, there is not much difference between the advantages and disadvantages in the way BIRT connects MongoDB. However, how BIRT queries MongoDB, which users are asking, implies a difficulty that is not explicitly stated. It should be asked:

1.  How does BIRT connect to MongoDB?

2.  What is the simple way to query data after connecting? The query script of MongoDB is too hard to write.    

esProc provides a more general JDBC connection mode, which is a small improvement; while the SPL script provides efficient query computing capabilities such as join, merge, condition, grouping aggregation, sorting, etc., which is a big improvement.The above example is taken from the following:esProc-driven MongoDB Hackers

For many difficult calculations of MongoDB, you can refer to SPL assists MongoDB calculation.

esProc provides JDBC driver, and can be easily integrated with BIRT and other reporting tools. For detail,please refer to How to Call an SPL Script in BIRT

It's also easy to embed esProc into Java applicationsplease refer to How to Call an SPL Script in Java

For specific usage, please refer to  Getting started with esProc