noreply | 7 Feb 14:14
Gravatar

[ psqlodbc-Bugs-1011159 ] ODBC driver names on 64bit platforms

Bugs item #1011159, was opened at 2012-02-07 14:14
You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1011159&group_id=1000125

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jochen Wezel (jwezel)
Assigned to: Nobody (None)
Summary: ODBC driver names on 64bit platforms

Initial Comment:
On x84 and x64 systems, psqlodbc.msi installs 2 odbc drivers called
- "PostgreSql ANSI"
- "PostgreSql Unicode"

On x64 systems, psqlodbc_x64.msi installs 2 odbc drivers called
- "PostgreSql ANSI(x64)"
- "PostgreSql Unicode(x64)"

As a result, 
1. the driver name "PostgreSql" (which is often used in connection string examples on the web) doesn't work
2. the driver name differs on x64 machines for applications running in x86 mode or x64 mode. MS Access 32bit
can use the regular name "PostgreSql Unicode" but MS Access 64bit must use "PostgreSql Unicode(x64)".
This requires us to provide 2 database files for both platforms.

Suggested, simple solution:

(Continue reading)

Fred Parkinson | 27 Jan 16:32
Favicon

odbc link keep losing it senses

I have a postgresql 8.1.22 installation on a suse linux 10.1 box on a vmware virtual server.
 
I am using odbc driver 8.02.04 to link an M$ Access application to the postgresql database.
For some reason, every time I close the Access program, then re-open it and try to read from one of the tables, I get the error:
"ODBC--connection to '{PostgreSQL ANSI}<ip address>' failed."
 
Then when I use the Access menu tool File>Get External Data>Link Tables and choose the postgresql odbc option to the database, the link executes correctly and I am in.  Until the next time I open the Access app., then I have to start over.
 
Any ideas why the ODBC link is so fragile, and breaks every time I close my application?
 
Thanks.
 
 
 
Fred Parkinson
Application Programmer
Association of Bay Area Governments
510-464-7931
Josef Springer | 26 Jan 12:49

ODBC for Windows-64 ?

Hello,

where can i found the ODBC-Driver for Windows-64, thanks ?

mit freundlichen Grüßen / best regards,
Josef Springer
(Geschäftsleitung/Management)

Postal
	Address
	_Josef.Springer <at> joops.com_
	Orlando-di-Lasso Str. 2
	D-85640 Putzbrunn
Phone
	Office
	+49 (0)89 600 6920
	
	
Phone 	Fax
	+49 (0)89 600 69220
	
	
Web
	Web
	http://www.joops.com
	
	

JOOPS
	(HRB München 86239)

*-- the software company --*

Unais Muhammed | 9 Jan 18:53
Picon

bug report - Transaction Rollback not successful

Dear sir,


This is to report a suspected  bug in  psqlODBC 09.01.0100 when used with Microsoft Visual Basic 6 with ADODB 

This happens when a transaction with  INSERT INTO - SELECT combination queries  rolled back on an error. The queries before the the occurance of the error ( Rollback is initiated)  found committed when some other transaction is committed. ie. the querries in the transaction block upto the rollback statement is committed when some other transaction block is committed (Eg. Sale is saved, Order is Edited etc.). 

In my case the bug noticed in the following function. This is for converting a sale order to a sale. 
--------------------------------------------------------------------------------------------------   
Public Function ConvertOrder(OrdNo As Long) As Boolean

On Error GoTo err_here
Dim IsStartTrans as boolean
IsStartTrans  = False
ConvertOrder = False
Dim RSOrd As New ADODB.Recordset
SqlStr = "Select * from orders where firm_id=" & PubFirmId & " AND   OrdNumber=" & OrdNo & " ;"
RSOrd.Open SqlStr, dbx
If RSOrd.EOF Then
    MsgBox "Order No. " & OrdNo & " Not Available for Conversion", vbInformation
    Exit Function
End If

RSOrd.MoveFirst
If RSOrd!closed = 1 Then
    'Closed Order
    Exit Function
End If

Dim SaleNo As Long

SaleNo = GetNewSaleNumber ' THIS IS A FUNCTION TO GET THE NEXT SALE BILL NUMBER

