camnott Posted February 23, 2018 Share Posted February 23, 2018 Caused by: java.lang.ClassCastException: com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to net.sf.jasperreports.engine.JRDataSourceI am trying to create a connection to a data source for my subreport - here is parameter expression :(Blocked out company information for this)<parameter name="subreport_datasource" class="java.sql.Connection" isForPrompting="false"> <defaultValueExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:sqlserver://Host;databaseName","user","pword")]]></defaultValueExpression> </parameter>[/code] Link to comment Share on other sites More sharing options...
mlopez_1 Posted February 24, 2018 Share Posted February 24, 2018 The parameter is well.Perhaps the problem is where you use it.Mariano Link to comment Share on other sites More sharing options...
Solution Friendly User Posted February 28, 2018 Solution Share Posted February 28, 2018 Here you try to pass a connection as the data source parameter. Try to pass it as reports connection expression. Link to comment Share on other sites More sharing options...
camnott Posted March 8, 2018 Author Share Posted March 8, 2018 Thank you "Friendly User" - This was the issue. It is now working the way that I need it to. 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