aspose file tools*
The moose likes JDBC and the fly likes how get datasource object  in sun java studio creater Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how get datasource object  in sun java studio creater" Watch "how get datasource object  in sun java studio creater" New topic
Author

how get datasource object in sun java studio creater

muhammad fahim
Ranch Hand

Joined: Dec 17, 2006
Posts: 45
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
 
subject: how get datasource object in sun java studio creater