IsStartTrans = True
dbx.BeginTrans

'SQL No.1

SqlStr = "INSERT INTO sale( " & _
            "firm_id, invnumber, invdate, salesmancode, cust_number, cust_name, " & _
            "routecode, pricegroup, totalamount, totaldiff, discount, paid," & _
            "journalrefno, isrm, orderno, memo, lastbalance) " & _
"SELECT firm_id,  " & SaleNo & " as invnumber,'" & Format(Now(), "yyyy-mm-dd hh:mm:ss") & "',  salesmancode, cust_number, " & _
       "cust_name, routecode, pricegroup, totalamount, totaldiff, discount, " & _
       "paid , 0, IsRM, ordnumber, Memo, get_head_current_balance(" & PubFirmId & ", cust_number) " & _
        "FROM orders where firm_id=" & PubFirmId & " AND  OrdNumber=" & OrdNo & " ; "
dbexecute SqlStr   'dbexecute IS A FUNCTION TO EXECUTE THE QUERRY SqlStr

'SQL No.2
SqlStr = "INSERT INTO saleit(" & _
            "firm_id, invnumber, item_code, qty, rate, cost, slno) " & _
        "SELECT firm_id, " & SaleNo & " as invnumber, item_code, qty, rate, cost,  slno " & _
        "FROM orderit  where firm_id=" & PubFirmId & " AND  OrdNumber=" & OrdNo & " ;"
dbexecute SqlStr

'SQL No.3
SqlStr = "select add_item_stock(" & PubFirmId & ",item_code, (0 - qty)::real  ) FROM orderit  where firm_id=" & PubFirmId & " AND  OrdNumber=" & OrdNo & " ;"
dbexecute SqlStr

'add_item_stock is a function to modify the stock in the items table 

'SQL No.4

SqlStr = "UPDATE orderit SET SoldQty = Qty  WHERE   firm_id=" & PubFirmId & " AND   OrdNumber=" & OrdNo & " ;"
dbexecute SqlStr
 
SQL No.5
SqlStr = "update orders set Closed=true where firm_id=" & PubFirmId & " AND   OrdNumber=" & OrdNo
dbexecute SqlStr

dbx.CommitTrans
IsStartTrans = False
ConvertOrder = True
Exit Function

err_here:
if IsStartTrans  then 
     dbx.RollbackTrans
     MsgBox "Order No. " & OrdNo & " Could not Convert" & vbCrLf & Err.Description
Else
     Msgbox "Error : " & Err.Description

End if
End Function

--------------------------------------------------------------------------------------------------------------------------------------------------
Query No:1 and 2 are INSERT INTO - SELECT combination queries for taking some data (one row ) from order table and inserting to Sale table & Orderit to SaleIt Table

Query No.3 is for updating the stock. if the stock goes below zero, the function triggers an error and the error handler is executed and the transaction is rolled back. When I used ODBC  09.01.0100  the transaction is not rolled back completely. The SQL No.1 &2 are held until any other program segment tries to commit some other transaction outside this function and  new rows are found added in Sale and SaleIt tables.

This is not happening when PSQLODBC Version 8.01.02.00 is used. 

I hope this report will help improving the PSQLODBC  project. 

For any further clarification, kindly feel free to call me on +91 9447033489

Thanks & Regards

K.Muhammed Unais
System Administrator,
Kerala State Electricity Board,
Kozhikode, Kerala, india


--
---------------------------------------------------------------------------------------------------------------------------------------
If a man is called to be a streetsweeper, he should sweep streets even as Michelangelo painted, or Beethoven composed music, or Shakespeare wrote poetry. He should sweep streets so well that all the hosts of heaven and earth will pause to say, here lived a great streetsweeper who did his job well.
- Martin Luther King, Jr.


Honza Horak | 6 Jan 09:56
Picon
Favicon

Errors found by static analysis tool

Hi,

