PostgreSQL ODBC连接SSPI身份验证失败

时间:2014-06-27 13:55:57

标签: postgresql vb6 odbc sspi

我最近对现有的应用程序进行了一些更改,我正在为公司维护以尝试改进某些功能。但是,我遇到了一个问题,我无法通过所有Google搜索找到任何有用的信息。这是平台:

VB7应用程序在Windows 7(64位)上运行,使用ADODB连接通过ODBC连接到PostgreSQL(v.9.1.1)服务器。

问题是,由于某种原因,我使用的SSPI身份验证方法似乎无法从PostgreSQL数据库中的序列中检索值。其他(VB.NET)应用程序使用SSPI身份验证连接到同一数据库服务器没有问题(使用Npgsql)。

这是VB6应用程序中用于ODBC连接的基本连接字符串:

DRIVER={PostgreSQL ANSI};Server=<SERVERNAMEHERE>;Port=<####>;Database=<DATABASENAMEHERE>;Uid=<USERNAMEHERE>

在尝试连接数据库后检查PostgreSQL服务器日志时,发现以下错误:

CDT FATAL:  SSPI authentication failed for user "<USERNAMEHERE>"
CDT LOG:  could not send data to client: No connection could be made because the target machine actively refused it.

我尝试通过PGAdmin III从另一台计算机(使用他们的凭据登录)连接到数据库,我可以连接就好了。我实际上从第二台机器(也是Windows 7 64位)尝试了相同的应用程序,它似乎没有给我任何连接错误。

当然,当我通过WinXP VM上的VB6 IDE(在我自己的凭据下)运行代码时,一切似乎都按预期工作。我验证了用户的Active Directory帐户是活动的和未锁定的,并且PostgreSQL数据库具有使用正确的组角色成员身份创建的正确用户等。所以,显然我的想法是为PostgreSQL安装的ODBC驱动程序一定有问题。我安装了64位PostgreSQL ODBC驱动程序,(当然)它没有帮助。我卸载并重新安装了32位驱动程序(因为它运行的是32位应用程序),但没有变化。

这是我用来尝试连接数据库的VB6代码:

Private Function GetPGCertNumber() As Long
    On Error GoTo PGSQLError

    Dim PGDB As ADODB.Connection
    Dim RS As ADODB.Recordset
    Dim CertNum As Long
    Dim SQLStr As String

    Set PGDB = New ADODB.Connection
    PGDB.ConnectionString = PGSQL_CONNECTION_STR
    PGDB.CursorLocation = adUseServer
    PGDB.Open

    SQLStr = "SELECT nextval('certificatenumber_seq')"
    Set RS = New ADODB.Recordset
    RS.CursorLocation = adUseServer
    RS.Open SQLStr, PGDB

    If Not RS.EOF And Not RS.BOF Then
        CertNum = RS!nextval
    Else
        CertNum = -1
    End If

    GetPGCertNumber = CertNum
    RS.Close
    Set RS = Nothing
    PGDB.Close
    Set PGDB = Nothing
    Exit Function
PGSQLError:
    Dim ErrorMsg As String

    GetPGCertNumber = -1
    ErrorMsg = "An error occurred retrieving the next certificate number to use." & vbCrLf & _
               "Connection String: " & PGSQL_CONNECTION_STR & vbCrLf & _
               "Command String: " & SQLStr & vbCrLf & _
               "Database State: " & PGDB.State & vbCrLf & vbCrLf
    MsgBox ErrorMsg, vbCritical + vbOKOnly, "POSTGRESQL DATABASE ERROR"

    On Error Resume Next

    If Not PGDB Is Nothing Then
        If PGDB.State <> 0 Then
            PGDB.Close
        End If

        Set PGDB = Nothing
    End If
End Function

我检查了PostgreSQL数据库中的序列,但序列没有增加。出现的错误消息表明尚未填充SQLStr变量,这告诉我在调用Open方法时它正在发生。

