ireport 报错(在线等。。。)
package util;
import java.sql.*;
import java.util.*;
import net.sf.jasperreports.engine.*;
public class iReport {
public static Connection getMysqlConn(){
String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=test";
Connection dcon = null;
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
dcon=DriverManager.getConnection(url,"sa","");
} catch (Exception e) {
e.printStackTrace();
}
return dcon;
}
public static void main(String[] args)
{
try{
JasperReport jasperReport;
jasperReport = JasperCompileManager.compileReport("E://tradResport.jrxml");
HashMap map = new HashMap();
JasperPrint jasperPrint1 = JasperFillManager.fillReport(jasperReport,map,getMysqlConn());
JasperExportManager.exportReportToPdfFile(jasperPrint1,
"E://news.pdf");
JasperExportManager.exportReportToHtmlFile(jasperPrint1,
"E://news.html");
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println("输出报表成功");
}
}