[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    Re: dump database data from web application
From:       Morten Norby Larsen <morten () magisterludi ! com>
Date:       2004-04-29 12:57:51
Message-ID: D2C49F23-99DC-11D8-914A-00306558BA9C () magisterludi ! com
[Download RAW message or body]

Without having to overload the list with these things, I thought I'd 
just send the link to the list, in case anyone else would be 
interested. Then we can take it off-list.

I have uploaded the whole package, so any supporting files needed will 
be at hand.

You can find it here:

http://www.mludi.net/YourSQL/YourSQL_1.6.0b3_2004_04_29.zip

The class you want to look at is YSDumper, specifically the method 
writeDump (it does not have to create a background thread, that is just 
to make the GUI more responsive).

More specifically, the method writeTableDefinitions writes out the 
table definition, shamelessly taken from the server itself ("SHOW 
CREATE TABLE...").

The method writeTableDefinitions writes out the actual INSERT 
statements.

Metadata (to determine whether a given value should be quoted or not) 
are managed by the class YSColSpec and its support class YSColTypes. 
This couple is somewhat superficial to the metadata obtained from the 
driver. You may want to use the ResultSetMetaData directly.

You can safely ignore everything related to Progress, as it just serves 
to update progress bars in the GUI. Same goes for other Mac-specific 
code which serves various GUI-related purposes.


Please notice that character set issues are handled only through the 
driver's support and Java's I/O mechanisms. It works if you specify the 
correct character set for the connection and your intended target 
character set for the output file, otherwise you will have some issues.


Hope this helps,

Morten


On 29/apr/04, at 06:35, Uwe Geercken wrote:

> morton,
>
> thanks for the offer, but I do not have a mac at hand. but I would be 
> glad
> if you could simply send it in some sort of ascii or xml format, which 
> will
> give me some hints of how to implement it.
>
> regards,
>
> uwe
> ----- Original Message -----
> From: "Morten Norby Larsen" <morten@magisterludi.com>
> To: "Uwe Geercken" <uwe.geercken@geenic.com>
> Cc: <java@lists.mysql.com>
> Sent: Wednesday, April 28, 2004 4:05 PM
> Subject: Re: dump database data from web application
>
>
>> Hi,
>>
>> our little YourSQL project, which is a Mac-only GUI written in Java,
>> contains code for this.
>>
>> Let me know if you are interested, and I'll make sure you get the 
>> latest
>> version. Also let me know if you have a Mac at hand (the code is
>> currently only available on the site in a Mac .dmg format).
>>
>> Cheers,
>>
>> Morten
>>
>> Uwe Geercken wrote:
>>> hello everybody,
>>>
>>> I have created a website using jsp, servlets and velocity to handle 
>>> data
> in a mysql database. this application will run on an intranet. now I 
> want to
> give the admin of this application (which is in fact a user) the 
> ability to
> dump the data from the database into a file and also to restore a file 
> at a
> later point in time.
>>>
>>> as this admin is not a database administrator I want to avoid that he
> has to use mysqldump to do the dump and have a convenient way from the 
> web
> application to run the dump.
>>>
>>> has anybody expererience of how to do this or can give me a hint 
>>> which
> way to go?
>>>
>>> thanks for your help,
>>>
>>> uwe geercken
>>> uwe.geercken@geenic.com
>>
>> --
>> Morten Norby Larsen                             
>> morten@magisterludi.com
>> Magister Ludi s.r.l.                          Phone: +39 02 26 11 72 
>> 80
>> Via Battaglia 8, I-20127 Milano, Italy        Fax:   +39 02 28 46 037
>>                         http://www.magisterludi.com
>>
>


-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/java?unsub=mysql-java@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic