How to modify the web.xml in JFreeServlet

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Artemis

How to modify the web.xml in JFreeServlet

Post by Artemis » Sat Aug 10, 2002 4:29 pm

Hi all,

I can run the JFreeServlet example one without any problems.
However I fail to run another 2.

I use mysql and I've installed the jdbc driver mm.mysql-2.0.14.
And I've loaded the data in mysql with setuptables.txt successfully.

What I think I have to do next is to configure the web.xml,
so can someone show me how to do so ?
Any other steps for me to work on ?

Thanks a lot.

Artemis

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Sat Aug 10, 2002 7:30 pm

Artemis

Yep you are exactly right. Have you read the jdbc_readme.html file that comes in the war? Should be a link to it. If not the reference is : http://coyote.aad.gov.au/JFreeServlet/jdbc_readme.html

Bryan

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Sun Aug 11, 2002 4:08 am

Hi Bryan,

Yes, I've read this and I just don't know what should I place for the DBurl and DBdriver as I'm using mysql instead of oracle.

Can you show me ?

Thanks again.

Artemis

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Mon Aug 12, 2002 12:30 pm

Artemis

I am not sure which jdbc driver you are using. There appear to be several implementations of jdbc for mysql (from a google search)

http://mmmysql.sourceforge.net/
http://www.t3-jpn.com/jdbc/jdbcmysql.html
http://www.firstsql.com/java/mysql/
etc

The first one google returns is at http://mmmysql.sourceforge.net/
If you are using this then the parameters are:
DBDriver is org.gjt.mm.mysql.Driver
DBurl is jdbc:mysql://[hostname][:port]/dbname

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Wed Aug 14, 2002 4:02 pm

Hi Bryan,

Yes, I use the 1st JDBC driver you mentioned.
For the DBDriver, it's no problem for me .
But for the DBurl, I use jdbc:mysql://localhost:8080/dbname,
am I correct ?
Can I use the ip instead of "localhost", i.e. 127.0.0.1 ?
I've tried both case and it still fails to load the sample chart (example 2).

What should I do then ?
Thanks

Artemis

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Wed Aug 14, 2002 4:14 pm

And one more thing, should I do something inside the
control panel->ODBC ?
I cannot locate the mm JDBC driver in it, is that the cause of the failure ?
I'm using Windows 98.

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Wed Aug 14, 2002 8:21 pm

Artemis

Can you confirm at you are running tomcat and mysql on the same server?
And that this box is win98?

Bryan

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Thu Aug 15, 2002 8:03 am

Bryan

Yes, I am using Tomcat and mysql servers and the OS is win98.

Artemis

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Fri Aug 16, 2002 10:32 pm

Artemis

You should not need to touch the odbc panel as you are not trying to access via odbc.

Yes I would recommend that you utilise your ip address instead of localhost. jdbc:mysql://localhost:8080/dbname

Can you connect over the network to your mysql server from another box, Anyway?

Bryan

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Sat Aug 17, 2002 4:14 pm

Hi Bryan,

Thanks again for your advice.

No matter I use jdbc:mysql://localhost:8080/dbname or jdbc:mysql://127.0.0.1:8080/dbname,
I still fail to load example 2.
(I don't have problem in loading example 1).
I just don't know what to do.
Can you make some suggestions ?

Artemis

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Sat Aug 17, 2002 5:30 pm

Artemis

Are you able to establish a jdbc connection to your database from anything else?

Bryan

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Sun Aug 18, 2002 7:23 am

Bryan,

Yes, I can because I succeed in running a testing program of jdbc connection.

Artemis

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Sun Aug 18, 2002 1:35 pm

Artemis

What are the parameters you used in the testing program of the jdbc connection. They should plug straight into the servlet web.xml file


Bryan

Artemis

Re: How to modify the web.xml in JFreeServlet

Post by Artemis » Sun Aug 18, 2002 4:49 pm

Bryan


Yes, I just use the same parameters but they only work in the testjdbc.jsp:

....
java.lang.String strConn;
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn= java.sql.DriverManager.getConnection("jdbc:mysql://localhost/try1","user","password");
....


Artemis

Bryan

Re: How to modify the web.xml in JFreeServlet

Post by Bryan » Sun Aug 18, 2002 8:39 pm

Artemis

DBDriver = org.gjt.mm.mysql.Driver
DBurl = jdbc:mysql://localhost/try1
DBuser = user
DBpwd = password

I presume that these are what you are using and that you have confirmed that these are correct via using a jsp page.

Next what is the actual error being generated? This is probably easiest to see if you do not run tomcat as a service (ie stop it) and start from a command prompt using "tomcat run". You should recieve additional messages in either the http response or the command window running tomcat.


Bryan

Locked