View Full Version : Microsoft SQL Server Supported?

07-27-2010, 11:15 PM
Hello everyone. I'm looking to potentially do a Wordpress implementation using Quercus. However, we use Microsoft SQL Server for our database backend. Is Microsoft SQL Server supported by Quercus?

I haven't been able to find anyone who has done this. Has this been done yet? Is it possible?

If it is possible, but has yet to be done, what should I be looking at in order to complete this? I see that Microsoft has a "PHP Driver" for MSSQL Server, and obviously Microsoft has JDBC drivers on the Java side.

10-11-2010, 06:28 PM
Resin certainly supports MS Sql JDBC driver, so it should be possible. You need to configure the datasource used for WordPress with Ms SQL jdbc driver: WEB-INF/resin-web.xml:

<database jndi-name="jdbc/blog">
<driver type="net.sourceforge.jtds.jdbc.Driver">

06-19-2013, 07:05 AM
Hello, sorry to refresh old thread but I have problem with what alex posted.
I try to connect to MSSQL 2008 R2 database called "test" on my localhost using Quercus/PHP

To the web.xml i added:
<database jndi-name="jdbc/sqlserver">
<driver type="net.sourceforge.jtds.jdbc.Driver">

In my .php file i have:
$db = new PDO("java:comp/env/jdbc/sqlserver");

And it gives me following error:
Fatal Error: 'java:comp/env/jdbc/sqlserver' is an unknown PDO JNDI data source.

I copied the jtds-1.3.1.jar to the lib folder. Do I need to do anything more to make this work?

06-25-2013, 12:33 PM
If anyone is interested I solved the problem:
Using Tomcat 7, i replaced the jtds driver with MS sqljdbc4 and added to the conf/context.xml following code:

<Resource name="jdbc/sqlserver" auth="Container" type="javax.sql.DataSource" username="username" password="password" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://localhost;databaseName=test"/>
Declaration of <database> in web.xml is now not required. It's maybe not the best solution but it seems to work fine with PDO.