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

Query epoch date in SQL Server does not work from Jaspersoft Server


heila.mckinley

Recommended Posts

I have a report which takes as an input parameter a date using the date picker.  The date is stored as an Epoch date in SQL Server.

When I run the report in Jaspersoft Studio it works.  The relevant bit of query looks like this:  and cr.open_date + 7200 >= datediff(ss, '19700101', '$P!{Open Date from}' )

I publish the report to Jaspersoft Server and when I try to run it I get error below.  What am I doing wrong?  

The server has encountered an error. Please excuse the inconvenience.

Error Message

Error filling report

Error Message

net.sf.jasperreports.engine.JRException: Error executing SQL statement for: BCC Tickets created.

Error Message

java.sql.SQLDataException: [Tibcosoftware][sqlServer JDBC Driver][sqlServer]Conversion failed when converting date and/or time from character string.

Link to comment
Share on other sites

  • 4 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I would use the java.util.Date.getTime() method to get the epoch, and compare the epoch field using that parameter.

Create a second parameter (name it OpenDateFromEpoch) that performs that translation, and use the second parameter in the query.

Something like :

and cr.open_date  >= $P{OpenDateFromEpoch}' 

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