I've ported a powerbuilder application to postgresql. Tested ok on windows 10 64, was installed on two win10-64 other computers, all connecting the postgresql database in the localhost with access via odbc. The third of them presented the error detailed below in the logs (mylog and psqlodbc) integrally copy and paste.
- The application send the connect command and receive error "IM001"as a response.
- The ODBC interface test shows "connection successful".
- The log tell us that the connection to the database was effectively completed by the driver.
- All versions of the odbc driver and database are reported in the logs.
- The connection string and the used parameters etc are fully documented in the logs.
--
- I've tried many basic stuff like upgrade/downgrade versions of the driver and database without success.
- The powerbuilder version is an old 32 bit 6.5
Can anyone help me?
L O G S:
psqlodbc.log error message in red
============
[0.022]conn=005EF438, PGAPI_DriverConnect( in)='DRIVER={PostgreSQL Unicode};Server=localhost;Port=5432;Database=onbpdc;Username=dba;Password=sql;', fDriverCompletion=1
[0.047]Driver Version='09.05.0300,Jun 17 2016' linking 1800 dynamic Multithread library
[0.049]Global Options: fetch=100, unknown_sizes=0, max_varchar_size=255, max_longvarchar_size=8190
[0.051] unique_index=1, use_declarefetch=0
[0.052] text_as_longvarchar=1, unknowns_as_longvarchar=0, bools_as_char=1 NAMEDATALEN=64
[0.053] extra_systable_prefixes='dd_', conn_settings='(null)' conn_encoding=''
[0.157]conn=005EF438, query='SET DateStyle = 'ISO''
[0.172]conn=005EF438, query='SET extra_float_digits = 2'
[0.183]conn=005EF438, query='select oid, typbasetype from pg_type where typname = 'lo''
[0.193] [ Large Object oid = -999 ]
[0.194] [ Client encoding = 'UTF8' (code = 6) ]
[0.200]conn=005EF438, PGAPI_DriverConnect(out)='DRIVER={PostgreSQL Unicode};DATABASE=onbpdc;SERVER=localhost;PORT=5432;UID=dba;PWD=sql;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;UnknownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=8190;Debug=1;CommLog=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;ExtraSysTablePrefixes=dd_;LFConversion=1;UpdatableCursors=1;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrepare=1;LowerCaseIdentifier=0;GssAuthUseGSS=0;XaOpt=1'
[0.214]CONN ERROR: func=PGAPI_GetInfo, desc='', errnum=-2, errmsg='The buffer was too small for the InfoValue.'
[0.217] ------------------------------------------------------------
[0.217] henv=005E5770, conn=005EF438, status=1, num_stmts=16
[0.218] pqconn=005ECA80, stmts=005E6C70, lobj_type=-999
[0.231]conn=005EF438, query='show max_identifier_length'
[0.268]conn=005EF438, PGAPI_Disconnect
Mylog error message in red
=====
[21184-0.000]ci=00000000 globals.extra_systable_prefixes = 'dd_'
[21184-0.002]exe name=onibus plaformId=2
[21184-0.004][[SQLAllocHandle]][21184-0.005]**** in PGAPI_AllocEnv **
[21184-0.006]** exit PGAPI_AllocEnv: phenv = 005E5770 **
[21184-0.007][[SQLSetEnvAttr]] att=200,2
[21184-0.008][[SQLAllocHandle]][21184-0.009]PGAPI_AllocConnect: entering...
[21184-0.010]**** PGAPI_AllocConnect: henv = 005E5770, conn = 005EF438
[21184-0.012]EN_add_connection: self = 005E5770, conn = 005EF438
[21184-0.014] added at 0, conn->henv = 005E5770, conns[0]->henv = 005E5770
[21184-0.015][SQLGetInfoW][21184-0.016]PGAPI_GetInfo: entering...fInfoType=77
[21184-0.018]PGAPI_GetInfo: p='03.51', len=0, value=0, cbMax=12
[21184-0.019][SQLDriverConnectW][21184-0.019]PGAPI_DriverConnect: entering...
[21184-0.019]**** PGAPI_DriverConnect: fDriverCompletion=1, connStrIn='DRIVER={PostgreSQL Unicode};Server=localhost;Port=5432;Database=onbpdc;Username=dba;Password=sql;'
[21184-0.025]CC_conninfo_init opt=2
[21184-0.025]copy_globals driver=PostgreSQL Unicode
[21184-0.026]our_connect_string = 'DRIVER={PostgreSQL Unicode};Server=localhost;Port=5432;Database=onbpdc;Username=dba;Password=sql;'
[21184-0.027]attribute = 'DRIVER', value = '{PostgreSQL Unicode}'
[21184-0.028]copyAttributes: DSN='',server='',dbase='',user='',passwd='',port='',_onlyread_='',conn_settings='(null)')
[21184-0.029]attribute = 'Server', value = 'localhost'
[21184-0.029]copyAttributes: DSN='',server='localhost',dbase='',user='',passwd='',port='',_onlyread_='',conn_settings='(null)')
[21184-0.030]attribute = 'Port', value = '5432'
[21184-0.030]copyAttributes: DSN='',server='localhost',dbase='',user='',passwd='',port='5432',_onlyread_='',conn_settings='(null)')
[21184-0.031]attribute = 'Database', value = 'onbpdc'
[21184-0.032]copyAttributes: DSN='',server='localhost',dbase='onbpdc',user='',passwd='',port='5432',_onlyread_='',conn_settings='(null)')
[21184-0.033]attribute = 'Username', value = 'dba'
[21184-0.033]copyAttributes: DSN='',server='localhost',dbase='onbpdc',user='dba',passwd='',port='5432',_onlyread_='',conn_settings='(null)')
[21184-0.035]attribute = 'Password', value = 'sql'
[21184-0.035]copyAttributes: DSN='',server='localhost',dbase='onbpdc',user='dba',passwd='xxxxx',port='5432',_onlyread_='',conn_settings='(null)')
[21184-0.036]getDSNinfo: DSN= overwrite=0
[21184-0.036]our_connect_string = 'DRIVER={PostgreSQL Unicode};Server=localhost;Port=5432;Database=onbpdc;Username=dba;Password=sql;'
[21184-0.038]attribute = 'DRIVER', value = '{PostgreSQL Unicode}'
[21184-0.038]copyCommonAttributes: A7=100;A9=0;B0=255;B1=8190;B2=1;B3=1;B6=0;B7=1;B8=0;B9=1;C0=0;C2=dd_[21184-0.039]attribute = 'Server', value = 'localhost'
[21184-0.040]copyCommonAttributes: A7=100;A9=0;B0=255;B1=8190;B2=1;B3=1;B6=0;B7=1;B8=0;B9=1;C0=0;C2=dd_[21184-0.041]attribute = 'Port', value = '5432'
[21184-0.041]copyCommonAttributes: A7=100;A9=0;B0=255;B1=8190;B2=1;B3=1;B6=0;B7=1;B8=0;B9=1;C0=0;C2=dd_[21184-0.042]attribute = 'Database', value = 'onbpdc'
[21184-0.043]copyCommonAttributes: A7=100;A9=0;B0=255;B1=8190;B2=1;B3=1;B6=0;B7=1;B8=0;B9=1;C0=0;C2=dd_[21184-0.043]attribute = 'Username', value = 'dba'
[21184-0.044]copyCommonAttributes: A7=100;A9=0;B0=255;B1=8190;B2=1;B3=1;B6=0;B7=1;B8=0;B9=1;C0=0;C2=dd_[21184-0.045]attribute = 'Password', value = 'sql'
[21184-0.045]copyCommonAttributes: A7=100;A9=0;B0=255;B1=8190;B2=1;B3=1;B6=0;B7=1;B8=0;B9=1;C0=0;C2=dd_[21184-0.046]calling getDSNdefaults
[21184-0.046]CC_connect: entering...
[21184-0.046]sslmode=disable
[21184-0.047]LIBPQ_CC_connect: entering...
[21184-0.048]Driver Version='09.05.0300,Jun 17 2016' linking 1800 dynamic Multithread library
[21184-0.055]LIBPQ_CC_connect: DSN = '', server = 'localhost', port = '5432', database = 'onbpdc', username = 'dba', password='xxxxx'
[21184-0.056]connecting to the database using localhost as the server
[21184-0.147]libpq connection to the database established.
[21184-0.147]protocol=3
[21184-0.147]Server version=9.5.13
[21184-0.148]LIBPQ_connect: retuning 1
[21184-0.148]CC_send_settings: entering...
[21184-0.148]PGAPI_AllocStmt: entering...
[21184-0.149]**** PGAPI_AllocStmt: hdbc = 005EF438, stmt = 005FDC30
[21184-0.149]CC_add_statement: self=005EF438, stmt=005FDC30
[21184-0.150]PGAPI_ExecDirect: entering...0
[21184-0.150]SC_recycle_statement: self= 005FDC30
[21184-0.150]**** PGAPI_ExecDirect: hstmt=005FDC30, statement='SET DateStyle = 'ISO''
[21184-0.151]PGAPI_ExecDirect: calling PGAPI_Execute...
[21184-0.152]PGAPI_Execute: entering...0
[21184-0.152]PGAPI_Execute: clear errors...
[21184-0.152]PGAPI_NumParams: entering...
[21184-0.153]SC_scanQueryAndCountParams: entering...
[21184-0.153]prepareParameters was not called, prepare state:8
[21184-0.154]SC_recycle_statement: self= 005FDC30
[21184-0.154]Exec_with_parameters_resolved: copying statement params: trans_status=1, len=21, stmt='SET DateStyle = 'ISO''
[21184-0.155] stmt_with_params = 'SET DateStyle = 'ISO''
[21184-0.155]about to begin SC_execute
[21184-0.156] it's NOT a select statement: stmt=005FDC30
[21184-0.156]CC_send_query: conn=005EF438, query='SET DateStyle = 'ISO''
[21184-0.157]in QR_Constructor
[21184-0.158]exit QR_Constructor
[21184-0.158]send_query: ok - 'C' - SET
[21184-0.158]send_query: setting cmdbuffer = 'SET'
[21184-0.159]send_query: returning res = 005EC748
[21184-0.159]SC_set_Result(5fdc30, 5ec748)[21184-0.160]QResult: enter DESTRUCTOR
[21184-0.160]retval=0
[21184-0.160]PGAPI_ExecDirect: returned 0 from PGAPI_Execute
[21184-0.161]CC_send_settings: result 0, status 1 from 'SET DateStyle = 'ISO''
[21184-0.161]PGAPI_ExecDirect: entering...0
[21184-0.162]SC_recycle_statement: self= 005FDC30
[21184-0.162]SC_set_Result(5fdc30, 0)[21184-0.162]QResult: enter DESTRUCTOR
[21184-0.163]QResult: in QR_close_result
[21184-0.163]QResult: free memory in, fcount=0
[21184-0.163]QResult: free memory out
[21184-0.164]QResult: exit close_result
[21184-0.164]QResult: exit DESTRUCTOR
[21184-0.164]PDATA_free_params: ENTER, self=005FDDFC
[21184-0.165]**** PGAPI_ExecDirect: hstmt=005FDC30, statement='SET extra_float_digits = 2'
[21184-0.166]PGAPI_ExecDirect: calling PGAPI_Execute...
[21184-0.166]PGAPI_Execute: entering...0
[21184-0.167]PGAPI_Execute: clear errors...
[21184-0.167]PGAPI_NumParams: entering...
[21184-0.168]SC_scanQueryAndCountParams: entering...
[21184-0.168]prepareParameters was not called, prepare state:8
[21184-0.169]SC_recycle_statement: self= 005FDC30
[21184-0.169]PDATA_free_params: ENTER, self=005FDDFC
[21184-0.169]Exec_with_parameters_resolved: copying statement params: trans_status=1, len=26, stmt='SET extra_float_digits = 2'
[21184-0.170] stmt_with_params = 'SET extra_float_digits = 2'
[21184-0.171]about to begin SC_execute
[21184-0.171] it's NOT a select statement: stmt=005FDC30
[21184-0.172]CC_send_query: conn=005EF438, query='SET extra_float_digits = 2'
[21184-0.172]in QR_Constructor
[21184-0.173]exit QR_Constructor
[21184-0.173]send_query: ok - 'C' - SET
[21184-0.174]send_query: setting cmdbuffer = 'SET'
[21184-0.174]send_query: returning res = 005EC748
[21184-0.174]SC_set_Result(5fdc30, 5ec748)[21184-0.175]QResult: enter DESTRUCTOR
[21184-0.175]retval=0
[21184-0.175]PGAPI_ExecDirect: returned 0 from PGAPI_Execute
[21184-0.176]CC_send_settings: result 0, status 1 from 'SET extra_float_digits = 2'
[21184-0.177]PGAPI_FreeStmt: entering...hstmt=005FDC30, fOption=1
[21184-0.177]QResult: enter DESTRUCTOR
[21184-0.177]QResult: in QR_close_result
[21184-0.178]QResult: free memory in, fcount=0
[21184-0.178]QResult: free memory out
[21184-0.178]QResult: exit close_result
[21184-0.179]QResult: exit DESTRUCTOR
[21184-0.179]SC_init_Result(5fdc30)[21184-0.179]SC_Destructor: self=005FDC30, self->result=00000000, self->hdbc=005EF438
[21184-0.180]APD_free_params: ENTER, self=005FDD40
[21184-0.180]IPD_free_params: ENTER, self=005FDD80
[21184-0.181]PDATA_free_params: ENTER, self=005FDDFC
[21184-0.181]SC_Destructor: EXIT
[21184-0.182]CC_send_settings: entering...
[21184-0.182]CC_send_settings: entering...
[21184-0.182]CC_lookup_lo: entering...
[21184-0.183]CC_send_query: conn=005EF438, query='select oid, typbasetype from pg_type where typname = 'lo''
[21184-0.184]in QR_Constructor
[21184-0.185]exit QR_Constructor
[21184-0.186]num_fields = 2
[21184-0.187]in QR_set_num_fields
[21184-0.187]exit QR_set_num_fields
[21184-0.187]QR_from_PGResult: fieldname='oid', adtid=26, adtsize=4, atttypmod=-1 (rel,att)=(1247,-2)
[21184-0.188]QR_from_PGResult: fieldname='typbasetype', adtid=26, adtsize=4, atttypmod=-1 (rel,att)=(1247,24)
[21184-0.189]QResult: enter DESTRUCTOR
[21184-0.190]QResult: in QR_close_result
[21184-0.190]QResult: free memory in, fcount=0
[21184-0.191]QResult: free memory out
[21184-0.191]QResult: exit close_result
[21184-0.192]QResult: exit DESTRUCTOR
[21184-0.192]Got the large object oid: -999
[21184-0.193]CC_lookup_characterset: entering...
[21184-0.194]conn->unicode=1
[21184-0.195]CC_connect: returning...1
[21184-0.195]szConnStrOut = 'DRIVER={PostgreSQL Unicode};DATABASE=onbpdc;SERVER=localhost;PORT=5432;UID=dba;PWD=sql;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;UnknownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=8190;Debug=1;CommLog=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;ExtraSysTablePrefixes=dd_;LFConversion=1;UpdatableCursors=1;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrepare=1;LowerCaseIdentifier=0;GssAuthUseGSS=0;XaOpt=1' len=548,1536
[21184-0.205]PGAPI_DriverConnect: returning 0
[21184-0.205][SQLGetDiagRecW][21184-0.205]PGAPI_GetDiagRec entering type=2 rec=1
[21184-0.206]**** PGAPI_ConnectError: hdbc=005EF438 <0>
[21184-0.206]enter CC_get_error
[21184-0.207]exit CC_get_error
[21184-0.207]CC_Get_error returned nothing.
[21184-0.208]PGAPI_GetDiagRec exiting 100
[21184-0.208][SQLGetFunctions][21184-0.208]PGAPI_GetFunctions: entering...0
[21184-0.209][SQLGetInfoW][21184-0.209]PGAPI_GetInfo: entering...fInfoType=23
[21184-0.210]PGAPI_GetInfo: p='<NULL>', len=2, value=2, cbMax=2
[21184-0.210][SQLGetInfoW][21184-0.211]PGAPI_GetInfo: entering...fInfoType=24
[21184-0.211]PGAPI_GetInfo: p='<NULL>', len=2, value=2, cbMax=2
[21184-0.212][SQLGetInfoW][21184-0.212]PGAPI_GetInfo: entering...fInfoType=6
[21184-0.213]PGAPI_GetInfo: p='PSQLODBC35W.DLL', len=0, value=0, cbMax=6
[21184-0.214]CC_error_statements: self=005EF438
[21184-0.215]CONN ERROR: func=PGAPI_GetInfo, desc='', errnum=-2, errmsg='The buffer was too small for the InfoValue.'
[21184-0.218][SQLGetInfoW][21184-0.219]PGAPI_GetInfo: entering...fInfoType=2
[21184-0.219]PGAPI_GetInfo: p='', len=0, value=0, cbMax=512
[21184-0.220][SQLGetInfoW][21184-0.220]PGAPI_GetInfo: entering...fInfoType=17
[21184-0.220]PGAPI_GetInfo: p='PostgreSQL', len=0, value=0, cbMax=512
[21184-0.221][SQLGetInfoW][21184-0.221]PGAPI_GetInfo: entering...fInfoType=6
[21184-0.221]PGAPI_GetInfo: p='PSQLODBC35W.DLL', len=0, value=0, cbMax=490
[21184-0.222][SQLGetInfoW][21184-0.222]PGAPI_GetInfo: entering...fInfoType=16
[21184-0.225]PGAPI_GetInfo: p='onbpdc', len=0, value=0, cbMax=512
[21184-0.226][SQLGetInfoW][21184-0.226]PGAPI_GetInfo: entering...fInfoType=25
[21184-0.227]PGAPI_GetInfo: p='N', len=0, value=0, cbMax=512
[21184-0.227][SQLGetInfoW][21184-0.227]PGAPI_GetInfo: entering...fInfoType=13
[21184-0.228]PGAPI_GetInfo: p='localhost', len=0, value=0, cbMax=512
[21184-0.230][SQLGetInfoW][21184-0.230]PGAPI_GetInfo: entering...fInfoType=32
[21184-0.231]CC_send_query: conn=005EF438, query='show max_identifier_length'
[21184-0.232]in QR_Constructor
[21184-0.232]exit QR_Constructor
[21184-0.233]num_fields = 1
[21184-0.233]in QR_set_num_fields
[21184-0.233]exit QR_set_num_fields
[21184-0.234]QR_from_PGResult: fieldname='max_identifier_length', adtid=25, adtsize=-1, atttypmod=-1 (rel,att)=(0,0)
[21184-0.234]REALLOC: old_count = 0, size = 0
[21184-0.234]qresult: len=2, buffer='63'
[21184-0.235]QResult: enter DESTRUCTOR
[21184-0.235]QResult: in QR_close_result
[21184-0.235]QResult: free memory in, fcount=1
[21184-0.236]QResult: free memory out
[21184-0.236]QResult: exit close_result
[21184-0.236]QResult: exit DESTRUCTOR
[21184-0.237]max_identifier_length=63
[21184-0.237]PGAPI_GetInfo: p='<NULL>', len=2, value=63, cbMax=2
[21184-0.237][SQLGetInfoW][21184-0.238]PGAPI_GetInfo: entering...fInfoType=35
[21184-0.238]max_identifier_length=63
[21184-0.238]PGAPI_GetInfo: p='<NULL>', len=2, value=63, cbMax=2
[21184-0.241][SQLGetInfoW][21184-0.241]PGAPI_GetInfo: entering...fInfoType=93
[21184-0.242]PGAPI_GetInfo: p='<NULL>', len=2, value=3, cbMax=2
[21184-0.242][SQLGetInfoW][21184-0.242]PGAPI_GetInfo: entering...fInfoType=9
[21184-0.243]PGAPI_GetInfo: p='<NULL>', len=2, value=1, cbMax=2
[21184-0.243][SQLGetInfoW][21184-0.244]PGAPI_GetInfo: entering...fInfoType=15
[21184-0.244]PGAPI_GetInfo: p='<NULL>', len=2, value=1, cbMax=2
[21184-0.245][SQLGetInfoW][21184-0.245]PGAPI_GetInfo: entering...fInfoType=46
[21184-0.245]PGAPI_GetInfo: p='<NULL>', len=2, value=2, cbMax=2
[21184-0.246][SQLGetInfoW][21184-0.246]PGAPI_GetInfo: entering...fInfoType=8
[21184-0.246]PGAPI_GetInfo: p='<NULL>', len=4, value=191, cbMax=4
[21184-0.247][SQLGetInfoW][21184-0.247]PGAPI_GetInfo: entering...fInfoType=43
[21184-0.247]PGAPI_GetInfo: p='<NULL>', len=4, value=5, cbMax=4
[21184-0.248][SQLGetInfoW][21184-0.248]PGAPI_GetInfo: entering...fInfoType=44
[21184-0.249]PGAPI_GetInfo: p='<NULL>', len=4, value=19, cbMax=4
[21184-0.250][SQLGetInfoW][21184-0.250]PGAPI_GetInfo: entering...fInfoType=14
[21184-0.250]PGAPI_GetInfo: p='\', len=0, value=0, cbMax=512
[21184-0.262][SQLGetInfoW][21184-0.262]PGAPI_GetInfo: entering...fInfoType=94
[21184-0.263]PGAPI_GetInfo: p='_', len=0, value=0, cbMax=512
[21184-0.267][SQLDisconnect for 005EF438][21184-0.268]PGAPI_Disconnect: entering...
[21184-0.268]PGAPI_Disconnect: about to CC_cleanup
[21184-0.269]in CC_Cleanup, self=005EF438
[21184-0.269]after PQfinish
[21184-0.270]CC_conninfo_init opt=1
[21184-0.270]exit CC_Cleanup
[21184-0.270]PGAPI_Disconnect: done CC_cleanup
[21184-0.271]PGAPI_Disconnect: returning...
[21184-0.271][[SQLFreeHandle]][21184-0.271]PGAPI_FreeConnect: entering...
[21184-0.272]**** in PGAPI_FreeConnect: hdbc=005EF438
[21184-0.272]enter CC_Destructor, self=005EF438
[21184-0.272]in CC_Cleanup, self=005EF438
[21184-0.273]after PQfinish
[21184-0.273]CC_conninfo_init opt=1
[21184-0.273]exit CC_Cleanup
[21184-0.274]after CC_Cleanup
[21184-0.274]after free statement holders
[21184-0.274]exit CC_Destructor
[21184-0.275]PGAPI_FreeConnect: returning...
[21184-0.275][[SQLFreeHandle]][21184-0.275]**** in PGAPI_FreeEnv: env = 005E5770 **
[21184-0.276]in EN_Destructor, self=005E5770
[21184-0.276]clearing conns count=128
[21184-0.276]exit EN_Destructor: rv = 1
[21184-0.277] ok
[21184-0.277]DETACHING PROCESS
Edgard Battisti Guimarães