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

How can we ignore passing connection in fillReport() Method?


subodhjoshi82

Recommended Posts

 

Hi ,

I created a Simple report with the help of iReport Designer4.8 and query is part of this report or DynamicWithQuery.jrxml file .Right now I have wrote this Java Method to Generate the report.

    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
       Connection     conn = DriverManager
                    .getConnection("jdbc:sqlserver://localhost\dev:1444;databaseName= dev;user=dev1;password=dev1");
            InputStream input = getClass().getClassLoader()
                    .getResourceAsStream("DynamicWithQuery.jrxml");

            JasperDesign jasperDesign = JRXmlLoader.load(input);
            JasperReport jasperReport = JasperCompileManager
                    .compileReport(jasperDesign);
            Map parameters = new HashMap();
            parameters.put("userId", "SA");
            JasperPrint jasperPrint = JasperFillManager.fillReport(
                    jasperReport, parameters, conn);

            JasperViewer.viewReport(jasperPrint);,>,>

Can it possible to Get query from the Jrxml page and pass paramter to that query and result set to report rather than passing connection ?

Note:-I dont want to remove query from Jrxml file

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...