I'm sending this mail again, because the first two attempts don't seem 
to be successful (sorry if it's duplicate). Trying without the 
attachments, they can be found at links below.

psql-odbc-09.00.0200 has been scanned using Coverity static analysis 
tool, which discovered several more or less severe problems [1]. Please 
note, that there can be some false positives, but many of them are real 
issues.

A patch [2] with some obvious fixes and the error report itself are 
attached.

Cheers,

Honza

[1] 
http://hhorak.fedorapeople.org/psql-odbc-coverity/120105-psql-odbc-09.00.0200-coverity.err
[2] 
http://hhorak.fedorapeople.org/psql-odbc-coverity/120105-psqlodbc-coverity.patch

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Hiroshi Saito | 30 Dec 16:32
Picon

psqlODBC 09.01.0100 Released

We are pleased to announce the release of psqlODBC 09.01.0100. For
details of the changes in this release, please see the notes at:
http://psqlodbc.projects.postgresql.org/release.html

With this release two versions of the driver are provided for Windows;
'PostgreSQL ANSI' which supports single and multibyte applications
through the ANSI ODBC API, and 'PostgreSQL Unicode' which provides
Unicode support through the Unicode ODBC API. Microsoft's Distributed
Transaction Coordinator (MSDTC) is also supported.

On Unix systems, the driver type (ANSI or Unicode) may be selected
via a configure option. It can be compiled with UnixODBC or iODBC.

A new 64 bit version of the driver is also available for Windows, and
includes native SSPI and GSSAPI support, and doesn't require libpq.

psqlODBC may be downloaded from
http://www.postgresql.org/ftp/odbc/versions/ in source, Windows
Installer, merge module, and basic zip file formats.

Please post any bug reports to the pgsql-odbc <at> postgresql.org mailing list.

I'd like to take this opportunity to thank all those involved with the
development, testing and bug fixing of the updated driver.

-- 
psqlODBC team.

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

JUNG, Christian | 7 Dec 18:00

Updateable Cursors with current PostgreSQL versions

Hello,

the ODBC-driver has an option to emulate updateable cursors (default "on"). AFAIK are updateable cursors
supported since PostgreSQL version 8.3. Does the driver have to emulate updateable cursors with current
PostgreSQL-versions or should this option be disabled for newer PostgreSQL releases?

I tried to figur it out myself, but the code is very tricky on the whole configuration stuff... :-S

regards
Chris

-- 
phone: +49 6898/10-4987
web  : www.shsservices.org

mail : Hofstattstraße 106a
       D 66333 Voelklingen

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
tamanna madaan | 11 Nov 08:15

enabling psqlODBC logs

Hi All

How can I enable psqlODBC logs ?? I want to collect error / warning / any critical info logs .

And where to check for these logs ??

Thanks..
Tamanna

--
Tamanna Madaan | Associate Consultant | GlobalLogic Inc.
Leaders in Software R&D Services
ARGENTINA | CHILE | CHINA | GERMANY | INDIA | ISRAEL | UKRAINE | UK | USA

Office: +0-120-406-2000 x 2971

www.globallogic.com


BGoebel | 9 Nov 17:10
Picon
Favicon

FETCH LAST is returning "no data" after a Cursor Update

Hi All,

this is a bug we have found when testing the unreleased psqlodbc30a.dll
9.00.0311.

The attached example shows an error using a  SELECT + CursorUpdate + FETCH
LAST.
After a SELECT we are updating the column name on the first row via
SQLSetPos and SQLEndtran.
Executing a Fetch LAST will returning 100/No Data

Sending a COMMIT via ExecuteSQL seems to work, but i do not know if that is
a really a reliable solution.

regards

BGoebel

Tested with pg 9.1 / psqlodbc30a.dll 9.00.0311 / Delphi7.0
-----------------------------------------------
     Used SQL Data/Definition

     drop table if exists customers;
     create table customers(nr integer, name varchar(100));
     insert into customers(nr, name) VALUES(1, 'Mayer');
     insert into customers(nr, name) VALUES(2, 'Miller');
     insert into customers(nr, name) VALUES(3, 'Smith'); 

-----------------------------------------------
 fEnvHandle := 0;
 fConnectHandle := 0;

 aRes := SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, fEnvHandle);
 aRes := SQLAllocHandle(SQL_HANDLE_DBC, fEnvHandle, fConnectHandle);

 aSqlSmallint := 0;
 aConnectString :=
'Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=postgres' +

