Forum Moderators: open

Message Too Old, No Replies

Can I use MySQL and MS SQL concurrently in PHP?

         

TheVanWarehouse

9:04 am on Jul 8, 2009 (gmt 0)

10+ Year Member



Our primary site uses PHP and MySQL - but for business reasons we might have to use MS SQL too (still writing code in PHP) - converting from MS SQL to MySQL each day simply takes too long as the database is large.

Is it possible / sensible to create pages in PHP that use MS SQL (along with MySQL)? Is this something that PHP (I use XAMPP) can do out the box?

(I've used ASP with MS SQL before, and PHP with MySQL, but not PHP with MS SQL.)

janharders

9:09 am on Jul 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like it shouldn't be a problem.
I wouldn't recommend it because of code overhead, but it should work perfectly fine (of course, no sql joins over the two databases etc). You'll need to activate the mssql extension, of which I'm not sure wether it's installed by default with XAMPP.

why can't you convert to mssql completly?

TheVanWarehouse

10:15 am on Jul 8, 2009 (gmt 0)

10+ Year Member



There's two reasons I can't convert it:

First its quite a sizeable database (12GB) and it gets downloaded and completely overwritten every morning (the database is updated daily).

We need it to go live on the site as quickly as possible - and every attempt I've made to convert it to MySQL (using freely available scripts) has taken most of the day - therefore it takes too long to convert it :(

Secondly, the database has got 50 tables in it, most of which need to be joined together in one huge join to get the relevant info needed on most pages (and to filter out all the records that we don't need).

Even with everthing indexed, its still quite demanding. I was therefore thinking that MS SQL views would be appropriate (I believe that MS SQL views can effectively be cached, while MS SQL continually has to re-create the view each time its called - though I could be wrong).

janharders

10:55 am on Jul 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, going from mssql to mysql might be difficult, but why would you want to involve mysql at all if you will have a mssql db and fuel your site with that data?

TheVanWarehouse

11:44 am on Jul 8, 2009 (gmt 0)

10+ Year Member



- the site was orginally built in PHP/MySQL and will still be using lots of the existing MySQL tables.

janharders

12:10 pm on Jul 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, php does support MS SQL, just give it a try and see how easy it'll integrate into your existing code.