Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Problem with SAConnection.Close() method

3 posts in General Discussion (old) Last posting was on 2008-06-28 19:13:55.0Z
Abhishek Posted on 2008-06-27 08:09:17.0Z
From: "Abhishek" <nospam_abhishekpandey@yahoo.com>
Newsgroups: sybase.public.sqlanywhere
Subject: Problem with SAConnection.Close() method
Date: Fri, 27 Jun 2008 13:39:17 +0530
Organization: Aioe.org NNTP Server
Lines: 36
Message-ID: <g4277e$4et$1@aioe.org>
NNTP-Posting-Host: FGNgxYIhqxE26H1CfHDv8Q.user.aioe.org
X-Complaints-To: abuse@aioe.org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-Priority: 3
X-MSMail-Priority: Normal
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!newsfeed.gamma.ru!Gamma.RU!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!club-internet.fr!feedme-small.clubint.net!aioe.org!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:91
Article PK: 866542

Hi All,

I am having a problem with the SAConnection.Close() method. It is not
releasing the Database connection at all. For those who want to see the
sample code, it is something like this:

////////////////////////////////////////////////////
public class SomeClass {

private SAConnection m_Connection;

public int SomeFunction() {

m_Connection = new SAConnection(connectionString); // I am getting
the connection string from some other function
m_Connection.Open(); // this is successful
SACommand cmd = m_Connection.CreateCommand();
cmd.CommandText = "insert ...";
cmd.ExecuteNonQuery();
m_Connection.Close();
}
}
////////////////////////////////////////////////////

After the call to Close() above, my connection is still not released and
therefor I am getting other issues in my code. I verified using Sybase
Central that the connection is indeed not closed.

Can anyone tell me what is going on wrong here. I am using C# .Net 2.0 for
coding and Sybase version is 10.0.1.3649.

Thanks in advance,
Abhishek


Jeff Albion (Sybase iAnywhere) Posted on 2008-06-27 20:12:12.0Z
From: "Jeff Albion (Sybase iAnywhere)" <firstname.lastname@ianywhere.com>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
Newsgroups: sybase.public.sqlanywhere
Subject: Re: Problem with SAConnection.Close() method
References: <g4277e$4et$1@aioe.org>
In-Reply-To: <g4277e$4et$1@aioe.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4865499c$1@forums-1-dub>
Date: 27 Jun 2008 13:12:12 -0700
X-Trace: forums-1-dub 1214597532 10.22.241.152 (27 Jun 2008 13:12:12 -0700)
X-Original-Trace: 27 Jun 2008 13:12:12 -0700, vip152.sybase.com
Lines: 20
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:93
Article PK: 866540

Answered in the sybase.public.sqlanywhere.general forum.

See:
http://groups.google.com/group/sybase.public.sqlanywhere.general/msg/244f55fc7211cecd

Regards,

Abhishek wrote:
> After the call to Close() above, my connection is still not released and
> therefor I am getting other issues in my code. I verified using Sybase
> Central that the connection is indeed not closed.

--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summary.do?baseprod=144&client=ianywhere&timeframe=0


Jason Hinsperger Posted on 2008-06-28 19:13:55.0Z
From: "Jason Hinsperger" <NO_jason_hinsperger_SPAM@hotmail.com>
Newsgroups: sybase.public.sqlanywhere
References: <g4277e$4et$1@aioe.org>
Subject: Re: Problem with SAConnection.Close() method
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <48668d73@forums-1-dub>
Date: 28 Jun 2008 12:13:55 -0700
X-Trace: forums-1-dub 1214680435 10.22.241.152 (28 Jun 2008 12:13:55 -0700)
X-Original-Trace: 28 Jun 2008 12:13:55 -0700, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:94
Article PK: 866541

ADO.Net pools connections by default, so when you disconnect the connection
is placed back in a pool and not actually disconnected.
You can change this behaviour via a setting in your connection string.

--
Jason Hinsperger
Product Manager
Sybase iAnywhere
http://iablog.sybase.com/hinsperg

SQL Anywhere Developer Community
http://www.ianywhere.com/developer

"Abhishek" <nospam_abhishekpandey@yahoo.com> wrote in message
news:g4277e$4et$1@aioe.org...
> Hi All,
>
> I am having a problem with the SAConnection.Close() method. It is not
> releasing the Database connection at all. For those who want to see the
> sample code, it is something like this:
>
> ////////////////////////////////////////////////////
> public class SomeClass {
>
> private SAConnection m_Connection;
>
> public int SomeFunction() {
>
> m_Connection = new SAConnection(connectionString); // I am getting
> the connection string from some other function
> m_Connection.Open(); // this is successful
> SACommand cmd = m_Connection.CreateCommand();
> cmd.CommandText = "insert ...";
> cmd.ExecuteNonQuery();
> m_Connection.Close();
> }
> }
> ////////////////////////////////////////////////////
>
> After the call to Close() above, my connection is still not released and
> therefor I am getting other issues in my code. I verified using Sybase
> Central that the connection is indeed not closed.
>
> Can anyone tell me what is going on wrong here. I am using C# .Net 2.0 for
> coding and Sybase version is 10.0.1.3649.
>
> Thanks in advance,
> Abhishek
>
>
>