Are There Any Plans for WordPress to Support Databases Other Than MySQL?

The question:

I’ve long wished WordPress would support SQL Server, but it would also really amazing if it supported MongoDB (for example.)

My question is are there any plans to do so, at all?

Is the core WordPress team so commited to MySQL that there are no plans to offer any sort of support for other DBs (at least anytime soon?)

This post leads me to believe any such thing won’t happen:

http://codex.wordpress.org/Using_Alternative_Databases

However, as an example (while I much prefer WordPress to it) Drupal 7 now features a …

Database abstraction layer, enabling
the use of many databases, such as
Maria DB, Microsoft SQL Server,
MongoDB, Oracle, MySQL, PostgreSQL, or
SQLite

http://drupal.org/node/1015646

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Hi @Justin Jenkins:

It’s very hard for use to say if WordPress will or will not support it since they can make those decisions and we cannot. However we can look at some evidence.

SQL Server?

For SQL Server on one hand a trac ticket was debated and stalled a year ago; since then more recently it appears that Automattic and Microsoft are exploring business relationships:

Mongo DB?

For Mongo DB there was a support question proposing it but no official acknowledgement and no real traction:

Forecast?

So, SQL Server looks more likely than MongoDB, at least from Automattic in the near term but that’s only a guess and not one I’d actually bet on.

What about Plugins?

More importantly one would need to consider that a major benefit of WordPress is the huge repository of free plugins and many of those encode MySQL directly and thus would cease to work and blunt much of the benefit of WordPress.

Drupal Modules and their Support of Other Databases Besides MySQL

What’s more in the Drupal world you do have multiple database support but the reality is that vast majority of Drupal modules that interact with the database only support MySQL. Supporting multiple databases requires many times more effort and most Drupal module developer simply don’t have the resources or even the inclination to create free plugins with those levels of support and I would expect the same would be true with WordPress.

Real-world Use-Cases?

Which bring me to an honest question: What’s the real-world use-cases for this? As a technologist myself I always look at these types of these as really cool, but as an entrepreneur I also look at them pragmatically and ask for use-cases. Are there situations where MySQL is really not an option but SQL Server is? Are the installations where benefits of Mongo DB would exceed the downsides?

(And just as importantly, are there companies who really need this who are willing to spend money to support the development and maintenance? More specifically I’d be curious to know your motivations? Again, that’s an honest question; market research really, and not to challenge you in any way for asking.)

Next Steps?

If you want to hear it more from the horse’s mouth I’d suggest but asking on the wp-hackers mailing list and posting a proposal ticket for MongoDB on trac.

UPDATE

I just came across this page on Microsoft.com that claims they have a patch for using SQL Server with WordPress. I didn’t try it so I can’t vouch for it, though here’s Microsoft’s WordPress page:

Method 2

Codec

See: http://codex.wordpress.org/Using_Alternative_Databases#Solutions/

Plugin Alternative

I used this plugin: http://wordpress.org/extend/plugins/pdo-for-wordpress/ lately to run WordPress on my NAS using a SQLITE database in the backend instead of MySQL, which worked great.

What databases are supported?

Currently the basic layer supports any database that is supported by PDO.

  • MS SQL Server (PDO) – Microsoft SQL Server and Sybase Functions (PDO_DBLIB)
  • Firebird/Interbase (PDO) – Firebird/Interbase Functions (PDO_FIREBIRD)
  • IBM (PDO) – IBM Functions (PDO_IBM)
  • Informix (PDO) – Informix Functions (PDO_INFORMIX)
  • MySQL (PDO) – MySQL Functions (PDO_MYSQL)
  • Oracle (PDO) – Oracle Functions (PDO_OCI)
  • ODBC and DB2 (PDO) – ODBC and DB2 Functions (PDO_ODBC)
  • PostgreSQL (PDO) – PostgreSQL Functions (PDO_PGSQL)
  • SQLite (PDO) – SQLite Functions (PDO_SQLITE)
  • Note that through the PDO_ODBC extension, all ODBC supported databases are also supported, subject to drivers being available

HOWEVER each database needs its own driver and currently the only drivers written for this plugin are for

  • sqlite and
  • mysql

So for MySQL someone should write a driver

Method 3

I did some research on possibilities to migrate WordPress to MongoDB or other NoSQL database to make it really scalable.
Seams there is quite good way (unfortunatelly not a short one) to achieve this.

For a start I’ve done little script in PHP which is migrating MySQL tables to Mongo collections doing some aggregations while preserving original relational dependencies:

https://github.com/virtimus/mysql2mongo

Next step which I’m now working on is to make MongoDB understand something which would be “close” to SQL – I’ve named it “nSQL” – it’s json based dialect of SQL operating on hierachical collections

https://github.com/virtimus/nsqlserver

It’s a work in progress – nothing yet there committed – however I have already offline w protype version which processes simple nSQL queries of the form:

db.runCommand(
    {nsQL:
        {
           sel:['id','emailUse','emailType','emailSubject'],    // properties/colums to return
           flt:{emailUse:0,emailType:'test'},           // filter (where phrase equivalent)
           ctb:'wp_eshop_emails'                // table equivalent (can be agregated in collection as path)
        },
        cid:ci,                         //connection id
        sid:si                          //session id
    })

It can work on both MySQL, MongoDB or almost any other Relational/non relational backend
It’s compilation of two projects:
– a MongoDB fork (slightly extended MongoDB version by some “nSQL” commands)
– a fork of SQLRelay project (relational DB proxy handling many SQL backends)

OK – so above component would be the main part of work. There is a lot of development to make it fully functional (handling of aggregations, sorting, subdocument filters, inserts/updates/deletes, maybe also joins etc)
End effect seems to be very promissing in general – not only for WP.
Imagine for instance SQL to NoSQL migration using several simple “INSERT FROM INTO” commands …

The rest of work would be to connect it with WordPress – through some sort of SQL2NSQL translator (ie this PDO plugin above)

Is there someone interested ? Help in analysis/development ? Financial investing ?

Method 4

PDO for WordPress works fantastic if you don’t mind being stuck at WP 2.9.1RC1 as it isn’t supported in WP 3.x. Unfortunately, there a lot of plugins that are written to run only on WP 3.x


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment