Solved

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

Posted on 2014-09-17
14
2,427 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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
 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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 set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like theā€¦

726 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