Jump to content
We've recently updated our Privacy Statement, available here ×

Specifying MongoDB subreport connection


Recommended Posts

Hi guys,

I'm using Jaspersoft Studio 5.5.0

I have a report which connects to MongoDB database

I have a subreport which connects to a different MongoDB database

When I intergrate the subreport into the report, I need to specify an alternative connection via "Use another connection" option in Subreport withard.

I googled and found anwers for sql databases like the following: "Choose the Use another connection option and type java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5432/jasperdb5a", "postgres", "postgres")" expression in the area below

My question is: What is the expression format for Mongo DB?  

Thank you!

Eugene

Link to comment
Share on other sites

  • 2 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Ok, so you need to follow these 3 steps:

  1. Add the jaspersoft mongodb driver jar to your build path (under project->properties->java build path->add external jar).
  2. Include this code in your jrxml - <import value="com.jaspersoft.mongodb.connection.*"/>
  3. Your subreport expression will be like this <connectionExpression><![CDATA[new com.jaspersoft.mongodb.connection.MongoDbConnection("mongodb://x.x.x.x:27017/xxx", "username", "password")]]></connectionExpression>

Hope that helps!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...