Subreport with iReport and Java - The supplied java.sql.Connection object is null

I'm studying iReport Design and I started using Connection at my fillReport. Until then, it's ok. The problem is that, now, I'm using Collection, with the commands:

List<Sales> sales = new SalesDAO().getSalesByDate(
                new SimpleDateFormat("yyyyMMdd").parse("20180101"),
                new SimpleDateFormat("yyyyMMdd").parse("20180131")
JRDataSource dataSource = new JRBeanCollectionDataSource(sales);

In those way, when I try execute, it's show me the following error:

WARNING: The supplied java.sql.Connection object is null.

jorgew.moura's picture
Joined: Feb 14 2018 - 11:33am
Last seen: 4 months 2 weeks ago

1 Answer:

You need either to pass the connection expression or the data source expression to the subreport. Since your subreport is not SQL based and is instead bean based so you'll need to bind the subreport to bean data source using the data source expression. Try something like this:


Here is a good stackoverflow post about this:

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 1 week 2 days ago