Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thank you for the best reply I've ever had to a forum question - it's extremely comprehensive and legible and answers my query thoroughly..."

Geography

Where in the world do Tek-Tips members come from?

Working with MySQL and Postgres (need to share/mirror)

robbLA (TechnicalUser)
21 Jan 03 22:26
Hi,

I'm in a situation that requires me to share data between a MySQL database on one machine and Postgres on a second.  The data in the first (MySQL) is the authoritative and currently I'm just dumping the data out of MySQL and importing it into a fresh Postgres db nightly to use Postgres.

Ideally, I would love to just pick a db and stick with it, but the powers that control that decision won't allow the switch at this time.

My question is:

1. Can I use something like ODBC to allow the two to talk to each other.  Speed on the second machine (Postgres) is not critical. It would be a read-only one-way for data flowing from MySQL to Postgres.

2. If no to number 1 above, can I do something to automate the nightly dumps.  I've already built the scripts to do the MySQL dumps, but I need to preserve the view/indices/etc in Postgres, basically just replace the data with the current data.

3. Other ideas. :)

-r

--
robb

Leland123 (Programmer)
21 Jan 03 23:15
Hi robbLA,

You might consider using VFP7 application as a front-end.  VFP7 works well with both MySQL and Postgres.  VFP7's major strength is its rich programming language and speedy cursors.  I can pull a cursor or table of 16,500 records from a Postgres backend in between 5 to 8 seconds.

If you used this method you could have the app connect to MySQL and select * form MySQL_table into VFP_cursor.  Once the cursor was capture, you could connect to the postgres back-end server and have the VFP7 app insert all the records from the cursor into the postgres table.

Another though is to use comma deliminted files.  Have MySQL output a CSV file and then use a "copy to" on the postgres end to pull the text file into the postgres database.  Both MySQL and Postgres would need identical schemas or table structures.

It's a pitty you don't have two Postgres tables as you could use a pipe between the two tables to easily perform the backup piping a pg_dump from one table to the other like:

pg_dump -h host1 dbname | psql -h host2 dbname

for me this might translate to

pg_dump -h 192.168.1.78 smvfp | psql -h 192.168.1.117 smvfp

To do this, all that is necessary is to set up a database named smvfp on host2.

Also, postgres has replication abilities.  I don't know if MySQL does, but it might be possible to use postgres to replicate your MySQL table.  Sorry I can't be of more help here.

LelandJ

Leland F. Jackson, CPA
Software - Master (TM)
https://www.smvfp.com
Nothing Runs Like the Fox

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close