Re: Can't input username into sspi odbcconnection

From: Lindsay Stevens <lindsay(dot)stevens(dot)au(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Can't input username into sspi odbcconnection
Date: 2016-11-23 23:21:46
Message-ID: CAG2CW_JBYkt4DYjVTwUrnua6q7u5zvRY62u-C_jFsJ+Z_xZvCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Pretty sure SSPI gets done by libpq so instead you could try using PGUSER
set as a process level (or higher) environment variable.

In my regular use of SSPI the Uid param is never specified anywhere - not
even envars as PGUSER - it just knows..!

On 24 Nov 2016 9:40 am, "Branden Huggins" <branden.huggins@
rockwellcollins.com> wrote:

> Anytime I input any username into the connection string for an Odbc
> connectionstring when using SSPI, I get and AccessViolationException.
> Is there a way to generate the extra @NETWORK without inputting a username?
> or
> Can I change something to make the uid string take an input without
> throwing an acception?
>
> pg_hba.conf:
>
> host all all 127.0.0.1/32 sspi include_realm=1
> host all all ::1/128 sspi include_realm=1
>
> Connection String:
>
> "Driver={PostgreSQL Unicode};Trusted_Connection=yes;uid=bwhuggin(at)CCANET;
> database=hostdb-4.2.0;server=localhost;port=5432;"
>
> Simple Code:
>
> try
> {
> using (OdbcConnection connection = new OdbcConnection(odbc_
> connection_string))
> {
> connection.Open();
> }
> }
> catch (Exception ex)
> {
> System.Diagnostics.Trace.WriteLine("Connection problem: " +
> ex);
> odbc = false;
> }
>
> Result:
>
> Connection problem: System.AccessViolationException: Attempted to read or
> write protected memory. This is often an indication that other memory is
> corrupt.
> at System.Data.Common.UnsafeNativeMethods.SQLDriverConnectW(OdbcConnectionHandle
> hdbc, IntPtr hwnd, String connectionstring, Int16 cbConnectionstring,
> IntPtr connectionstringout, Int16 cbConnectionstringoutMax, Int16&
> cbConnectionstringout, Int16 fDriverCompletion)
> at System.Data.Odbc.OdbcConnectionHandle.Connect(String
> connectionString)
> at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection
> connection, OdbcConnectionString constr, OdbcEnvironmentHandle
> environmentHandle)
> at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection
> outerConnection, OdbcConnectionString connectionOptions)
> at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions
> options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
> DbConnectionPool pool, DbConnection owningObject)
> at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions
> options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
> DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions
> userOptions)
> at System.Data.ProviderBase.DbConnectionFactory.
> CreateNonPooledConnection(DbConnection owningConnection,
> DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
> owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions
> userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&
> connection)
> at System.Data.ProviderBase.DbConnectionInternal.
> TryOpenConnectionInternal(DbConnection outerConnection,
> DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry,
> DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection
> outerConnection, DbConnectionFactory connectionFactory,
> TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
> at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection
> outerConnection, DbConnectionFactory connectionFactory)
> at System.Data.Odbc.OdbcConnection.Open()
> at ConsoleApplication1.Program.TestMethod(String connectionMethod) in
> 2012\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 86
>

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Mallela, Anil 2016-11-29 11:26:02 Regarding postgres client on windows
Previous Message Inoue, Hiroshi 2016-11-23 23:14:58 Re: error conection Provider=MSDASQL