Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how get datasource object in sun java studio creater

 
muhammad fahim
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir how i get datasource object for passing to ireport for calling jrxml report

i use this code


Context ctx = null;
DataSource ds = null;
try {
ctx = new InitialContext();
ds = (DataSource) ctx.lookup("jdbc/as400");
} catch (NamingException ex) {
ex.printStackTrace();
}

Connection conn = ds.getConnection();

ServletOutputStream ouputStream = response.getOutputStream();
JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, conn);



but this line give me error

Context ctx = null;
ctx = new InitialContext();

} catch (NamingException ex) {

ServletOutputStream ouputStream = response.getOutputStream();
JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, conn);


please give me idea how i call ireport

thank's

aamir
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic