In the following code, I'm retriving BLOB image from OracleXE database and sending the image to the browser. The table is OracleXE's COUNTRIES table (HR Schema) with BLOB gif images added. The browser displays all those images (flags) in a table.
My problem is, when I use SingleThreadedModel, it works perfectly. But in Multi threaded model, most of the time some of the images get missing.
I'm new to Java/JSP comming from VB background. Please help me to solve this problem. Thanks in advance!
The project contains 3 files: ShowImages.java - retrives BLOB image from DB. Countries.java - generates HTML table rows. StreamCopyTool.java - uti9lity to direct stream copy. index.jsp
ShowImages.class is mapped in "/myapp"
Edit: After I edited this post, the teread title got truncated !! :0
[ August 08, 2007: Message edited by: Piash Chaudhuri ] [ August 09, 2007: Message edited by: Bear Bibeault ]
Just as you said, I removed the Statement variable, and the problem is gone! I kept the Connection variable though - to speed up the servlet. Is there any better idea ?
Also, could you guys please point me some good tutorial on JDBC+Oracle ?
(I'm VERY new to Java. But have prior programming experience in VB. I've finished reading Just Java 2 and Servlet part of Core Servlets book. I need to do 2 projects in Servlet/JSP+Oracle for my degree, a Shopping portal and a Car Finance website.)
Any tutorial that might help me on this ?
And, thanks again for solving this problem. [ August 09, 2007: Message edited by: Piash Chaudhuri ]
May I also suggest you take a look at Java Persistence Architecture (JPA). It is a Plain Old Java Object development paradigm (With Annotations) for Database Access. It is part of J2SE and J2EE and the reference implementation is based on Oracle Essentials. I am a fan of this specification, and I know has helped me significantly delivering database solutions faster.
Also, Java Server Faces is a new interesting technology. For Delivering JSP Functionality. I believe it is the way for new development. JSF along with a tool set called Struts from the Apache Jakarta umbrella uses a Model View Controller (Design Pattern) infrastructure for JSP Development. I prefer these modes of development because it separates logical responsibilities.
Please weigh the learning curve on both of these and others. You may ask your professor if these tools are applicable for the items he is trying to teach. Many years ago we in the industry coded JDBC directly, and Servlets/ JSP's directly. I think we have matured a bit past this low level of development for efficiency and code structure and others. We will continue to evolve.
Good luck! Looks like you are on your way to a fantastic career!
Tony Sun Certified Web Business Component Developer Sun Certified Web Components Developer for J2EE Sun Certified Programmer for the Java 2 Platform
Tony McClay<br />Architect / Developer, SOA and Jave Enterprise Edition 1-5<br />---------------------------------------------------------------------- <br />Sun Certified Enterprise Architect, Enterprise Edition 5 (Step 1 of 3)<br />Sun Certified Web Component Developer, Enterprise Edition 4<br />Sun Certified Business Component Developer Enterprise Edition 5<br />Sun Certified Programmer , Standard Edition 5.0
posted 12 years ago
Thanks a lot Tony! I'll read the Sun J2EE tutoral.
As I've mentioned before, I have 4+ years of learning/working experience in VB6. After so many years of developing on M$ platform, I'm finding it very hard to change technology. The most dificult problem is, ironically, so many choices!!! And I always need to google when I see a new acronym like POJO/JINI etc.
Currently I'm in my final semester. For our projects we were free to choose our language/platform. I wanted to move forward from VB6.
My first preference was, oviously, C#, but our course has JSP. Not dotNet. As I had to learn Java/JSP for my course, and don't have much time to learn two languages simultaniously, I choose Java.
My project proposals already got approved. I don't think they will allow me to use JSF. But, thanks for your suggesation, I've already planned to learn JSF and Ajax after I finish this project. [ August 09, 2007: Message edited by: Piash Chaudhuri ]