Jump to content
Changes to the Jaspersoft community edition download ×

Subreports - can't get it to work


2004 IR Help

Recommended Posts

By: Henrik Larsson - henla464

Subreports - can't get it to work

2004-07-23 10:04

Hello

I have tried all day to get a simple subreport to work, it doesn't (I am using iReport 0.3.2).

 

I have a subReport containing transactions. And a masterReport with people.

 

If I set "Use connection expression" to $P{REPORT_CONNECTION} then I get an error message when trying to view the report (not when compiling): Error filling print... java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Anslutningen ä²upptagen med resultaten f?n annan hstmt at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115) at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:89) at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:466) at dori.jasper.engine.fill.JRFillSubreport.run(JRFillSubreport.java:413) at java.lang.Thread.run(Thread.java:534) NESTED BY : java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Anslutningen ä²upptagen med resultaten f?n annan hstmt at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115) at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:89) at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:466) at dori.jasper.engine.fill.JRFillSubreport.run(JRFillSubreport.java:413) at java.lang.Thread.run(Thread.java:534) NESTED BY : dori.jasper.engine.JRException: Error executing SQL statement for report : transactions at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:475) at dori.jasper.engine.fill.JRFillSubreport.run(JRFillSubreport.java:413) at java.lang.Thread.run(Thread.java:534) Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Anslutningen ä²upptagen med resultaten f?n annan hstmt at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115) at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:89) at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:466) ... 2 more Print not filled. Try to use an EmptyDataSource...!

 

"Anslutningen ä²upptagen med resultaten f?n annan hstmt" is swedish and translates to "The connection is busy with the results for an other hstmt"

 

If I dont set "Use connection expression" and just leave it as "Don't use any connection or datasource" then when viewing the master report, all people are listed but nothing is showing from the subReport.

 

========================================

My masterReport:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="classic"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<queryString><![CDATA[select * from persons order by personId]]></queryString>

<field name="personId" class="java.lang.Integer"/>

<field name="familyName" class="java.lang.String"/>

<field name="firstName" class="java.lang.String"/>

<field name="sex" class="java.lang.String"/>

<field name="dateOfBirth" class="java.sql.Timestamp"/>

<field name="userId" class="java.lang.String"/>

<field name="competitor" class="java.lang.Byte"/>

<field name="clubId" class="java.lang.Integer"/>

<field name="personIdInClub" class="java.lang.Integer"/>

<field name="VIPType" class="java.lang.Integer"/>

<field name="nationality" class="java.lang.String"/>

<field name="modifyDate" class="java.sql.Timestamp"/>

<field name="stamp" class="java.lang.String"/>

<variable name="test" class="java.lang.String" resetType="None" calculation="Nothing">

<variableExpression><![CDATA["test"]]></variableExpression>

<initialValueExpression><![CDATA["test"]]></initialValueExpression>

</variable>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="0" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="67" isSplitAllowed="true" >

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="2"

y="1"

width="78"

height="17"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.Integer"><![CDATA[$F{personId}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="86"

y="1"

width="83"

height="17"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{firstName}]]></textFieldExpression>

</textField>

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="17"

y="25"

width="500"

height="33"

forecolor="#000000"

backcolor="#FFFFFF"

key="subreport-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<subreportParameter name="ID">

<subreportParameterExpression><![CDATA[$F{personId}]]></subreportParameterExpression>

</subreportParameter>

<subreportExpression class="java.lang.String"><![CDATA["d:\Program files\iReport\iReport-0.3.2\transactions.jasper"]]></subreportExpression>

</subreport>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

========================================

My subReport:

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="transactions"

columnCount="4"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="133"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<parameter name="ID" isForPrompting="true" class="java.lang.Integer">

<parameterDescription><![CDATA[some description]]></parameterDescription>

</parameter>

<queryString><![CDATA[select * from transactions where personId = $P{ID} order by personId]]></queryString>

<field name="transactionId" class="java.lang.Integer"/>

<field name="eventId" class="java.lang.Integer"/>

<field name="clubId" class="java.lang.Integer"/>

<field name="personId" class="java.lang.Integer"/>

<field name="accountId" class="java.lang.Integer"/>

<field name="foreignAccount" class="java.lang.String"/>

<field name="verificationNo" class="java.lang.String"/>

<field name="amount" class="java.lang.String"/>

<field name="comment" class="java.lang.String"/>

<field name="transactionDate" class="java.sql.Timestamp"/>

<field name="modifyDate" class="java.sql.Timestamp"/>

<field name="stamp" class="java.lang.String"/>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="0" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="18" isSplitAllowed="true" >

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Opaque"

x="2"

y="2"

width="117"

height="14"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.Integer"><![CDATA[$F{personId}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Opaque"

x="136"

y="3"

width="110"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-2"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{amount}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

 

Please help...

 

 

 

 

 

By: Rick Millar - rmillar

RE: Subreports - can't get it to work

2004-07-23 16:21

See if the following thread helps. The person in that thread was getting the connection busy error message. Although not in Swedish. :-)

 

https://sourceforge.net/forum/forum.php?thread_id=1113610&forum_id=217623

 

 

 

 

By: Henrik Larsson - henla464

RE: Subreports - can't get it to work

2004-07-24 05:58

 

> https://sourceforge.net/forum/forum.php?thread_id=1113610&forum_id=217623

 

I tried using com.ms.jdbc.odbc.JdbcOdbcDriver instead of suns driver but it gave the same error message. How do I do to use two different connections?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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