Thread: Advice: Webserver to local database

  1. #1
    Registered User
    Join Date
    Dec 2005

    Advice: Webserver to local database

    I have a major problem:

    Basically, I need to be able to update two databases. One runs on a machine but cannot automatically run queries and dump the data to the local file system. The other database is on a *nix server and is MySQL.

    Now, I need to be able to somehow write a program that checks for updates in the local database (checking the database file timestamps or what have you, I'm not sure), tells it to run a query or number of queries, then uploads the resulting CSV files to the web server in a certain directory (probably via FTP). What would be better than this, of course, is somehow telling it to run a MySQL query on the web server while reading the CSV files generated by the local database. Even better still, being able to run the query on the local database and upload the data as a MySQL query without needing to save it to CSV files first.

    That's just one side of the equation. I also need it to check the web server in a specific directory periodically for .dta files which it will generate every time a customer leaves an order. It needs to be able to download these files and place them in a directory on the local machine.

    This is where my problem is: I don't really know where to start, what programming language to use, and even if I use C, what type of architecture I'm looking at. While I have written a fair amount of C before, I am not sure about Internet-based programming since I have never done such a thing (by this I mean communication to the Internet).

    I'm also not sure how I would run the queries on the webserver, and if a good way to get the CSV files read is to put a directive in the main loading page to read the mysql queries generated by the local program.

    In fact, I'm even wondering whether Java would be a better bet.

    Anyway, if you guys could help me and lay to rest my fears, that would be a good start.

    Thanking you in advance...
    Last edited by zackr; 12-07-2005 at 04:37 PM. Reason: Incorrect sentence (webserver changed to local machine)

  2. #2
    Registered User
    Join Date
    Sep 2004
    Running remote queries isn't hard. You can connect to a server based database (like MYSQL) via whatever port it is listening on, and run queries through a MySQL C library, or a compatible ODBC library. The only trick is making sure the database is configured to allow remote connections to run queries, and also to make sure the server firewall is configured to allow remote connections.

    As for telling when a database file has changed, I can't really help you with that. You can have a script which checks the timestamp on the file, but I'm certain there must be a better way of doing this. I bet modern databases allow "triggers" of some sort which can run scripts or whatever.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Best choise for a local application database
    By gogic in forum C# Programming
    Replies: 2
    Last Post: 04-04-2006, 07:08 AM
  4. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM