czupet Posted September 2, 2013 Share Posted September 2, 2013 I have MS Access database report and several dozen MS Access databases, each Database is named like 1234,5678, 4444, all the same layout.I don't what to copy and maintain the same report for each database, is there a way to create one report and have user enter a number as a parameter and then dynamically create a connection to the database in the report? Thank You Peter Link to comment Share on other sites More sharing options...
AnjumAbbas Posted September 3, 2013 Share Posted September 3, 2013 Create a parameter to pass in the database name eg $P{databaseName} then use it in a query for example using the $P!{databaseName} with the exclamation mark which means its a dynamic parameter.Anjum Link to comment Share on other sites More sharing options...
vaibhav.lather Posted September 3, 2013 Share Posted September 3, 2013 yes anjumAbbas is right pass parameter . here is example code JRDesignQuery query = new JRDesignQuery(); query.setText("SELECT * FROM Address $P!{OrderByClause}"); jasperDesign.setQuery(query); or u can set this type of query in query editor. Link to comment Share on other sites More sharing options...
czupet Posted September 3, 2013 Author Share Posted September 3, 2013 But how do you create the dynamic connection to the database?for example:I have 2 DSNs in my ODBC manager both for Access Database1) DB1234 - It's pointing to C:Databases12345.MDB2) DB5678 - It's poiting to C:Databases5678.MDBBoth databases have the same table names and same layoutI have 1 report and I want a user to run the report get a prompt for the number and if user enters 1234 the report will use DB1234 DSN and if user enters 5678 the report will use DB5678 DSN.Is this possible ? Link to comment Share on other sites More sharing options...
rohit_chawla36 Posted May 8, 2014 Share Posted May 8, 2014 I am using ireort designer 5.5.0 for generating jasper reports. I am having similar requirements(as user czupet had) where I have to select the database attributes dynamically such as database host name, user id, password etc based on the user input say local DB or dev DB. How this can be acheived using ireport designer? Your suggestions are appreciated. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now