Hello Kirill,<div><br></div><div>thanks for your suggestions. I'll try to change my application (j2se) to make it work with a connection pool.</div><div><br></div><div>Best regards</div><div><br></div><div>Fernando<br>
<br><div class="gmail_quote">On Thu, Nov 12, 2009 at 3:01 AM, Kirill Zinov <span dir="ltr"><<a href="mailto:kirill.zinov@gmail.com">kirill.zinov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
Hello Fernando,<br>
<br>
Looks like something has not been released after you closed connection.
This may happen due to java native. I mean garbage collector approach
to free the objects. If you'll use a proper connection pool it will
take care of the connections re-usage and will speed up your
application.<br>
<br>
When I began my Java coding I tried a low level approach too. Thanks to
my friend with strong skills in j2ee, I have realized the benefits from
Hibernate and other frameworks faster.<br>
<br>
Take a look at Hibernate: <a href="https://www.hibernate.org/" target="_blank">https://www.hibernate.org/</a><br>
<br>
There is a spatial extension: <a href="http://www.hibernatespatial.org/" target="_blank">http://www.hibernatespatial.org/</a><br>
<br>
I didn't try spatial extension as I wrote before. Even if you will
decide not to use Hibernate, I suggest you read a few good articles
about connection pooling. It’s a faster way to post/get data because of
the connections re-usage. Actually this is a de facto standard in Java
world.<br><font color="#888888">
<br>
Kirill,</font><div class="im"><br>
<br>
Fernando Tong wrote:
<blockquote type="cite">Hello Kiril,
<div><br>
</div>
<div>I'm afraid i'm not using a connection pooling, just an static
way to load the drivers</div>
<div><br>
</div>
<div>
<div>public class PgSQLDBConn {</div>
<div><br>
</div>
<div><span style="white-space:pre"> </span>static
{</div>
<div><span style="white-space:pre"> </span>try
{</div>
<div><span style="white-space:pre"> </span>Class.forName("org.postgresql.Driver");</div>
<div><br>
</div>
<div><span style="white-space:pre"> </span>}
catch (Exception e) {</div>
<div><span style="white-space:pre"> </span>System.out.println(e.getMessage());</div>
<div><span style="white-space:pre"> </span>}</div>
<div><span style="white-space:pre"> </span>}</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="white-space:pre"> </span>public
Connection getConnection() {</div>
<div><span style="white-space:pre"> </span>Connection
connection = null;</div>
<div><span style="white-space:pre"> </span>try
{</div>
<div><span style="white-space:pre"> </span>connection
=
DriverManager.getConnection("jdbc:postgresql://localhost:5432/db_gpstracker","MYUSER","MYPWD");</div>
<div><span style="white-space:pre"> </span>}
catch (Exception e) {</div>
<div><span style="white-space:pre"> </span>System.out.println(e.getMessage());</div>
<div><span style="white-space:pre"> </span>}</div>
<div><span style="white-space:pre"> </span>return
connection;</div>
<div><span style="white-space:pre"> </span>}</div>
<div>}</div>
<div><br>
</div>
</div>
<div>I call the method getConnection each time i want to connect to
the database, execute the statements and then i close the connection
(repeat each time i receive some data from the GPS device)</div>
<div><br>
</div>
<div>Best regards</div>
<div><br>
</div>
<div>Fernando<br>
<br>
</div>
</blockquote>
<br>
</div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br></div>