File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
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