You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2007/04/07 00:37:13 UTC
Re: [OT] Memory leak when using DB connection ??
This doesn't appear to have much to do with Struts... :-/ Anyway, it
looks like you're not closing your DB connections. I don't know anything
about dbtags, but I would guess it provides a way to do this.
Of course ideally you wouldn't be doing database stuff in a JSP in the
first place :-)
L.
Balazs Michnay wrote:
> Dear Struts users,
>
> Finally I managed to get DB-handling working, but I'm experiencing problems.
> When I query the database for about the 10th time, I get the following error message:
>
> "java.lang.OutOfMemoryError: PermGen space
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> .... ..."
>
> In previous posts I read that I can somehow check the memory usage and see if I ran out of memory.
> Where can I check this? Any suggestions on fixing this? I hope there is a way to fix this, because
> I found very few resources online on how to set up database handling in Struts.
>
> ----------------------------
> Here's how I set it up (if it helps...)
>
> 1) I added mysql driver's jar file to my projec's lib directory and I copied
> taglibs-dbtags.tld to WEB-INF
>
> 2) These lines were added to web.xml:
>
> <resource-ref>
> <description>DB Connection</description>
> <res-ref-name>jdbc/SZTGKR</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> <taglib>
> <taglib-uri>/WEB-INF/dbtags.tld</taglib-uri>
> <taglib-location>/WEB-INF/taglibs-dbtags.tld</taglib-location>
> </taglib>
>
>
> 3) And I used the connection in a jsp:
>
> <%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %>
>
> <sql:connection id="conn1">
> <sql:userId>userakarmi</sql:userId>
> <sql:password>kod</sql:password>
> <sql:url>jdbc:mysql://localhost:3306/proba</sql:url>
> <sql:driver>com.mysql.jdbc.Driver</sql:driver>
> </sql:connection>
>
> <sql:statement ...
> --------------------------------------
>
> If there is no way to fix this, any guides to any working configurations?
> I'm really looking forward to getting some replies, because I'm stuck here.
> Thanks a lot for your help!!
>
> Regards,
>
> Michnay
>
>
>
>
> ____________________________________________________________________________________
> Need Mail bonding?
> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
> http://answers.yahoo.com/dir/?link=list&sid=396546091
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org