Transfer data from PC application to remotely hosted database
Basically I want to be able to transfer data from PC application to remotely hosted database.
I have developed a wxPython which application which is used for parsing and analysing test data.
I want to update the application so that it can transfer the analysed data to an online MySQL database.
As it is 开发者_Python百科for just for in house use by about a dozen individuals it doesn't need to be ultra robust, just a simple solution that works.
I dont have much experience on server side stuff so Im not really sure how this would usually be done, I know that directly connecting to the database from the app is not possible due to security restrictions. Im thinking the I could use ftplib
to upload the data as files and then call a PHP
script (to insert the data in the db)with urllib2
.
Will this work?
Do you have access server side? If so, you could enable secured remote mysql, or add a php page that allows access. For example, Python could use urllib to open "mypage/search.php?name=name&otherdata=otherdata", and read the result. This would also work in a web browser.
It seems uploading the file and then calling a script to run would be a bit inefficient and less secure, and would require access to the server. Why not have secure remote access for the database?
I'd look into some Python Mysql examples, if there is a possibility of setting up Mysql connections: http://www.kitebird.com/articles/pydbapi.html
First get it working in a small example script, then you can paste the code into your project.
精彩评论