Amali Prem

Greenhorn
+ Follow
since Dec 13, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amali Prem

Thanks for all your replies. But let me state the problem clearly.
In our application , for some parts they have used iBATIS and for the rest it is normal connection pooling. We dont have a memory leak in the iBATIS part.But there is a problem with the normal connection pooling part.

They have used Singleton pattern for establishing connection i.e at any point of time only one connection will exist.
Have a look at the method below :

static public SQLgoodies getSQLGoodies()
{
if ( globalSQLGoodies == null)
{
globalSQLGoodies = new SQLgoodies();
Properties props = getConnectionProps();
globalSQLGoodies.connectToDB("", props);
}
return globalSQLGoodies;
}
The method connectToDB will establish the connection and there is another method getConnection() that will return the connection. So whenever connection to the DB is required the following will be used

connection = getSQLGoodies().getConnection();

The connection is not closed anywhere and so only the very first time the connectToDB() method will be called and from there on the same connection will be used again and again until the user closes the application.
So,no where has the connection,statement or resultsets have been closed.

Is not closing the resultsets and statements the cause for memory leak?

Is there any meaning to closing the resultsets and statements without actually closing the connection?
when i give echo %path% i get something as below
C:\WINDOWS\system32;C:\WINDOWS;
C:\WINDOWS\System32\Wbem;C:\Program Files\Informix\ClientSDK\bin;
C:\Program Files\Microsoft SQL Server\80\Tools\BINN;
C:\WINDOWS\system32;
C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Informix\Client-SDK\bin;
C:\Program Files\Microsoft SQL Server\80\Tools\BINN;
D:\NetBeans5.5\ide7\ant\bin
13 years ago
I didnt modify ant.bat and when i give echo %JAVA_HOME% also i get only this C:\Program Files\Java\JDK 1.4\bin

The ant i am using came in as an add in with Netbeans IDE 5.5. should i check for any other property?
13 years ago
i am running ant from command line. what property should i set so that the ant compilation happens in 1.4?
13 years ago
hi Roger Chung-Wee,

what you are mentioning is absolutely correct and i am also not able to actually understand how sending a connection to pool and retrieving it back is actually in anyway relate to memory usage.Thats why i have posted this in the first case.If anyone gets any idea of what is happening can help me.i just thought about one more thing. If i close resultsets and statements without closing connection, do they actually get closed? Because initially in my finally block i had only closed the resultsets and statements and not connections. Anyone has any idea?
hi rob

Thanks for your reply. But i have closed the statements and resultssets in my finally block. But that didnt help.Only when i closed the connection and reopened again the constant increase in memory usage didnt happen. And when i say reopen, i am getting the same connection that was used earlier back from the pool. Note that there is only one connection. I send it back to the connection pool by invoking the close method and retrieving the same connection back. But this is actually preventing the constant increase in memory.
i dont get this point only. can someone please explain.
hi rob

Thanks for your reply. But i have closed the statements and resultssets in my finally block. But that didnt help.Only when i closed the connection and reopened again the constant increase in memory usage didnt happen. And when i say reopen, i am getting the same connection that was used earlier back from the pool. Not that there is only one connection. I send it back to the connection pool by invoking the close method and retrieving the same connection back. But this is actually preventing the constant increase in memory.
i dont get this point only. can someone please explain.
Hi all,

In our project, they have used singleton pattern for connection handling part such that not more than one connection is open to the database. So, the same connection will be used again and again. will this actually affect memory usage in any way?
Because recently we had some issues and had to monitor the memory usage and it seemed to be increasing constanly.But when i explicitly closed the connection and opened it again (here, when i say closing the connection means sending it back to the connection pool), the memory seems to remain constant. I dont get the whole problem. Is using the same connection again and again for many operations going to cause a memory probelm? please explain.
Hi,

can someone clarify me this? i have set my environment variables as below:

CLASSPATH :C:\Program Files\Java\JDK 1.4
JAVA_HOME :C:\Program Files\Java\JDK 1.4\bin

and now when i give the command ant -verbose, i get something like below :

Detected Java version: 1.5 in: C:\Program Files\Java\jre1.5.0_11

Why does it take 1.5? Can someone explain?
13 years ago
The total number of questons were 72 only.
Yes Srinivas. that's true. I took the exam two weeks back and the duration was 3 hrs and 25 mins. Initially i had some questions asking how i rate myself on various topics. i am not sure if the extra time was meant for that . But the total time given was 3hrs and 25 mins. Thats for sure because i took up the exam just 2 weeks back.
Vani,

Did you find a solution? Because i have a similar problem where i need to compile my .jrxml file to .jasper files using 1.4. I have set my Java_Home and Classpath to point to 1.4. However when i run ant the compilation happens in 1.5. When i give the command ant -verbose, i get something like below :

Detected Java version: 1.5 in: C:\Program Files\Java\jre1.5.0_11

Why does it take 1.5 when i have set my Java_Home to 1.4? Can someone explain?
13 years ago
Thanks Paul
13 years ago