';Uid=postgres;Pwd=mypwd;UpdatableCursors=1;usedeclarefetch=1;fetch=50';

 aRes := SQLDriverConnect(fConnectHandle,
                          GetDesktopWindow,
                          @aConnectString[1],
                          length(aConnectString),
                          nil,
                          0,
                          aSqlSmallint,
                          0);
   //switchin AUTOCOMMIT off
  aRes := SQLSetConnectAttr(fConnectHandle,
                                  SQL_ATTR_AUTOCOMMIT,
                                  pointer(SQL_AUTOCOMMIT_OFF),
                                  sizeof(SQL_AUTOCOMMIT_OFF));
   aRes:= SQLAllocHandle(SQL_HANDLE_STMT, fConnectHandle, hStmtSelect);
   aRes:= SQLAllocHandle(SQL_HANDLE_STMT, fConnectHandle, hStmtUpdate);

  //  Cursor : KeySetDriven + SQL_CONCUR_ROWVER(=updatable)
 aRes:= sqlSetStmtAttr(hStmtSelect,
                        SQL_ATTR_CONCURRENCY,
                                pointer(SQL_CONCUR_ROWVER),
                                sizeof(SQLSmallint));
 aRes:= sqlSetStmtAttr(hStmtSelect,
                        SQL_ATTR_CURSOR_TYPE,
                                pointer(SQL_CURSOR_KEYSET_DRIVEN),
                                sizeof(SQLSmallint));
  // Select ...
  aRes := SQLExecDirect(hstmtSelect,
          pchar('SELECT name FROM customers order by nr'),
          SQL_NTS);
 // fetch will read name
  aRes:= SQLBindCol(hstmtSelect, 1, SQL_C_CHAR, @szName[1], 50, cbName);

  // fetching/reading the first row
  aRow := 1;
  aRes := SQLFetchScroll(hStmtSelect, SQL_FETCH_NEXT, 0);

  // Changing data. Doing so, every time i call this snippet, the value will
be changed
    szName[0]:=Chr(cbName);
    IF szName[1]<'a'
       THEN
            szName := 'anyname'
       ELSE
            szName := 'ANYNAME';
    cbName:=Length(szName);
 // UPDATE data
  aRes := SQLSetPos(hstmtSelect,
                           1,
                           SQL_UPDATE,
                           SQL_LOCK_UNLOCK );

  // Make changes visible to other users --> commit
  //  aRes:=SQLExecDirect(hstmtUpdate, 'commit', SQL_NTS); //<-- next
SQLFetchScroll will work
  aRes := SQLEndTran(SQL_HANDLE_DBC, fConnectHandle, SQL_COMMIT); //<-- next
SQLFetchScroll will return 100

  aRes := SQLFetchScroll(hStmtSelect,
                               SQL_FETCH_LAST,
                                0);
  Assert(aRes = 0);

  aRow:=100;
  aRes := SQLFetchScroll(hStmtSelect,
                                SQL_FETCH_ABSOLUTE,
                                arow);
  Assert(aRes = 0);

--
View this message in context: http://postgresql.1045698.n5.nabble.com/FETCH-LAST-is-returning-no-data-after-a-Cursor-Update-tp4978166p4978166.html
Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Marten Lehmann | 9 Nov 02:42
Picon

SQLDescribeParam / SUPPORT_DESCRIBE_PARAM

Hello,

I noticed that unixODBC logs IM001 SQL_ERRORs for SQLDescribeParam in 
its tracefile. Actually, I first noticed the problem when I tried to use 
a prepared statement in PHP 5.3.8 with a PostgreSQL 9.1 database and I 
got error messages at odbc_execute() due to the SQLDescribeParam error.

First I thought that the problem is in PHPs ODBC extension because it 
worked fine back in PHP-5.3.3. But digging into the sources of PHP I 
found out, that the return value of SQLDescribeParam simply wasn't 
validated before 5.3.5 (and there as no 5.3.4 release), but it returned 
an IM001 SQL_ERROR ever since.

So following the chain I looked at the source of psqlodbc and noticed, 
that the library is prepared for a database connection that supports 
SQLDescribeParam and this is verified by SUPPORT_DESCRIBE_PARAM().

