camnott Posted February 23, 2018 Share Posted February 23, 2018 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://HostName;dbName","username","password")[/code]Now - Before anyone answers saying that I should not have the //HostName 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? Link to comment Share on other sites More sharing options...
sergey.vishnevetskiy Posted February 23, 2018 Share Posted February 23, 2018 Try doing what is suggests, like:java.sql.DriverManager.getConnection("jdbc:sqlserver://Host\Name;dbName","username","password")[/code]Yeah, just adding slash. Link to comment Share on other sites More sharing options...
camnott Posted February 23, 2018 Author Share Posted February 23, 2018 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 Link to comment Share on other sites More sharing options...
sergey.vishnevetskiy Posted February 23, 2018 Share Posted February 23, 2018 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? Link to comment Share on other sites More sharing options...
Friendly User Posted February 28, 2018 Share Posted February 28, 2018 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. 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