我暂时想出了一个“创可贴”解决方法:我在PostgreSQL服务器上创建了一个新的有限访问用户,该用户使用MD5登录(在pg_hba.conf中指定)而不是SSPI,并在我的连接字符串(PGSQL_CONNECTION_STR)中对其进行了硬编码。据我所知,到目前为止,这似乎工作正常,这使我进一步认为该问题与在此环境中将SSPI与PostgreSQL的ODBC连接器一起使用特别相关。

我基本上想知道是否有人可能知道使用PostgreSQL ODBC驱动程序通过SSPI验证与PostgreSQL数据库的连接的特定问题。我更倾向于不必将凭证硬编码到应用程序中,即使凭据是针对有限访问的用户。我已经尝试了我所知道的所有内容,虽然我可能没有在上面提到它,所以如果您需要任何澄清,请告诉我。在此先感谢您的帮助。

编辑:我还没有尝试过的唯一事情是安装64位ODBC驱动程序并更改我的连接字符串以使用它。我没有尝试过的原因是我们仍然有一些用户还没有升级到64位操作系统。或许,如果我能找到一种方法来确定用户是通过VB6在32位还是64位操作系统上,这可能是一个可行的选择(假设64位ODBC驱动程序实际上正常工作)。

编辑 - 调试日志详细信息(编辑):

[mylog_3380.log]