But what does it depend on, whether the connection supports it? psqlodbc 
is for PostgreSQL only. I built the latest PostgreSQL library, compiled 
the latest psqlodbc against it and SQLDescribeParam still threw the 
IM001 SQL_ERROR.

As a quick fix just created a patch for PHP for my internal use, which 
removes checking of the return values of SQLDescribeParam. But that 
seems very odd. I'd really like to understand what's behind this issue.

Kind regards
Marten Lehmann

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

BGoebel | 7 Nov 16:11
Picon
Favicon

Fetch absolute returns OK when fetching a nonexistent row

Hi All,

Once again i need your help.

The attached example shows an error using a simple ODBC SELECT + FETCH.
Fetching the (non existing) 100th row results in 0 (=ok) instead of 100(no
data). 

The error seems to be depend on the FETCH parameter of the connection
string:
When using ...;Fetch=3 in the connection string i get the right resultcode
100. 
A previous FETCH NEXT seems to help too, but i think we can not rely on
this.

any help would be appreciated

best regards

Tested with pg 9.1 / odbcDriver 9.00.0310 / Delphi7.0
-----------------------------------------------

PROCEDURE FetchAbsoluteTest;

    Var aRes:Integer;
        hStmtSelect,hstmtUpdate,fEnvHandle,fConnectHandle:SQLHandle;
        szName:ShortString;
        cbName:SQLInteger;
        aScroll,aSQLSmallInt:SQLSmallInt;
        aConnectString:String;
        aRow:Cardinal;
    Begin

     (*
     tabledefinition and data used in this case:

    drop table if exists customers;
    create table customers(nr integer, name varchar(100));
    insert into customers(nr, name) VALUES(1, 'Mayers');
    insert into customers(nr, name) VALUES(2, 'Miller');
    insert into customers(nr, name) VALUES(3, 'Smith');
     *)

     fEnvHandle := 0;
     fConnectHandle := 0;

     aRes := SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, fEnvHandle);
     aRes := SQLAllocHandle(SQL_HANDLE_DBC, fEnvHandle, fConnectHandle);

     aSqlSmallint := 0;
     aConnectString :=
'Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=postgres' +

';Uid=postgres;Pwd=mypwd;UpdatableCursors=1;usedeclarefetch=1;fetch=1';

     aRes := SQLDriverConnect(fConnectHandle,
                              GetDesktopWindow,
                              @aConnectString[1],
                              length(aConnectString),
                              nil,
                              0,
                              aSqlSmallint,
                              0);
       //switchin AUTOCOMMIT off
      aRes := SQLSetConnectAttr(fConnectHandle,
                                      SQL_ATTR_AUTOCOMMIT,
                                      pointer(SQL_AUTOCOMMIT_OFF),
                                      sizeof(SQL_AUTOCOMMIT_OFF));
       aRes:= SQLAllocHandle(SQL_HANDLE_STMT, fConnectHandle, hStmtSelect);

      //  Cursor : KeySetDriven + SQL_CONCUR_ROWVER(=updatable)
     aRes:= sqlSetStmtAttr(hStmtSelect,
                            SQL_ATTR_CONCURRENCY,
                                    pointer(SQL_CONCUR_ROWVER),
                                    sizeof(SQLSmallint));
     aRes:= sqlSetStmtAttr(hStmtSelect,
                            SQL_ATTR_CURSOR_TYPE,
                                    pointer(SQL_CURSOR_KEYSET_DRIVEN),
                                    sizeof(SQLSmallint));
      // Select ...
      aRes := SQLExecDirect(hstmtSelect,
              pchar('SELECT name FROM customers'),
              SQL_NTS);
      // fetch will read the column "name"
      aRes:= SQLBindCol(hstmtSelect, 1, SQL_C_CHAR, @szName[1], 50, cbName);

      //fetching absolute a nonexisting row
      aRes := SQLFetchScroll(hStmtSelect, SQL_FETCH_ABSOLUTE, 100);
      Assert(aRes = 100);
    END;

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Fetch-absolute-returns-OK-when-fetching-a-nonexistent-row-tp4971382p4971382.html
Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.

--

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc


Gmane