Error with Subreport Expression

0

Hello.

This issue stems from my report concept.  I am trying to create a main report that houses minimal information. I then have a sub report that pulls in some related information from other db tables.

I am trying to add another subreport that uses a separate datasource from the other two reports.  I have searched online and found a solution that I thought would work, and I still think that it would work, if not running into this issue :

java.sql.DriverManager.getConnection("jdbc:sqlserver://Host\Name;dbName","username","password")

Now - Before anyone answers saying that I should not have the //Host\Name portion - I know this... This is my problem...

When the DBA's in my organization named this, they added that backslash ( \ ) into the hostname. I cannot get around this if I want to connect.

I was able to create a Data Adapter using this, but cannot create an expression using the same. Kicks out the following : Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\)

Is there a workaround, or another method that will be equally successful? The report runs, and the first subreport shows its data, but second subreport shows nothing, no matter what I do (because it is not getting data from the correct data source)

Any Ideas?

camnott's picture
86
Joined: Mar 10 2017 - 6:24am
Last seen: 1 year 4 months ago

4 Answers:

1

Try doing what is suggests, like:

java.sql.DriverManager.getConnection("jdbc:sqlserver://Host\\Name;dbName","username","password")

Yeah, just adding slash.

sergey.vishnevetskiy's picture
Joined: Jan 2 2018 - 10:13am
Last seen: 2 months 2 weeks ago
0

Thank you for your comment,  that just produced a different error - which leads me to believe that the first error was not the issue in the first place... : 

 

com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to net.sf.jasperreports.engine.JRDataSource

camnott's picture
86
Joined: Mar 10 2017 - 6:24am
Last seen: 1 year 4 months ago
0

Ok, and how about create subreport report by itself, like independent one. And then just choose it when making subreport in main report. Maybe sending some parameters. And don't bother with passing datasource at all?

sergey.vishnevetskiy's picture
Joined: Jan 2 2018 - 10:13am
Last seen: 2 months 2 weeks ago
0

Sounds like you pass that value in data source expression and it's returning you an SQL Connection. Maybe try passing it in the connection expression for the subreport instead.

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 4 days 1 hour ago
Feedback