[3336-0.000]calling getDSNdefaults
[3336-0.015]CC_connect: entering...
[3336-0.015]sslmode=disable
[3336-0.015]original_CC_connect: entering...
[3336-0.015]Driver Version='09.03.0300,201405140001' linking 1600 dynamic Multithread library
[3336-0.031]original_CC_connect: DSN = '', server = '<SERVERNAMEHERE>', port = '####', database = '<DATABASENAMEHERE>', username = '<USERNAMEHERE>', password=''
[3336-0.031]connecting to the server socket...
[3336-0.047](0)(null) ERRNO=0
[3336-0.047]connection to the server socket succeeded.
[3336-0.047]!!! usrname=<USERNAMEHERE> server=<SERVERNAMEHERE>
[3336-0.047]sizeof startup packet = 80
[3336-0.047]sent the authentication block successfully.
[3336-0.047]gonna do authentication
[3336-0.047]read -1, global_socket_buffersize=4096
[3336-0.047]Lasterror=10035
[3336-0.062]read 9, global_socket_buffersize=4096
[3336-0.062]auth got 'R'
[3336-0.062]areq = 9 salt=0000000000
[3336-0.062]in AUTH_REQ_SSPI
[3336-47.767][[SQLAllocHandle]][3336-47.767]PGAPI_AllocConnect: entering...
[3336-47.767]**** PGAPI_AllocConnect: henv = 02B413B8, conn = 02B481C0
[3336-47.767]EN_add_connection: self = 02B413B8, conn = 02B481C0
[3336-47.767]       added at i=1, conn->henv = 02B413B8, conns[i]->henv = 02B413B8
[3336-47.767][SQLGetInfo(30)][3336-47.767]PGAPI_GetInfo: entering...fInfoType=77
[3336-47.767]PGAPI_GetInfo: p='03.50', len=0, value=0, cbMax=12
[3336-47.767][[SQLSetConnectAttr]] 103
[3336-47.767]PGAPI_SetConnectAttr for 02B481C0: 103 0000000F
[3336-47.767]PGAPI_SetConnectOption: entering fOption = 103 vParam = 15
[3336-47.767][SQLDriverConnect][3336-47.767]PGAPI_DriverConnect: entering...
[3336-47.767]**** PGAPI_DriverConnect: fDriverCompletion=0, connStrIn='DRIVER={PostgreSQL ANSI};UID=<USERNAMEHERE>;Server=<SERVERNAMEHERE>;Port=####;Database=<DATABASENAMEHERE>;debug=1;commlog=1;'
[3336-47.767]CC_conninfo_init opt=2
[3336-47.767]copy_globals driver=PostgreSQL ANSI socket_buffersize=4096
[3336-47.767]our_connect_string = 'DRIVER={PostgreSQL ANSI};UID=<USERNAMEHERE>;Server=<SERVERNAMEHERE>;Port=####;Database=<DATABASENAMEHERE>;debug=1;commlog=1;'
[3336-47.767]attribute = 'DRIVER', value = '{PostgreSQL ANSI}'
[3336-47.783]copyAttributes: DSN='',server='',dbase='',user='',passwd='',port='',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]attribute = 'UID', value = '<USERNAMEHERE>'
[3336-47.783]copyAttributes: DSN='',server='',dbase='',user='<USERNAMEHERE>',passwd='',port='',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]attribute = 'Server', value = '<SERVERNAMEHERE>'
[3336-47.783]copyAttributes: DSN='',server='<SERVERNAMEHERE>',dbase='',user='<USERNAMEHERE>',passwd='',port='',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]attribute = 'Port', value = '####'
[3336-47.783]copyAttributes: DSN='',server='<SERVERNAMEHERE>',dbase='',user='<USERNAMEHERE>',passwd='',port='####',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]attribute = 'Database', value = '<DATABASENAMEHERE>'
[3336-47.783]copyAttributes: DSN='',server='<SERVERNAMEHERE>',dbase='<DATABASENAMEHERE>',user='<USERNAMEHERE>',passwd='',port='####',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]attribute = 'debug', value = '1'
[3336-47.783]copyAttributes: DSN='',server='<SERVERNAMEHERE>',dbase='<DATABASENAMEHERE>',user='<USERNAMEHERE>',passwd='',port='####',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]attribute = 'commlog', value = '1'
[3336-47.783]copyAttributes: DSN='',server='<SERVERNAMEHERE>',dbase='<DATABASENAMEHERE>',user='<USERNAMEHERE>',passwd='',port='####',onlyread='',protocol='',conn_settings='(null)',disallow_premature=-1)
[3336-47.783]getDSNinfo: DSN= overwrite=0
[3336-47.799]our_connect_string = 'DRIVER={PostgreSQL ANSI};UID=<USERNAMEHERE>;Server=<SERVERNAMEHERE>;Port=####;Database=<DATABASENAMEHERE>;debug=1;commlog=1;'
[3336-47.799]attribute = 'DRIVER', value = '{PostgreSQL ANSI}'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=0;B3=0;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]attribute = 'UID', value = '<USERNAMEHERE>'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=0;B3=0;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]attribute = 'Server', value = '<SERVERNAMEHERE>'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=0;B3=0;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]attribute = 'Port', value = '####'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=0;B3=0;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]attribute = 'Database', value = '<DATABASENAMEHERE>'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=0;B3=0;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]attribute = 'debug', value = '1'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=1;B3=0;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]attribute = 'commlog', value = '1'
[3336-47.799]copyCommonAttributes: A7=100;A8=4096;A9=0;B0=255;B1=8190;B2=1;B3=1;B4=0;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_;[3336-47.799]calling getDSNdefaults
[3336-47.799]CC_connect: entering...
[3336-47.799]sslmode=disable
[3336-47.799]original_CC_connect: entering...
[3336-47.799]Driver Version='09.03.0300,201405140001' linking 1600 dynamic Multithread library
[3336-47.799]original_CC_connect: DSN = '', server = '<SERVERNAMEHERE>', port = '####', database = '<DATABASENAMEHERE>', username = '<USERNAMEHERE>', password=''
[3336-47.799]connecting to the server socket...
[3336-47.814](0)(null) ERRNO=0
[3336-47.814]connection to the server socket succeeded.
[3336-47.814]!!! usrname=<USERNAMEHERE> server=<SERVERNAMEHERE>
[3336-47.814]sizeof startup packet = 80
[3336-47.814]sent the authentication block successfully.
[3336-47.814]gonna do authentication
[3336-47.814]read -1, global_socket_buffersize=4096
[3336-47.814]Lasterror=10035
[3336-47.830]read 9, global_socket_buffersize=4096
[3336-47.830]auth got 'R'
[3336-47.830]areq = 9 salt=0000000000
[3336-47.830]in AUTH_REQ_SSPI

