ADODB.Connection closing issues

A

Andy G

I have some code that hits a DB2 database from my ASP.NET application. I
haven't been able to exactly nail it down but my connections are not getting
closed for some reason. I look at the database and it's like everytime I
click a button in the ASP.NET applicaiton and it runs a database command it
leaves the connection open. The DBA's are not happy with me right now.
Luckily I'm still in test. Does anyone have any idea why the below code is
not closing the connection to the database correctly. Or maybe it has
something to do with the version of DB2, CAE, or I need to add a IMB DB2
reference to my project. Any help will be help.

Thanks.
Andy


Dim DataConn As ADODB.Connection
DataConn = New ADODB.Connection DataConn.ConnectionTimeout =
Session("DataConn_ConnectionTimeout") DataConn.CommandTimeout =
Session("DataConn_CommandTimeout")
DataConn.Open(Session("DataConn_ConnectionString"),
Session("DataConn_RuntimeUserName"), Session("DataConn_RuntimePassword"))

rs = New ADODB.Recordset
rs.Open("Select distinct(camp_id)" & " from atlt.camps_web_camp where
camp_id >=' '" & " Order by camp_id asc", DataConn, 1, 3)

DataConn.close( )
 
A

Andrew Robinson

Andy,

Is this ASP.NET or possible Classic ASP?

If it is ASP.NET, you might look at using the native iSeries connector
provided by IBM. There are some issues with it under ASP.NET 2.0 but it
works well with v1.x. Otherwise, you might look at using the navtive OLEDB
provider. Not sure if "native" is the correct term here, but it works well.

If you are using Classic ASP with Classic ADO, you might try posting this to
the microsoft.public.data.ado group.

-Andrew
 
P

PL

Looks a lot like classic ASP code, not ASP.NET

The only thing I can suggest is that the open connections was left open
after an error occurred while testing, if you get an error in your query it would
not continue down and close the connection.

Error handling was a real pain in classic ASP, if at all possible you should
consider moving to ASP.NET.

PL.
 
A

Andy G

Good ideas Andrew. This was a ASP app that I just converted to ASP.NET.
The code still resides in the HTML of the page <% %>. I think it might come
down to this line: DataConn.close( ). It should be DataConn.Close

It looks like the connections are being closed now. You would think I'd get
an error doing it using .Close( ), huh, anyways.

Thanks
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top