I am required to setup a web application that will interact with an existing ERP system (WinMagi). The ERP is basically a front-end to an xBase (FoxPro) database. The database is located on an in-house server. The ERP, as far as I'm aware, doesn't have an API but can accept purchase orders, etc through an EDI module. The web application should be able to accept online orders and query data for reporting.
My plan so far:
- Synchronize the xBase DB to a SQL server instance on a cloud hosted VM.
- (one-way from ERP -> SQL Server)
- Use this sync process as an interface between the ERP and web application.
- Push purchase orders back to the ERP using EDI.
- My thinking here is that it would be safer from a data concurrency perspective to create or update data in the ERP through a controlled and accepted (by the ERP) interface.
Questions/Concerns:
- What is the best way to update the SQL DB from the xBase DB? Are there any pre-existing libraries that can do this so I don't have to reinvent the wheel?
- Would the xBase DB become locked during sync? Or otherwise cause an issues for the live ERP?
- How do I avoid data concurrency / integrity problems during the sync?
- This system wouldn't be serving live data to the web app. What sort of issues can I expect due to this?
- Should I prefer one language over another for this sort of project? My plan was to use Java/Hibernate MVC.
Am I perhaps going about this the wrong way? Would I be better off interfacing my web app directly with the xBase DB? Some problems that immediately spring to mind with this approach are networking issues between the office and the cloud-based VM and potential security vulnerabilities from opening up the ERP directly to the internet.
Any advice or suggestions you might be able to provide would be greatly appreciated!! Thanks in advance.
UPDATE - 3 Sep 2012
How I'm currently doing the data copy (it's not a synchronization) - runs nightly:
- A linux box in the office copies the required DBFs from a read-only share on the ERP server to local storage.
- The DBFs are converted to CSV using Dave Burton's fantastic dbf2csv perl script
- The resulting CSVs are rsync'd to the remote VM. There are only small changes in the data so this is quite fast.
- Once the rsync is complete the remote VM does a mysqlimport to the production DB.
Advantages of this approach
- The ERP cannot be damaged in any way as the network access is read-only.
- No custom logic has to be implemented to sync data and hence there are no concerns that the data could be wrong on the remote VM.
- As the data copy runs at night the run time isn't too important.
- Current run time is approx 7 minutes for over 1 million records with approx 20-30 fields per record.
- Longest phases are the DBF copy and conversion to CSV.
Disadvantages
- The DBFs have to be copied in full every time.
- The DBFs have to be converted in full every time.
- Tables that are being copied are locked during the mysqlimport. This isn't really too much of an issue though as the import runs during the night and the mysqlimport only takes about 20 seconds.