Moving from Java to PHP (DB questions)?

wxdqz

New Member
Hi
I've been coding Java for several years. My company is looking at moving to PHP for many reasons (cost of ownership, ease of installation, ease and speed of coding etc) but I have a few questions If I could just quiz some smart PHP savvy folk out there. Please do not think I'm being somewhat adversarial toward PHP, on the contrary I rather like it but just want a few things cleared up for me. Thanks

1,In Java to connect to a Database one sets up a connection, does the queries, closes the connection. The connection object is yours exclusively during the queries, no other thread should be able to access the connection object. pconnect however appears to use one connection for all requests for connections, so do all web clients get piped through one DB connection? Does PHP not run multiple threads? (surely it must?) I guess what I'm interested in is how "thread safe" is this behavior? I have no doubts about it working it really easy compared to Java. I'm just interested in how PHP is implementing this and how load affected this methodology is.

2, Also in Java doing queries to the DB one can "Prepare" a statement for later execution, the reason being that the DB is allowed to precompile the query and the actual query execution can be much quicker. Often in DB2 it can take longer to compile a Query than execute and extract the results. I'm sure the same is probably true for most other RDBMS's. In the demo code I've seen for PHP the SQL always appears to be dynamic? is this not massively inefficient? or am I missing something?

But in conclusion I'm incredibly impressed with what PHP can do so easily, sure I don't think it can scale like Java (yet) but in the real world most companies really don't need EJB's etc they just like the TLA and have been convinced they need massively scalable systems to service there 4000 customers! also the ease of install, on one of our machines there are literal books on the installation process and finding people that know it is rare. In PHP, to get oging it took a 3 minute download and 2 lines in the httpd.conf file! I'm impressed before I ever look at the code!.

Thanks
Alan Boldock
 
Back
Top