[psqlodbc_3380.log]

[0.015]Driver Version='09.03.0300,201405140001' linking 1600 dynamic Multithread library
[0.015]Global Options: fetch=100, socket=4096, unknown_sizes=0, max_varchar_size=255, max_longvarchar_size=8190
[0.015]                disable_optimizer=0, ksqo=1, unique_index=1, use_declarefetch=0
[0.015]                text_as_longvarchar=1, unknowns_as_longvarchar=0, bools_as_char=1 NAMEDATALEN=64
[0.031]                extra_systable_prefixes='dd_;', conn_settings='(null)' conn_encoding=''
[47.767]conn=02B481C0, PGAPI_DriverConnect( in)='DRIVER={PostgreSQL ANSI};UID=<USERNAMEHERE>;Server=<SERVERNAMEHERE>;Port=####;Database=<DATABASENAMEHERE>;debug=1;commlog=1;', fDriverCompletion=0
[47.799]Driver Version='09.03.0300,201405140001' linking 1600 dynamic Multithread library
[47.799]Global Options: fetch=100, socket=4096, unknown_sizes=0, max_varchar_size=255, max_longvarchar_size=8190
[47.799]                disable_optimizer=0, ksqo=1, unique_index=1, use_declarefetch=0
[47.799]                text_as_longvarchar=1, unknowns_as_longvarchar=0, bools_as_char=1 NAMEDATALEN=64
[47.799]                extra_systable_prefixes='dd_;', conn_settings='(null)' conn_encoding=''

编辑 - 服务器日志 以下是我测试时的日志条目。这与我之前发布的内容几乎相同,但我前进了几分钟以允许连接超时等。它来自我的VB6应用程序中的一个不同的函数,它正在调用存储过程,但它导致与SSPI身份验证相同的错误/问题。

2014-06-30 16:57:17 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 16:57:17 CDT LOG:  unexpected EOF on client connection
2014-06-30 16:57:30 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 16:57:30 CDT LOG:  unexpected EOF on client connection
2014-06-30 16:57:31 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 16:57:31 CDT LOG:  unexpected EOF on client connection
2014-06-30 16:58:38 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 16:58:38 CDT LOG:  unexpected EOF on client connection
2014-06-30 16:59:02 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 16:59:02 CDT LOG:  unexpected EOF on client connection
2014-06-30 16:59:22 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 16:59:22 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:00:23 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:00:23 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:00:44 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:00:44 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:00:46 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:00:46 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:00:52 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:00:52 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:01:17 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:01:17 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:01:43 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:01:43 CDT FATAL:  SSPI authentication failed for user "<USERNAMEHERE>"
2014-06-30 17:01:43 CDT LOG:  could not send data to client: No connection could be made because the target machine actively refused it.    
2014-06-30 17:01:43 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:01:43 CDT FATAL:  SSPI authentication failed for user "<USERNAMEHERE>"
2014-06-30 17:01:43 CDT LOG:  could not send data to client: No connection could be made because the target machine actively refused it.    
2014-06-30 17:03:56 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:03:56 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:04:02 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:04:02 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:04:10 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.
2014-06-30 17:04:10 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:05:30 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:05:30 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:05:39 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:05:39 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:06:33 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:06:33 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:11:05 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:11:05 CDT LOG:  unexpected EOF on client connection
2014-06-30 17:11:50 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.   
2014-06-30 17:11:50 CDT LOG:  unexpected EOF on client connection

我可以尝试打开额外的调试,但可能需要一点时间才能从中获取任何数据。当然可能(如前所述)该问题与PostgreSQL的版本有关,除了这些相同的函数在安装了相同ODBC连接器的32位WinXP测试环境中正常工作。

编辑 - log_min_messages = debug1:

2014-07-02 10:33:24 CDT DEBUG:  autovacuum: processing database "<DATABASENAMEHERE>"
2014-07-02 10:33:25 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.


