dre-day Posted March 2, 2011 Share Posted March 2, 2011 I cannot get IReport to commit after an insert query. Are insert queries possible in IReport?INSERT INTO TEMP_TABLE (BILL_ACCT_NBR, ORDER)SELECT ltrim('$P!{temp}','and bill_acct_nbr = '),order FROM ORDERS WHERE 1=1 $P!{order};COMMIT Link to comment Share on other sites More sharing options...
cbarlow3 Posted March 2, 2011 Share Posted March 2, 2011 No, no, no, no, no. Only SELECT. It's intended to be a read-only product.CarlP.S.: I'm going to have nightmares tonight about our clients updating their database through report design/running. Link to comment Share on other sites More sharing options...
dre-day Posted March 7, 2011 Author Share Posted March 7, 2011 I'm aware that its meant as a read-only product. But I really need to insert a record when the report is ran. Is there another way this can be achived? Post Edited by dre31186 at 03/07/2011 19:55 Link to comment Share on other sites More sharing options...
Gaby38 Posted March 8, 2011 Share Posted March 8, 2011 I succeeded to run insert query in a Jasperreport by running this insert query inside a stored procedure/function.For instance you define a stored function which runs your insert query and after returns a value (no matters : logicaj, integer,...) and you can get this value in a field even if you don't care but jasper is happy and won't give an error.It was just a test and I never used that in production.(In fact, I wanted to update dynamically the list of recipients for a scheduled job by inserting their id in the right jasperdatabase table. But perhaps is it a little crazy ..!!)PS: just a precision my test was running under jasperserver and I didnot use a commit statement : but the inserted values were present inside the table.Post Edited by Gaby38 at 03/08/2011 19:36 Link to comment Share on other sites More sharing options...
dre-day Posted March 22, 2011 Author Share Posted March 22, 2011 I attempted to do the same thing by running a stored procedure, but Im usure on how to pass parameters from ireport to the procedure. Link to comment Share on other sites More sharing options...
raylee Posted February 24, 2012 Share Posted February 24, 2012 Parameters are used the same whether it's stored proc or a query:stored_proc($P{parameter})Post Edited by raylee at 02/24/2012 21:52 Link to comment Share on other sites More sharing options...
beacon_bharg Posted May 19, 2020 Share Posted May 19, 2020 Hey... there is a surprise. /sites/all/libraries/ckeditor/plugins/smiley/images/heart.png Link to comment Share on other sites More sharing options...
beacon_bharg Posted May 19, 2020 Share Posted May 19, 2020 Hey... there is a surprise.Yes you cannot use insert/update queries as functionality. but you can run insert/update queries easily. you need not to put "commit" after query. The jasper will through error at the time of execution, but the query will be executed for sure. This is how I did it.I have added an addional dataset where the insert statement is written.Inserted a list/table in report pointing to the newly created dataset.Done.The jrxml will complile without any error.While execution you will get error as "Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Unable to get next record from result set." Dont worry.PS. I have successfully done this for number of times. 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