社区
Web 开发
帖子详情
如何在ireport中使用javabean数据源
wuliaowuliaoren
2004-09-02 04:10:18
如何在ireport中使用javabean数据源
...全文
183
1
打赏
收藏
如何在ireport中使用javabean数据源
如何在ireport中使用javabean数据源
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
qjhaaaaa
2004-09-03
打赏
举报
回复
public static Connection connectPostgers() throws SQLException
{
Connection mycon = null;
if (databaseDrvName == "")
{
databaseDrvName = "org.postgresql.Driver";
}
if (databaseURL=="")
{
databaseURL = "jdbc:postgresql://172.25.4.27/PTSII";
}
if (databaseUSER=="")
{
databaseUSER = "postgres";
}
if (databasePWD=="")
{
databasePWD = "";
}
try
{
Class.forName(databaseDrvName);
mycon = DriverManager.getConnection(databaseURL, databaseUSER,databasePWD);
}
catch (SQLException sqle)
{
System.out.println("connectDB() error:" + sqle.getMessage());
sqle.printStackTrace();
throw sqle;
}
catch (ClassNotFoundException cnfe)
{
System.out.println("connectDB() ClassNotFound error:" + cnfe.getMessage());
cnfe.printStackTrace();
throw new SQLException("ConnectDB() ClassNotFound error:" + cnfe.getMessage());
}
return mycon;
}
<%
File reportFile = new File(application.getRealPath("/reports/testparamter.jasper"));
Map parameters = new HashMap();
String sql = "SELECT * FROM balance_table WHERE part>='CACM104016-00B' AND part<='CAET000009-00A'";
//parameters.put("ReportTitle", "Address Report");
//parameters.put("BaseDir", reportFile.getParentFile());
parameters.put("SQLSTR",sql);
Connection conn = connectionDB.connectPostgers();
if(conn!= null){
System.out.println("connection success !");
}else{
System.out.println("connection fail !");
}
byte[] bytes =JasperRunManager.runReportToPdf(reportFile.getPath(),parameters,conn);
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();
%>
iReport
使用
JavaBean
做
数据源
iReport
使用
JavaBean
做
数据源
ireport
中
table
使用
javaBean
数据源
NULL 博文链接:https://shouzhang1-2.iteye.com/blog/1973767
图示
ireport
中
使用
javabean
作
数据源
开发基于jasperreports报表过程
博文链接:https://eneasy.iteye.com/blog/123348
ireport
利用
javabean
做
数据源
.docx
ireport
利用
javabean
做
数据源
.docx
Web 开发
81,122
社区成员
341,744
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章