2014-07-02 10:33:25 CDT FATAL:  SSPI authentication failed for user "<USERNAMEHERE>"
2014-07-02 10:33:25 CDT LOG:  could not send data to client: No connection could be made because the target machine actively refused it.


2014-07-02 10:33:29 CDT DEBUG:  autovacuum: processing database "<DATABASENAMEHERE>"

log_min_messages = debug5

2014-07-02 10:36:49 CDT DEBUG:  StartTransaction
2014-07-02 10:36:49 CDT DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2014-07-02 10:36:49 CDT DEBUG:  CommitTransaction
2014-07-02 10:36:49 CDT DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2014-07-02 10:36:49 CDT DEBUG:  InitPostgres
2014-07-02 10:36:49 CDT DEBUG:  my backend ID is 5
2014-07-02 10:36:49 CDT DEBUG:  StartTransaction
2014-07-02 10:36:49 CDT DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2014-07-02 10:36:49 CDT DEBUG:  CommitTransaction
2014-07-02 10:36:49 CDT DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2014-07-02 10:36:49 CDT DEBUG:  autovacuum: processing database "<DATABASENAMEHERE>"
2014-07-02 10:36:49 CDT DEBUG:  StartTransaction
2014-07-02 10:36:49 CDT DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2014-07-02 10:36:49 CDT DEBUG:  pg_statistic: vac: 80 (threshold 124), anl: 560 (threshold 87)
2014-07-02 10:36:49 CDT DEBUG:  pg_type: vac: 0 (threshold 112), anl: 0 (threshold 81)
2014-07-02 10:36:49 CDT DEBUG:  pg_attribute: vac: 0 (threshold 651), anl: 0 (threshold 351)
2014-07-02 10:36:49 CDT DEBUG:  pg_authid: vac: 19 (threshold 50), anl: 30 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_proc: vac: 0 (threshold 518), anl: 0 (threshold 284)
2014-07-02 10:36:49 CDT DEBUG:  pg_class: vac: 0 (threshold 106), anl: 0 (threshold 78)
2014-07-02 10:36:49 CDT DEBUG:  pg_database: vac: 3 (threshold 50), anl: 7 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_inherits: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_index: vac: 0 (threshold 72), anl: 0 (threshold 61)
2014-07-02 10:36:49 CDT DEBUG:  pg_operator: vac: 0 (threshold 191), anl: 0 (threshold 121)
2014-07-02 10:36:49 CDT DEBUG:  pg_opfamily: vac: 0 (threshold 64), anl: 0 (threshold 57)
2014-07-02 10:36:49 CDT DEBUG:  pg_opclass: vac: 0 (threshold 73), anl: 0 (threshold 61)
2014-07-02 10:36:49 CDT DEBUG:  pg_amop: vac: 0 (threshold 122), anl: 0 (threshold 86)
2014-07-02 10:36:49 CDT DEBUG:  pg_amproc: vac: 0 (threshold 100), anl: 0 (threshold 75)
2014-07-02 10:36:49 CDT DEBUG:  pg_language: vac: 0 (threshold 51), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_largeobject_metadata: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_rewrite: vac: 0 (threshold 70), anl: 0 (threshold 60)
2014-07-02 10:36:49 CDT DEBUG:  pg_description: vac: 0 (threshold 705), anl: 0 (threshold 378)
2014-07-02 10:36:49 CDT DEBUG:  pg_cast: vac: 0 (threshold 89), anl: 0 (threshold 70)
2014-07-02 10:36:49 CDT DEBUG:  pg_namespace: vac: 0 (threshold 51), anl: 0 (threshold 51)
2014-07-02 10:36:49 CDT DEBUG:  pg_conversion: vac: 0 (threshold 76), anl: 0 (threshold 63)
2014-07-02 10:36:49 CDT DEBUG:  pg_depend: vac: 0 (threshold 1219), anl: 0 (threshold 635)
2014-07-02 10:36:49 CDT DEBUG:  pg_tablespace: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_pltemplate: vac: 0 (threshold 52), anl: 0 (threshold 51)
2014-07-02 10:36:49 CDT DEBUG:  pg_auth_members: vac: 9 (threshold 75), anl: 37 (threshold 62)
2014-07-02 10:36:49 CDT DEBUG:  pg_shdepend: vac: 100 (threshold 943), anl: 394 (threshold 496)
2014-07-02 10:36:49 CDT DEBUG:  pg_shdescription: vac: 36 (threshold 50), anl: 42 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_ts_config: vac: 0 (threshold 53), anl: 0 (threshold 52)
2014-07-02 10:36:49 CDT DEBUG:  pg_ts_dict: vac: 0 (threshold 53), anl: 0 (threshold 52)
2014-07-02 10:36:49 CDT DEBUG:  pg_ts_parser: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_ts_template: vac: 0 (threshold 51), anl: 0 (threshold 51)
2014-07-02 10:36:49 CDT DEBUG:  pg_extension: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_foreign_data_wrapper: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_foreign_server: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_default_acl: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_seclabel: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_collation: vac: 0 (threshold 51), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_attrdef: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_am: vac: 0 (threshold 51), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  pg_db_role_setting: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 104), anl: 0 (threshold 77)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 96), anl: 0 (threshold 73)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 83), anl: 0 (threshold 67)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 104), anl: 0 (threshold 77)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 134), anl: 0 (threshold 92)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 82), anl: 0 (threshold 66)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 71), anl: 0 (threshold 61)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 80), anl: 0 (threshold 65)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 50), anl: 0 (threshold 50)
2014-07-02 10:36:49 CDT DEBUG:  <TABLENAMEHERE>: vac: 0 (threshold 826), anl: 0 (threshold 438)
2014-07-02 10:36:49 CDT DEBUG:  CommitTransaction
2014-07-02 10:36:49 CDT DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
2014-07-02 10:36:49 CDT DEBUG:  shmem_exit(0): 8 callbacks to make
2014-07-02 10:36:49 CDT DEBUG:  proc_exit(0): 2 callbacks to make
2014-07-02 10:36:49 CDT DEBUG:  exit(0)
2014-07-02 10:36:49 CDT DEBUG:  shmem_exit(-1): 0 callbacks to make
2014-07-02 10:36:49 CDT DEBUG:  proc_exit(-1): 0 callbacks to make
2014-07-02 10:36:49 CDT DEBUG:  reaping dead processes
2014-07-02 10:36:49 CDT DEBUG:  server process (PID 5692) exited with exit code 0
2014-07-02 10:36:51 CDT LOG:  could not receive data from client: No connection could be made because the target machine actively refused it.


