*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
jQuery in Action, 2nd edition
 
subject: how get datasource object in sun java studio creater
 
Similar Threads
Jasper Reports Exception
JasperReports - Desparate Help Required!
Problem when give the Jasper Reports complied file name
Path error with JasperReports
see my code that give me error