[wp-hackers] WP and Plugins DB connection conflicts

Otto otto at ottodestruct.com
Tue Jun 26 14:01:39 GMT 2007

If you want to access a different database entirely, you shouldn't use
the $wpdb functions at all, IMO. Do your own mysql_connect and such,
and you won't have any conflicts. And if you do want to access the
wordpress database, use $wpdb. Seems simple enough.

I think a lot of this problem is plugin-author-error as opposed to an
issue with Wordpress.

More to the point, it seems like an extremely bad idea to modify the
$wpdb to be forced to open a new link every time. It would add a lot
of overhead that might not always be absolutely necessary.

On 6/26/07, Jennifer Hodgdon <yahgrp at poplarware.com> wrote:
> >> I believe the usual thing for a plugin is to use $wpdb to do database
> >> queries, rather than creating its own database connections. Is there
> >> some reason these plugins cannot be rewritten to do that? It might
> >> mean adding a require() line somewhere, to make sure $wpdb has been
> >> initialized, but then there would be no conflict.
> > I think the issue arrises when a Plugin wants to access a seperate
> > database than Wordpress's.
> > I saw a Trac ticket which refered to something similar earlier actually:
> > http://trac.wordpress.org/ticket/2722
> > the solution in the Ticket description isnt the best though.
> In this case, the person who posted to the list said he was logging in
> with the same credentials as WP, though. Most plugins (I think) use
> the WP db, since some users on shared hosts will not have permission
> to create new DBs, and anyway people probably want all their
> WP-related data in the same database.  The Trac post was in regards to
> using a db on a completely different host.
>       -- Jennifer
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list