tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malinowski, Dariusz" <Dariusz.Malinow...@ca.com>
Subject SQL 2000 Data Source
Date Wed, 26 Mar 2003 10:44:24 GMT
Hi all,

I got the JDBS 2.0 driver for SQL 2000 server (SP1). 
I use JWSDP 1.1 (it contains Tomact 4.0)
After installing the Microsoft JDBC driver I created new Data Source in Tomcat, and tried
to use it 
from JSP but it does not work. In the browser I receive exception description:

java.lang.UnsupportedOperationException at org.apache.commons.dbcp.PoolingDataSource.getConnection(Unknown
Source) at org.apache.jsp.test$jsp._jspService(test$jsp.java:71) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 
...........etc

My server.xml:

<Resource name="MSQL" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="MSQL">
      <parameter>
        <name>validationQuery</name>
        <value></value>
      </parameter>
      <parameter>
        <name>user</name>
        <value>sa</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>pass</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:microsoft:sqlserver://malda01:1433;DatabaseName=tesco</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>

....

<Context className="org.apache.catalina.core.StandardContext" crossContext="false" reloadable="false"
mapperClass="org.apache.catalina.core.StandardContextMapper" useNaming="true" debug="0" privileged="false"
displayName="super" wrapperClass="org.apache.catalina.core.StandardWrapper" docBase="C:\JWSDP\work\Standard
Engine\localhost\manager\super.war" cookies="true" path="/super" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper">
          <ResourceLink name="jdbc/MSQL" global="MSQL"/>
        </Context>

My web.xml

 <resource-ref>
   <res-ref-name>jdbc/MSQL</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
  </resource-ref>

My jsp

	Context ctx = new InitialContext();
	     	Context envCtx = (Context) ctx.lookup("java:comp/env");
     		DataSource ds = (DataSource)envCtx.lookup("jdbc/MSQL");
     		Connection connection = ds.getConnection("sa","pass");
....



As you see it fails during running method getConnection(...).
Perhaps someone tested the source with connection pool.


Darek


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message