• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

how get datasource object in sun java studio creater

 
Ranch Hand
Posts: 45
  • 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
 
Always! Wait. Never. Shut up. Look at this tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!