X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0048D52B23 for ; Wed, 13 Jul 2005 17:47:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60115-04 for ; Wed, 13 Jul 2005 20:47:54 +0000 (GMT) Received: from gk-us2.michelin.com (gk-us2.michelin.com [156.65.14.19]) by svr1.postgresql.org (Postfix) with ESMTP id 96F6E52A8C for ; Wed, 13 Jul 2005 17:47:52 -0300 (ADT) Received: from ONCMH1.onc.michelin.com (unverified) by gk-us2.michelin.com (Content Technologies SMTPRS 4.3.17) with ESMTP id for ; Wed, 13 Jul 2005 16:47:13 -0400 Received: from oncmtap1.onc.michelin.com by oncmh1.onc.michelin.com with ESMTP for pgsql-odbc@postgresql.org; Wed, 13 Jul 2005 16:47:53 -0400 Received: from oncems01.onc.michelin.com ([156.65.125.150]) by oncmtap1.onc.michelin.com (Netscape Messaging Server 4.15) with ESMTP id IJL33T00.S74 for ; Wed, 13 Jul 2005 16:47:53 -0400 Received: from [10.43.15.207] (unverified) by oncems01.onc.michelin.com (Content Technologies SMTPRS 4.2.5) with ESMTP id for ; Wed, 13 Jul 2005 16:47:52 -0400 Message-Id: <42D57DF4.6050909@us.michelin.com> Date: Wed, 13 Jul 2005 16:47:48 -0400 From: "Greg Campbell" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Pgsql-Odbc (E-mail)" Subject: Re: MS Access and #deleted due to timeouts References: <42D44150.5030407@us.michelin.com> In-Reply-To: <42D44150.5030407@us.michelin.com> Content-Type: multipart/mixed; boundary="------------000801000006080103030709" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/49 X-Sequence-Number: 5515 This is a multi-part message in MIME format. --------------000801000006080103030709 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Further research shows that I there is definitely a timeout issue. The issue seems to be with Access and its technique for implementing Dynaset by having keysets. Short solution: Use regedit to set \\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\JET\4.0\Engines\ODBC \\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\JET\3.5\Engines\ODBC key ConnectionTimeout to value of 0. (default is 600 decimal = 10 minutes) A value of 0 means that connections will never timeout for being idle. Long answer: For chuckles..you can try set ConnectionTimeout to 120 (2 minutes)or less and see how frustrating it is when #delete shows up after brief inactivity. My best understanding is that in most datasheet and form views, Access want to establish a keyset. So it does a fetch pass to just get the keys values... and then another fetch pass to get the values. The key values allow it to pull individual records and act as a dynaset, that is issue UPDATE commands behind the scenes for individual records as mere mortals scroll up and down while editing a datasheet. Well after the connection hits timeout or inactivity, the first passes still work (to get the keys -- the number of records), but somehow the second fetch passes (to get the actual data) return SQL_NO_DATA_FOUND. All keys and no data equals a screen full of #deleted, but with the correct number of records. If the connection has timed out why don't both fetch passes fail, or connection(s) for both passes get re-established? I do not know. I am pretty sure it is a matter of ODBC calls Access is passing to the pgodbc driver, and so somewhat beyond our control. I am guessing that setting ConnectionTimeout to 0 should be standard fare for workstations with Access linked to PostgreSQL. Greg Campbell wrote: > I have distinctly noticed that when I leave my Access database with > PostgreSQL linked tables for any considerable length of time, all fields > in ALL linked tables say #deleted in data table view (and I'd assume > form view as well). > > > Notes: > I have OIDS and Primary keys on the tables. Access is aware of this. And > I have row versioning turned on. > > Troubleshooting: > I turned on the ODBC trace. > What I see is a simple select query does a SQLExecDirectW (e.g. "SELECT > "public"."employees"."first_name" from "public"."employees" /0"). > Then it does an SQLFetch and SQLGetData for each row. (No obvious data > returned). > > Then it does a SQLPrepareW that look like > "SELECT "public"."employees"."first_name" FROM "public"."employees" > WHERE "emp_id"=? or "emp_id"=? or "emp_id"=? or "emp_id"=? or > "emp_id"=? or "emp_id"=? or "emp_id"=? or "emp_id"=? or "emp_id"=? or > "emp_id"=? \0" > > Then it does a SQLBindParamter for each of the 10 instance of emp_id. > Why it enumerates the same paramter 10 times is a mystery to me. > > Then it does a fetch and three (3) SQLGetDatas for each row. > I don't know what the first ones doing. The 2nd returns data,data_type, > data_length. The 3rd,...well I'm not sure what that one's doing. > > In data view I see my data. > > Then I let 20 or 30 minutes pass. > > Same as above, except after binding parameters, my first fetch returns a > code 100 (SQL_NO_DATA_FOUND). > In the data view I see a #deleted for each record. > > Here are my question? > 1. Are two passes of fetches absolutely necessary each time I run my query? > 2. What's up with all the parameters to my primary key. > 3. I noticed that my connection handle (HSTMT) was the same before and > after my 30 minute time-out. Could the Postgresql server have timed out > my connection while my ODBC driver still thinks it is a viable > connection, and tries to re-use it? > 4. What the best way to handle this open connection pooling? My general > practice has been that very short lived connections are good (say a > minute or so), but I am not sure if that applies with a thick client > like Access. > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org --------------000801000006080103030709 Content-Type: text/x-vcard; charset=utf-8; name="greg.campbell.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="greg.campbell.vcf" begin:vcard fn:Greg Campbell n:Campbell;Greg org:Michelin North America - US5 Lexington;ENG-ASE email;internet:greg.campbell@us.michelin.com title:ASE Systems Engineer tel;work:803-951-5561/x75561 x-mozilla-html:FALSE version:2.1 end:vcard --------------000801000006080103030709--