Jump to content

SQL_VALIDATION_PATTERN


joao.narezzi

Recommended Posts

I have a subreport that uses a query with variables (@variable). When publishing to jasperserver, the SQL_VALIDATION_PATTERN error occurs. I changed the security.validation.sql.on option to false but it didn't work. 

 

I use Jasperserver version 8.0

 

Any idea?

 

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi Joao, we don't recommend you turning off the sql validation, your system will be less secure and exposed to sql injection attacks. You can leave the validation on and adjust your regular expression to allow the @ symbole. Can you please share your jrxml file and the stack trace of the error in the japserserver.log file? Thanks

Link to comment
Share on other sites

>> I need to do the recursion from the start date to the end date. Example:

>> 2023-06-21 (Initial Date)>> 2023-06-25 (End Date)>> I need to create a table containing:>> 2023-06-21>> 2023-06-22>> 2023-06-23>> 2023-06-24>> 2023-06-25

 

In Oracle, I would use "CONNECT BY LEVEL" to assist in creating fake rows
 

SELECT extract(YEAR from SYSDATE) - LEVEL + 3 yrFROM DUALCONNECT BY LEVEL <= 7;SELECT trunc(SYSDATE) - LEVEL + 3 dtFROM DUALCONNECT BY LEVEL <= 7;[/code]

 

I'm sure other databases have a similar ability.

Another approach and more general would be to create a CTE with a cross join.  In the example below fake_rows returns 100 rows.  That is then used in MyDate to increment the date.  Works great for when I need to create a By Date revenue report and enforce a row for when there is no data on the given date.

with fake_rows as (    select a.fr, row_number() over (order by a.fr) as rn    from (        SELECT 1 AS fr from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual    ) a    cross join (        SELECT 1 AS fr from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual UNION ALL        SELECT 1 from dual UNION ALL SELECT 1 from dual    ) b), MyDate as (    select sysdate, sysdate + fr.RN as dt, rn    from fake_rows fr)select * from mydate;[/code]


 

Link to comment
Share on other sites

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