Connection problem do DB2 via ODBC

Connection problem do DB2 via ODBC

Post by Jan Devri » Thu, 06 Mar 2003 17:11:01



Hi,
  My problem occurs while connecting to DB2 via DAO 3.51
  My application opens an ODBC DB2 database. After I open several recordsets
on this database. As follows:
 set db=OpenDatabase("", 0,  0, strConnectionString)
 set rc1= db.opendatabase("SELECT * FROM TB1",dbopendynaset)
 set rc2= db.opendatabase("SELECT * FROM TB1",dbopendynaset)
 set rc3= db.opendatabase("SELECT * FROM TB1",dbopendynaset)
....

 Connection string is a regular connection string. However, when I look to
DB2's connection count, I see a new connection to each recordset. This
causes the server to halt. I've checked the ODBC trace, I can see that each
recordset opens a new connection to database using "SQLConnect". How can I
stop this?

Jan Devrim

 
 
 

Connection problem do DB2 via ODBC

Post by Steven Bras [M » Fri, 07 Mar 2003 07:19:41


First, I'm assuming you mean "OpenRecordset" and not "OpenDatabase" when
executing your queries.

Unfortunately, what you're seeing is the default behavior of an ODBC data
source with DAO. To my knowledge, there is no way to control how many
connections DAO opens for you.

I would highly recommend using ADO, which gives you much more control over
these factors, and, with OLEDB, features sophisticated connection pooling
that has better control over the connections opened by the data access
layer.

Hope this helps!

Steven Bras, MCSD
Microsoft Developer Support/Visual Basic WebData

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

 
 
 

Connection problem do DB2 via ODBC

Post by Jan Devri » Fri, 07 Mar 2003 17:54:36


Hi,
  Yes. I wrote the post wrong. It should be OpenRecordset. Sorry

  When we use map connections to one connection using DB2 Client tools,
application started locking recordsets. We are opening them as dynasets,
there should be no locking I guess. But, It locks the table, so that you
cannot even just execute a select query using any tool.

  Is there an explanation for this? I'm stuck in this problem.
  BTW, there is no way to convert all the application to ADO. It will take
so much time and will need so many tests. We have offered client to move to
SQLServer, which the application works perfect. However, they deny to do
this.



Quote:> First, I'm assuming you mean "OpenRecordset" and not "OpenDatabase" when
> executing your queries.

> Unfortunately, what you're seeing is the default behavior of an ODBC data
> source with DAO. To my knowledge, there is no way to control how many
> connections DAO opens for you.

> I would highly recommend using ADO, which gives you much more control over
> these factors, and, with OLEDB, features sophisticated connection pooling
> that has better control over the connections opened by the data access
> layer.

> Hope this helps!

> Steven Bras, MCSD
> Microsoft Developer Support/Visual Basic WebData

> This posting is provided "AS IS" with no warranties, and confers no
rights.

> Are you secure? For information about the Microsoft Strategic Technology
> Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.com/security.

 
 
 

Connection problem do DB2 via ODBC

Post by Steven Bras [M » Fri, 14 Mar 2003 04:22:31


Unfortunately there is no converter that I know of that will convert your
DAO code; you will have to write that from scratch, I'm afraid.

What are "Map Connections". You state that when you use "map connections"
you see table locking. Please explain.

I highly recommend using ADO; DAO was primarily designed for use with
Access, and while it can use ODBC data sources, it is certainly not
optimized for them. Bear in mind you can combine DAO and ADO in your
application, so you can make the transition slowly if need be.

Steven Bras, MCSD
Microsoft Developer Support/Visual Basic WebData

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

 
 
 

1. Problem with ODBC Connection to DB2 via PHP

Hallo,

habe folgendes Problem
Ich m?chte mit PHP auf DB2 ber die ODBC Funktionen zugreifen.
Bekomme aber beim odbc-connect folgenden Fehler

Warning: SQL error: [Microsoft][ODBC Driver Manager] Der
Datenquellenname wurde nicht gefunden, und es wurde kein
Standardtreiber angegeben., SQL state IM002 in SQLConnect in
e:\workbench\db2 connect\db2lib.php on line 10
Connection to database failed.
Warning: odbc_errormsg(): supplied argument is not a valid ODBC-Link
resource in e:\workbench\db2 connect\db2lib.php on line 14

Der ODBC Treiber ist meiner Meinung nach korrekt installiert, weil ich
per ACCESS auf die DB2 Datenbank zugreifen kann.

Ich vermute ich hab eher ein Problem mit der PHP Konfiguration.

Es ist eine Standardwindowsinstallation von PHP4 ber das EASYPHP 1.6
.
Ich habe leider bislang keine Informationen , die mir weiterhelfen im
Netz gefunden.

Hat irgendwer einen Tip ?!
(Den Tip eine andere DB zu verwenden ist bestimmt gut, aber nicht
m?glich ;-) )

Sabrina

2. AIX/Sybase memory use

3. db2 connection via odbc?

4. SQL Like statement?

5. DB2 OS/390 crashing after connection via DB2 Connect

6. Yipes - get descriptor

7. Problem due to Access 2000 import via ODBC connection

8. NT Server Administrator in Long Island

9. Problems with Connection from Windows Platform to 4D (fourth dimension) Server via ODBC for 4D Server

10. ODBC connection to DB2 on AS/400 and performance with protocols / port / connection

11. Serious Problem in doing Object transfer using DTS ObjectTransfer via VB

12. LU62 CONNECTION TO IBM DB2 VIA SQLNET ORACLE NT SERVER 7.3.3

13. Updating DB2/2 via ODBC