tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: DigestAuthenticator failure: java.sql.SQLException: Operation not allowed after ResultSet closed
Date Mon, 03 Aug 2009 22:05:11 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Digilloyd,

On 7/31/2009 1:59 PM, DIGLLOYD INC wrote:
> Thank you.  Any snippet on the right way to to the Realm/Resource thing?
> It's been so long I don't remember the right way

Simple: just put this in your WEB-INF/context.xml file:

   <Resource name="jdbc/MyDataSource"
    description="[whatever]"
        auth="Container"
        type="javax.sql.DataSource"
        maxActive="1"
        maxIdle="1"
        maxWait="10000"
        url="@DATABASE_URL@"
        username="@DATABASE_USERNAME@"
        password="@DATABASE_PASSWORD@"
        driverClassName="@DATABASE_DRIVER@"
        removeAbandoned="true"
        removeAbandonedTimeout="30"
        logAbandoned="true"
    testOnBorrow="true"
    validationQuery="/* ping */ SELECT 1"
    />

Obviously, fill-in the appropriate values above.

You should also have in your web.xml something like this:

    <resource-ref>
           <description>[whatever]</description>
           <res-ref-name>jdbc/MyDataSource</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
    </resource-ref>

...but I've found that it is not strictly necessary. I think it's
because Tomcat knows that any <Resource> in WEB-INF/context.xml should
automatically be available in the visible JNDI context for the webapp.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkp3XxcACgkQ9CaO5/Lv0PDGcgCePI8NTUrVpCUyYKPBBOhhRnnW
aUQAoJAJEt2j0asnrgCDla49v5G1FQ7F
=F0rT
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message