markorocko Posted March 20, 2013 Share Posted March 20, 2013 Is it possible to do a dynamic query in iReport so that the SQL is passed in at runtime instead of saving it in a jrxml file? If so please demonstrate how.So, I'm using iReport and trying to pass in a query dynamically at runtime as a parameter. Rationale: The rationale in my case is that this query is used somewhere else in my java application so instead of hardcoding the same query I would rather just get it from java and pass it in as a parameter so I don't have to maintain two synced up copies.However, even trying to pass in a simple query like "select dummy from dual" chokes. JRXML looks like this [/code]But when I do it I get an errror below.Even when I do a simple test like selectCaused by: java.sql.SQLException: Invalid SQL type at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:147) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:209) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:76) at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:972) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1192) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3415) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3460) at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:137) ... 11 more Print not filled. Try to use an EmptyDataSource... Link to comment Share on other sites More sharing options...
rsuddhala Posted March 21, 2013 Share Posted March 21, 2013 Removed language="SQL" attribute from the query string element and check it once..Raviraj Link to comment Share on other sites More sharing options...
kcollins Posted March 21, 2013 Share Posted March 21, 2013 Hello,Try using the P!{} syntax rather than $P{}. $P!{} allows you to enter dynamic SQL. I just tested it for an entire query and it works for me.-Kris Link to comment Share on other sites More sharing options...
srinuydlp87 Posted August 6, 2014 Share Posted August 6, 2014 IS your problem solved. I am also getting same problem can you please post a answer. 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