JDBC and Servlet Sample Code
JDBC and Servlet Sample Code
Dear David,
First please fogive me for my poor English.
I found your site 3 days ago and I really love it. But I have one question now and can't solve it by myself.
I have downloaded jdbcservlet2.zip from your site and the Batik stuff for SVG support. After I unzipped the package and put these files into my tomcat/WEB-INF/classes directory, I tried to compile these files but found an error---No such method: getServletContextName().
I wan't to know if you installed this package successfully.
In addition, I don't know how to build a test database to run the demo via servlet?
If you are so kind to tell me how to install the servlet package and test its result, I will be very happy.
Thank you
Jenny
First please fogive me for my poor English.
I found your site 3 days ago and I really love it. But I have one question now and can't solve it by myself.
I have downloaded jdbcservlet2.zip from your site and the Batik stuff for SVG support. After I unzipped the package and put these files into my tomcat/WEB-INF/classes directory, I tried to compile these files but found an error---No such method: getServletContextName().
I wan't to know if you installed this package successfully.
In addition, I don't know how to build a test database to run the demo via servlet?
If you are so kind to tell me how to install the servlet package and test its result, I will be very happy.
Thank you
Jenny
Re: JDBC and Servlet Sample Code
BTW, I don't have the servlet-demo.html file in the package, so I'm not sure if this file is necessary.
thank you again.
Jenny.
Pls, I'm very glad to hear any friend suggestions.
thanks all of you:)
thank you again.
Jenny.
Pls, I'm very glad to hear any friend suggestions.
thanks all of you:)
Re: JDBC and Servlet Sample Code
Hi Jenny, please refer to this link, you may find it helpful
http://www.object-refinery.com/phorum-3 ... 521&t=1518
Regards,
Navin Pathuru
http://www.object-refinery.com/phorum-3 ... 521&t=1518
Regards,
Navin Pathuru
Re: JDBC and Servlet Sample Code
Hi,Navin Pathuru:
I have read it but... it still can't solve my problem. .
the "servlet-demo.html" isn't included in the zip file, what shall I do?
Perhaps there is another package including all files needed, and I didn't find it. Do you have any idea about it?
thank you for your attention.
Hope to see your answer soon
jenny
I have read it but... it still can't solve my problem. .
the "servlet-demo.html" isn't included in the zip file, what shall I do?
Perhaps there is another package including all files needed, and I didn't find it. Do you have any idea about it?
thank you for your attention.
Hope to see your answer soon
jenny
Re: JDBC and Servlet Sample Code
Hi Jenny, If you are trying to access the JFreeChartServletDemo using a html file, you can do this:
1. Create a Html file with any name:
2. Paste this in the HTML file:
<img SRC="servlet/com.jrefinery.chart.demo.JFreeChartServletDemo" >
3. Save the file.
4. Make sure you save the class files in the directory /WEB-INF/classes/com/jrefinery/chart/demo
5. Bring up the html file using Internet Explorer and you should be able to access the servlet. Type the URL as http://localhost/AnyFile.html
Hope this helps.
Regards,
Navin Pathuru
1. Create a Html file with any name:
2. Paste this in the HTML file:
<img SRC="servlet/com.jrefinery.chart.demo.JFreeChartServletDemo" >
3. Save the file.
4. Make sure you save the class files in the directory /WEB-INF/classes/com/jrefinery/chart/demo
5. Bring up the html file using Internet Explorer and you should be able to access the servlet. Type the URL as http://localhost/AnyFile.html
Hope this helps.
Regards,
Navin Pathuru
Re: JDBC and Servlet Sample Code
Hi All,
Bryan Scott sent me a new servlet demo WAR file which is available for download from the JFreeChart project page on SourceForge:
http://sourceforge.net/projects/jfreechart
The file is quite large as it contains Xerces and Batik jar files, but it has everything you need to run the servlet demo (apart from a JDBC driver).
Regards,
DG.
Bryan Scott sent me a new servlet demo WAR file which is available for download from the JFreeChart project page on SourceForge:
http://sourceforge.net/projects/jfreechart
The file is quite large as it contains Xerces and Batik jar files, but it has everything you need to run the servlet demo (apart from a JDBC driver).
Regards,
DG.
Re: JDBC and Servlet Sample Code
Dear Navin Pathuru and David Gilbert,
thank you two again!
I've downloaded the new war. I think everything should be Ok then.
Regards,
jenny
thank you two again!
I've downloaded the new war. I think everything should be Ok then.
Regards,
jenny
Re: JDBC and Servlet Sample Code
Error !!!
Error: 500
Location: /JFreeServlet/servlet/example2
Internal Servlet Error:
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletContextName()Ljava/lang/String;
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.openConnection(BaseImageServlet.java:676)
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.init(BaseImageServlet.java:346)
at com.jrefinery.chart.demo.jdbc.servlet.ImageSelectSQL.init(ImageSelectSQL.java:67)
at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
at org.apache.tomcat.core.Handler.init(Handler.java:215)
at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
at org.apache.tomcat.core.Handler.service(Handler.java:254)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)
How can I do with this problem?
Error: 500
Location: /JFreeServlet/servlet/example2
Internal Servlet Error:
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletContextName()Ljava/lang/String;
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.openConnection(BaseImageServlet.java:676)
at com.jrefinery.chart.demo.jdbc.servlet.BaseImageServlet.init(BaseImageServlet.java:346)
at com.jrefinery.chart.demo.jdbc.servlet.ImageSelectSQL.init(ImageSelectSQL.java:67)
at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
at org.apache.tomcat.core.Handler.init(Handler.java:215)
at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
at org.apache.tomcat.core.Handler.service(Handler.java:254)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)
How can I do with this problem?
Re: JDBC and Servlet Sample Code
and who knows how to configure this DBschema param-value?
<context-param>
<param-name>DBschema</param-name>
<param-value>???</param-value>
</context-param>
<context-param>
<param-name>DBschema</param-name>
<param-value>???</param-value>
</context-param>
Re: JDBC and Servlet Sample Code
Jenny
DBSchema parameter is the owner of the database objects. It allows connection to the database as a user with read only access.
ie. select column from DBSchema.table
I will add some description of the DB context parameters to the download.
With regard to the exception. I compiled against a servlet 2.3 container (ie tomcat 4.0) which supports the method. A quick fix for servlet 2.2 containers is to
Change line 676 in com\jrefinery\chart\demo\jdbc\servlet\BaseImageServlet.java
from : getServletContext().setAttribute(SHARED_DB_OPENER, getServletContext().getServletContextName());
to : getServletContext().setAttribute(SHARED_DB_OPENER, servletName);
(this is required to get source to compile as JDeveloper 9i RC does not support servlet 2.3 spec).
However I will have a new war file with these two changes done by tomorrow.
DBSchema parameter is the owner of the database objects. It allows connection to the database as a user with read only access.
ie. select column from DBSchema.table
I will add some description of the DB context parameters to the download.
With regard to the exception. I compiled against a servlet 2.3 container (ie tomcat 4.0) which supports the method. A quick fix for servlet 2.2 containers is to
Change line 676 in com\jrefinery\chart\demo\jdbc\servlet\BaseImageServlet.java
from : getServletContext().setAttribute(SHARED_DB_OPENER, getServletContext().getServletContextName());
to : getServletContext().setAttribute(SHARED_DB_OPENER, servletName);
(this is required to get source to compile as JDeveloper 9i RC does not support servlet 2.3 spec).
However I will have a new war file with these two changes done by tomorrow.
Re: JDBC and Servlet Sample Code
Thank you, Bryan
Then, May I leave the DBSchema parameter- value blank (not configured)because I have already set the DBuser param-value, or simply use the same user name, for example 'system '?
I should follow your suggestions to settle the problem,
Hope to see your new package soon.
BTW,tomorrow is Saturday,
Hope you have a nice weekend^_^
Then, May I leave the DBSchema parameter- value blank (not configured)because I have already set the DBuser param-value, or simply use the same user name, for example 'system '?
I should follow your suggestions to settle the problem,
Hope to see your new package soon.
BTW,tomorrow is Saturday,
Hope you have a nice weekend^_^
Re: JDBC and Servlet Sample Code
Jenny
I have sent the updated war to david.
You are right with respect to the DBschema option. Either option will have the same affect.
let me know if you have any other problems.
NB. Our development site has the war file deployed on it, if you want to have a look. http://coyote.aad.gov.au/JFreeServlet/index.html
Bryan
I have sent the updated war to david.
You are right with respect to the DBschema option. Either option will have the same affect.
let me know if you have any other problems.
NB. Our development site has the war file deployed on it, if you want to have a look. http://coyote.aad.gov.au/JFreeServlet/index.html
Bryan
Re: JDBC and Servlet Sample Code
Bryan,
can you believe it?
This time no error occurs, but... almost nothing appears on my screen except two axes and a legend icon.
My Oracle8.1.6 database has all the tables and data needed...
I have installed the svg plugin successfully...
I also found the same problem when I tried to browse your site,
Do you have any idea about it?
thanks:)
Jenny,
can you believe it?
This time no error occurs, but... almost nothing appears on my screen except two axes and a legend icon.
My Oracle8.1.6 database has all the tables and data needed...
I have installed the svg plugin successfully...
I also found the same problem when I tried to browse your site,
Do you have any idea about it?
thanks:)
Jenny,
Re: JDBC and Servlet Sample Code
OK!
When I stop and restart my website, the problem disappears!
but one question:
in the page of example3, if I check some of the parameter boxes then press the submit button,
still no graphics ...
Anyway I should say thanks again,
You really help me a lot.
Now I'm studying Java by myself, I love java but have not much experience.
I should thank you all who are willing to help others.
Regards,
jenny
When I stop and restart my website, the problem disappears!
but one question:
in the page of example3, if I check some of the parameter boxes then press the submit button,
still no graphics ...
Anyway I should say thanks again,
You really help me a lot.
Now I'm studying Java by myself, I love java but have not much experience.
I should thank you all who are willing to help others.
Regards,
jenny