473,395 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Can mysql_connect close before exec() finishes

code green
1,726 Expert 1GB
I am writing a script that will regularly update a database from a local server to an online server.
The backup file is created locally but the online database is only partially filled.
I am calling mysqldump.exe and mysql.exe with exec().
It works OK within the intranet but there seems to be a timeout problem online.
Is it because the connection is closing before mysql.exe has finished.
Will using mysql_pconnect resolve this?
Should I be using system() instead of exec()?
Will somebody help me?
Jul 24 '07 #1
4 2158
pbmods
5,821 Expert 4TB
Heya, Code Green.

I can see needing to use mysqldump, but why do you need to call the CLI MySQL Client?

Try calling mysqldump, THEN opening your MySQL connection (since mysqldump opens its own connection).
Jul 24 '07 #2
code green
1,726 Expert 1GB
This is my plan with some code
The main database is on a local server. I require a copy of this on a remote server (but not all the tables) I have written a script that writes a backup sql file using mysqldump.exe running on the local. The script then calls mysql.exe (still local) to upload this sql file to the remote server.This is the exec command
Expand|Select|Wrap|Line Numbers
  1. exec(C://Progra~1/xampp/mysql/bin/mysql.exe -u username -h hostaddress -ppassword databasename< C://Progra~1/xampp/htdocs/path/to/above/file/filename.sql);
The php script continues after this line.
The remote database connects and starts to fill up. The script ends cleanly but the database is only partially filled.
Jul 26 '07 #3
pbmods
5,821 Expert 4TB
Ah. Now I see where you're going with this.

Can you schedule a batch file to run these commands instead? Or do you need PHP to process the output of mysqldump?
Jul 26 '07 #4
code green
1,726 Expert 1GB
I suppose a .bat could do this.
I was only using php to test for a connection first then capturing any error messages after.
I have been in discussion with my online provider and the Assistant Technical Manager sounded a little worried. This is part of his reply
Is there a particular reason you're trying to remotely source in a database? Sourcing in databases is very resource intensive. I honestly have not tried this before given the potential problems for broken/partial tables with sending that much data over at once
He goes onto to recommend FTP'ing the file in then running the file locally.
But automation was the main reason behind this projection.
To be honest, I am not sure how to automate a FTP process.
Jul 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Hal Vaughan | last post by:
I never noticed this before, but when I run an external program through Runtime, like this: Runtime rt = Runtime.getRuntime(); System.out.println("Running external command: " + sCommand); try...
2
by: uwnewsgroup | last post by:
When I was using Runtime.exec(String cmd) to run a unix utility (join), and try to get its standard output by using Process.getOutputStream(), it blocks forever. I tried it using Java 1.4 and...
1
by: CST | last post by:
Hi All, I looked through numerous posts and couldn't find exactly what I am looking for, so I am posting this. We have a web application that runs reports. A user needs to run multiple reports...
4
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup)...
2
by: Sugapablo | last post by:
I have a small test script connecting to a MySQL database. It seems to work, unless I try to use the resource link identifier returned by mysql_connect(); This works and returns all the rows in...
4
by: stevong | last post by:
It works on Konquerer though. I remember it works on IE too. I've tried window.close() too. Doesn't work on Firefox also. I've also tried to create a function. It doesnt work on Firefox also....
9
by: Daniel Nogradi | last post by:
Is it possible to pass a python object to a python program as argument? In my program I would like to start executing an other python program and don't wait until that finishes, only launch it...
26
by: warth33 | last post by:
Hello I have a php site. Some page needs to call an external program. The programs are home made c# applications. It uses to work without problem. For a while. Maybe it work for some hour....
2
by: laredotornado | last post by:
Hi, I'm using PHP 5. I want to run a Unix process via PHP exec function. The Unix process outputs a series of lines indicating its status. Is it possible to catch each line and save it to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.