2014-07-02 10:36:51 CDT FATAL:  SSPI authentication failed for user "<USERNAMEHERE>"
2014-07-02 10:36:51 CDT LOG:  could not send data to client: No connection could be made because the target machine actively refused it.


2014-07-02 10:36:51 CDT DEBUG:  shmem_exit(1): 7 callbacks to make
2014-07-02 10:36:51 CDT DEBUG:  proc_exit(1): 3 callbacks to make
2014-07-02 10:36:51 CDT DEBUG:  exit(1)
2014-07-02 10:36:51 CDT DEBUG:  shmem_exit(-1): 0 callbacks to make
2014-07-02 10:36:51 CDT DEBUG:  proc_exit(-1): 0 callbacks to make
2014-07-02 10:36:51 CDT DEBUG:  reaping dead processes
2014-07-02 10:36:51 CDT DEBUG:  server process (PID 4300) exited with exit code 1

1 个答案:

答案 0 :(得分:0)

您是否检查过登录“USERNAMEHERE”的案例?

在windows和pgsql上登录必须相同。

我们甚至有一个问题,Windows登录是'usera'而pgsql登录是'usera'但是通过odbc发送的登录是'Usera'。

似乎Windows将您用来登录的用户名作为用户名而不是AD中定义的用户名。

我们必须手动修复此连接字符串。

否则,您不需要进行硬编码登录,您可以在pg_hba.conf中使用映射。 (见http://www.postgresql.org/docs/9.4/static/auth-username-maps.html