Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 11th, 2003, 01:53 PM
pjstroud pjstroud is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 36 pjstroud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 50 sec
Reputation Power: 6
MySQL and postgreSQL on same box??

I'm relatively new to the database game and have been using AMP on an OS X 10.2 box as my learning platform. The application I'm currently building would benefit from features found in postgreSQL, like foreign key constrains, views, cascading referrences, etc. So, I'm wondering if I can install both MySQL and postgreSQL on the same box?

My concern is how will PHP know what Db to use when passing queries? I've never had to do any configuration for PHP and MySQL to play nicely together -- it's just always worked. Would I need to do something special to the PHP conf file, or is it even possible?

URLs with info on this would be great (already tried a google search without much luck).

Thanks much.

Reply With Quote
  #2  
Old February 11th, 2003, 02:10 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 2 m 4 sec
Reputation Power: 43
Re: MySQL and postgreSQL on same box??

Quote:
Originally posted by pjstroud

My concern is how will PHP know what Db to use when passing queries?


PHP has different APIs for different database systems, so when you use a function from the PostgreSQL API, it will connect to the available PostgreSQL database server.

Now, if you are using one of the databse abstraction libraries for PHP, then the choice of API is hidden inside the library. In this case, you would need to know how to configure your access to that library to choose between database systems.

There is no problem running PostgreSQL and MySQL on the same server; I do it all the time . There is no conflict, because by default, MySQL uses HTTP port 3306 (AFAIK), while PostgreSQL defaults to port 5432. The only thing to remember is not to attempt configuring both MySQL and PostgreSQL to serve on the same port.

There is no magic to running both database systems, but PostgreSQL support is not built in by default. You need to either re-compile PHP for PostgreSQL support (more details in the link above), or load the pgsql extension, in php.ini.
__________________
The real n-tier system:

FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

Amazon wishlist -- rycamor (at) gmail.com

Reply With Quote
  #3  
Old February 11th, 2003, 02:38 PM
pjstroud pjstroud is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 36 pjstroud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 50 sec
Reputation Power: 6
Why would I want to use database abstraction libs?

Sounds like it PHP is configured to use pgSQL and mySQL, them I should be good to go -- at least for the purposes of trying the system out.

Thanks for the info!!

Reply With Quote
  #4  
Old February 12th, 2003, 09:35 AM
bcyde's Avatar
bcyde bcyde is offline
Me likey breadsticks...
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2003
Location: Los Angeles
Posts: 1,189 bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 12 m 57 sec
Reputation Power: 12
Send a message via AIM to bcyde Send a message via Yahoo to bcyde
You'd want to use database abstraction if you wanted to make your app available to work with more than 1 database. If you abstract the database connection/query layer you can distribute your application to users of both postgres/mysql/any other database supported in your abstraction layer if you program your app correctly.

If you know that your app will only be used for 1 type of database and will only used internally and not distributed it isn't necessary.

-b
__________________
PostgreSQL, it's what's for dinner...

Reply With Quote
  #5  
Old February 12th, 2003, 10:37 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 2 m 4 sec
Reputation Power: 43
Quote:
Originally posted by bcyde
You'd want to use database abstraction if you wanted to make your app available to work with more than 1 database. If you abstract the database connection/query layer you can distribute your application to users of both postgres/mysql/any other database supported in your abstraction layer if you program your app correctly.

I will have to vehemently disagree with one small part of this comment. While I agree that database abstraction layers can be good things, there is no advantage to coding your application to the "least common denominator" among database systems. If you are going to code your app so it works on all systems, then your app will be terribly hobbled in it's ability to do such things as preserve business logic in the database, and other critical information management concepts. For example, when I code any serious logic in a PHP/MySQL application, I find myself forced to write much more PHP code than I would have to for a PHP/PostgreSQL app, simply because PostgreSQL can handle virtually all of the central logic of the application, and it can do so much more concisely than you can do with application-level business rules and constraints.

Now, if you decide that you will stick to ANSI SQL relational compatibility (which MySQL doesn't have), then you can at least have a significant level of cross-database connectivity with your application, while keeping most of the advantages of relational SQL systems. This would include PostgreSQL, Oracle, Sybase, and DB2, Firebird, and SAP DB, among others. In this case, then an abstraction layer would be a good thing.

Actually, MySQL is the odd duck of the lot. It's more than a simple indexed file manager, such as Berkeley DBM, mSQL, and other lightweight data management kits, but it is not quite on the level of the enterprise DB systems, either, lacking much standardization and logical functionality. This alone makes it unwieldy for including in any true cross-DB application.

So, the question of database portability is central to the architecture of your application. Much more so than portability across operating systems, for example. It can't be pasted on as blank "data management" API, external to the logic of your application.

Reply With Quote
  #6  
Old February 12th, 2003, 11:11 PM
bcyde's Avatar
bcyde bcyde is offline
Me likey breadsticks...
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2003
Location: Los Angeles
Posts: 1,189 bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 12 m 57 sec
Reputation Power: 12
Send a message via AIM to bcyde Send a message via Yahoo to bcyde
Yup rycamor is absolutely correct. Actually that's why I pretty much stay away from all purpose db abstraction layers, but for generalized apps like news scripts, discussion boards, etc. the all purpose db abstraction layers seem to do the job well making it easy and accesible for those installing the scripts.

-b

Reply With Quote
  #7  
Old February 12th, 2003, 11:31 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 2 m 4 sec
Reputation Power: 43
Yeah, there are those simple standardized apps where it really doesn't matter what you use for a database.

The shame of it all, though is that many PHP developers start off with MySQL, and then their apps grow and combine with other apps, and suddenly they are faced with the task of managing a system. This is what makes or breaks a developer, and this is where relying on simple storage mechanisms (treating the DB like a glorified spreadsheet) just isn't going to cut it.

I know, because I've been there . It wasn't pretty...

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > MySQL and postgreSQL on same box??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway