Re: Moving Data Between Proprietary Database and MySQL

2002-05-23 Thread Avalon


Hello,

> Because most web providers will not allow
> direct TCP/IP access to
> MySQL servers, I am considering the following
> strategy:
>
> a) Save the proprietary database to a file
> containing a series of SQL
> CREATE TABLE and INSERT INTO calls.
>
> b) Upload the SQL file to the server via FTP.
>
> c) Launch a PHP script on the web server from
> my program that executes
> the SQL file to insert the data into the MySQL
> database.

Have you tried phpMyAdmin? It's a web-based 
administration tool written in PHP to handle mysql 
databases.

Check http://www.phpwizard.net/projects/phpMyAdmin/

> Another issue I am running into is the
> difference between the
> proprietary database and MySQL in how quotes
> are escaped. The
> proprietary database wants two sequential quote
> characters, MySQL uses
> a backslash before the quote character.

You can do this with a simple search & replace. Does 
the other database provides any means to do it in the 
query itself? i.e., in mysql you can query like this:

SELECT replace(some_field, ',', '.') FROM some_table

This query substitutes commas (,) for periods (.) for 
some_field.

If you'd like to loose your sanity, you could start 
having lots of fun with strings, like this:

SELECT concat('INSERT INTO TABLE_X (field_1) VALUES 
(''', replace(some_field, ',', '.'), ''');');

and you can send the result to a text file. this way 
you are building a script using a query.


Hope this helps!


>
> Has anyone else gone down this road before? Any
> comments on this
> strategy? Are there any tools or routines
> available to help facilitate
> this process?
>
> --
> Bruce Vander Werf
> [EMAIL PROTECTED]
>
> -

> Please check
> "http://www.mysql.com/Manual_chapter/manual_toc.html";
> before
> posting. To request this thread, e-mail
> [EMAIL PROTECTED]
>
> To unsubscribe, send a message to the address
> shown in the
> List-Unsubscribe header of this message. If you
> cannot see it,
> e-mail [EMAIL PROTECTED]
> instead.
>
> 




~avalon~

-
Email Enviado utilizando o serviço MegaMail

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Moving Data Between Proprietary Database and MySQL

2002-05-22 Thread Bruce Vander Werf

I am adding a web interface to a Windows application I have written
that uses another proprietary database system. To allow for my
customers to use both Linux and WinNT based web servers, I have
settled on MySQL for the web database. I am working on a strategy for
allowing my customers to move the database from one platform to the
other as needed. Here are the issues I am facing at this point:

Because most web providers will not allow direct TCP/IP access to
MySQL servers, I am considering the following strategy:

a) Save the proprietary database to a file containing a series of SQL
CREATE TABLE and INSERT INTO calls.

b) Upload the SQL file to the server via FTP.

c) Launch a PHP script on the web server from my program that executes
the SQL file to insert the data into the MySQL database.

Going the other way would be similar:

a) Launch a PHP script on the web server from my program to save the
MySQL database to a file containing a series of SQL CREATE TABLE and
INSERT INTO calls.

b) Download the SQL file from the server via FTP.

c) Execute the SQL file in my program to insert the data into the
proprietary database.

At this point, it's going to be a wholesale send and replace of the
whole database. At some point in the future, I would like to add some
synchronization logic, but that is a subject for another day.

Another issue I am running into is the difference between the
proprietary database and MySQL in how quotes are escaped. The
proprietary database wants two sequential quote characters, MySQL uses
a backslash before the quote character.

Has anyone else gone down this road before? Any comments on this
strategy? Are there any tools or routines available to help facilitate
this process?

--
Bruce Vander Werf
[EMAIL PROTECTED] 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php