1

Right now I have tomcat8 with Quercus 4.0. and running up. I'm trying to configure a MSSQL db connection to use from PHP.

On doing:

<?php
$pdo = new PDO("java:jdbc/test");
?>

I got:

C:\java\tomcat8\webapps\php1\info.php:2: Fatal Error: 'java:jdbc/test' is an unknown PDO JNDI data source. 

Probably there is a problem with the config.

web.xml

<web-app>
  <description>Caucho Technology's PHP Implementation</description>

  <database jndi-name="jdbc/test">
    <driver type="com.microsoft.sqlserver.jdbc.SQLServerDriver">
      <url>jdbc:sqlserver://localhost;database=db1</url>
      <user>sa</user>
      <password>xxxx</password>
    </driver>
  </database>

  <servlet>
    <servlet-name>Quercus Servlet</servlet-name>
    <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>Quercus Servlet</servlet-name>
    <url-pattern>*.php</url-pattern>
     <init>
      <database>java:comp/env/jdbc/jdbc/test</database>
    </init>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.php</welcome-file>
  </welcome-file-list>
</web-app>
esis
  • 11
  • 1

0 Answers0