File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Java, mysql, xml related problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Java, mysql, xml related problem" Watch "Java, mysql, xml related problem" New topic

Java, mysql, xml related problem

torsti koistinen

Joined: Jul 29, 2004
Posts: 4
I have created project management software with Java and MySql and it works fine.
This applet gets and writes information directly to MySql database.

Problem is that those sqlClauses below(update and insert) should go "through" xml "document" and i haven�t got idea how to do that.
If someone could give me advices or even tell me how I must modify my code I would be very grateful.

My english is not so good, so my problem sentence could be little hard to understand, but please try. If it�s too hard to understand please tell me even how can i save results of those clauses to xml "document". (soap?)

Here is part of main program:

And here is database connection class which i have created:

[edited to disable smilies - in the future, you can do it by clicking the disable smilies button in the options section (near the bottom) of the posting page]
[ August 09, 2004: Message edited by: Jeanne Boyarsky ]
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Torsti,

Welcome to JavaRanch. Your English is fine - certainly a lot better than my ... um ... give me a clue ... somewhere in Scandinavia or around the Baltic? Anyway, it's better than any of my foreign languages!

It would be easier to help if you could give us an idea of why you want to save the data as XML and in MySql. Or why you want to convert to XML as an intermediate stage.

A simple answer to the question I think you're asking is to make sure that your data container class conforms to the JavaBeans specification (read the docs if you're not familiar) and then just use the java.beans.XMLEncoder class to write to a file. See example:

If you need to do something more complicated than that then you'll need to look at using JAXP. Check out the tutorial on Sun's website.

Hope this helps.

I agree. Here's the link:
subject: Java, mysql, xml related problem
It's not a secret anymore!