Solved

Wordpress - is there a plugin to interogate a local MS SQL Database?

Posted on 2014-09-17
14
1,547 Views
Last Modified: 2014-10-02
Hi,

I have created a basic Intranet site in WordPress using a number of plugins to include company information, photos, training documents & videos, etc.

Does anyone know of a WordPress plugin that will connect to and query an MS SQL database? We have a SQL 2005 server on site and I would love to be able to retrieve and present information from the various tables/views onto an Intranet page / potentially including a search too.

I've seen a few plugins which allow you to access the mySql database behind Wordpress but nothing that allows you to connect to a separate database.

I look forward to your replies & thanks in advance!

Rob
0
Comment
Question by:robsamuel2k8
  • 6
  • 3
  • 2
  • +2
14 Comments
 
LVL 32

Expert Comment

by:DrDamnit
ID: 40328209
Simply put: no.

The functions that allow WordPress to talk to the MySQL back-end could not be replaced by a plugin.

You'd have to fork WordPress entirely.
0
 

Author Comment

by:robsamuel2k8
ID: 40328446
Hi Michael, I'm not looking to replace the interface between WordPress and MySQL. We have a separate database on an MS SQL Server which I'd like to interrogate via WordPress and display information within the site.

For example, a company directory SQL database on another server and I'd like a Wordpress plugin where I can connect to that separate server and query tables, etc. Nothing to do with the MySQL back-end of Wordpress.
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 40328461
Oh!

Then I mis-read your question.

The answer, then, is yes you can do this, but no, there is not a ready to go plugin that you can use. You'd have to get a custom one written because your table names, columns, data types, etc are all custom. So, there is not an out-of-the-box solution it there just waiting for you.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40328493
Michael's correct in that there isn't a plugin that just connects you to a MS SQL instance and lets you do whatever.  There is, however, a plugin that is meant for external user authentication and you could fork that plugin to do what you are wanting to do:

https://wordpress.org/plugins/external-db-auth-reloaded/

Use that as your jumping off point...
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 40328543
Having looked at the source, I am not sure that would be a great place to use as a jumping off point. Most of the method of the class are specifically for dealing with user authentication (like generating the hash for user passwords for comparisons).

If he's not doing MSSQL user authentication, he'd have to spend more time removing things that weren't applicable than building the actual plugin. I am assuming that since it is an intranet site, that user authentication is not really necessary since access to the network is controlled by physical access. If it was important, then we could use this, but I think he'd probably / rather use active directory authentication, which (at this point) he's basically recrating sharepoint.

@robsamuel2k8

Can you give us a little more information on what you're trying to do? Does it involve user authentication? Or are you just trying to put some intranet content on an intranet site?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40328547
Having looked at the source, I am not sure that would be a great place to use as a jumping off point. Most of the method of the class are specifically for dealing with user authentication (like generating the hash for user passwords for comparisons).

The thought was that it integrates a connection sequence for an MS SQL instance into WordPress.  The rest of it would have to go, though.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 32

Expert Comment

by:DrDamnit
ID: 40328611
Seems like it's the long way around the barn considering these built-in functions, no?

http://php.net/manual/en/ref.mssql.php
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40328937
Depends on if you just want to access the db, in which case happy scripting, or integrate the outside db with the rest of WordPress, in which case a small nightmare of functions awaits you.
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40329434
merely some ideas for discussion.

An alternative approach would be to address this through the database. For example if you were using Oracle you could setup a "dblink" inside the database to an external database and from there you can access the external data pretty much as if the tables existed in Oracle. MySQL seems limited in this regard however - but someone else may know more on this.

e.g. http://en.wikipedia.org/wiki/MySQL_DataController which appears to permit access to SQL Server tables inside MySQL. Support for this appears very limited

You might have other "middleware" available to you like Oracle's Golden Gate that could place data into MySQL from SQL Server, or use some other interface type to make the data available in MySQL for delivery through Wordpress.
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 40329497
in which case a small nightmare of functions awaits you

Amen to that.
0
 
LVL 1

Expert Comment

by:Frans Haesendonckx
ID: 40329800
An Out-of-the-box solution would be to replicate your MSSQL database (or a part thereof) to a MYSQL counterpart (with Apatar for instance).  Then use the Abase plugin for Wordpress to incorporate this content in your pages.

https://wordpress.org/plugins/abase/
0
 

Author Comment

by:robsamuel2k8
ID: 40329836
Thanks for your comments so far, all I want to do is retrieve data from a couple of tables in the SQL DB into a WordPress page.

For example, pulling a table of company contacts onto a page or being able to search on clients based on the name.

I'll have a look at the user-auth plugin but it doesn't sound like what I'd like to do is possible...
0
 
LVL 32

Accepted Solution

by:
DrDamnit earned 500 total points
ID: 40330293
What you want is possible, but not with a readymade plugin. You'd have to write one yourself or have it written.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now