Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2003/4/3/avoiding-db_sec_e_auth_failed-exception-on-connection-string.html
Published Thursday, April 03, 2003 1:18 PM by RoyOsherove

Comments

Thursday, April 03, 2003 3:43 AM by Kirk Allen Evans

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

You could have used \" to escape the quotes, had the "@" not preceded the string:

"Password=\"\""

However, this would not work with "@" in the beginning of the string, because "@" signifies that escape sequences are not processed. This is why the "\" characters in your string did not cause odd errors for unrecognized escape sequences. If you intend on using "@" with a string that contains double-quotes, you have to double-up the quotation marks:

@"Data Source=C:\Documents and Settings\royo\My Documents\WOZ.mdb;Password=""""";

Note that this is also explained in the C# Programmer's Reference:

ms-help://MS.VSCC/MS.MSDNQTR.2002APR.1033/csref/html/vclrfString.htm
Wednesday, July 23, 2003 12:02 AM by Bart B

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

I got the DB_SEC ... error as well. And the double quotes solved it indeed. Thanks a lot !
Saturday, November 01, 2003 8:32 AM by Floris den Heijer

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

I still keep the error even when I did all above. What else can cause this error?
Saturday, November 01, 2003 9:01 AM by Roy Osherove

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

Floris: go to ConnectionStrings.com and try to put in a simpler connectin string form.
Other than that I can't help you. But probably you're just missing a little simple char somewhere..
Tuesday, January 06, 2004 1:22 AM by Salman Yousuf

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

This has resolved my problem

thankx
Thursday, January 22, 2004 4:57 AM by Picard

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

DB_SEC_E_AUTH_FAILED
---------------------
i am writing in VB.NET

had a Global Variable :
Private sDBLieferanten As String = Server.MapPath("..\~db\" & sDbName)

in my Function i had the same Variable init :
Dim strSQL, strLieferant As String

but i didnt give it a value
that was my Problem
hopes that helps someone

"make it so"
Thursday, January 22, 2004 5:05 AM by Picard

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

sorry that above was the corrected code in my function
#
Dim strSQL, strLieferant As String
#

the code looked like that before:
#
Dim sDBLieferanten, strSQL, strLieferant As String
#
Monday, March 08, 2004 8:10 AM by amir

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

i have something as simple as >>
Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/ain.mdb;User Id=admin;Password=;"

but am still getting the DB_SEC_E_AUTH_FAILED exception
what can be wrong?
Friday, August 06, 2004 7:09 AM by Gordon Moore

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

I know this is stupid, but now I've learnt how to create a "component" I used it to create a read default database file routine.

I put this after the connection string and guess what....

So not having a database name can cause this problem as well! doh! :)
Friday, August 06, 2004 7:29 AM by Gordon Moore

# re: Avoiding DB_SEC_E_AUTH_FAILED exception on connection string

Ah this didn't quite work as hoped, still got the error.

Pinned it down to having put User Id="""" as well, removed this and no problem.

(Its got something to do with IDBInitialize::Initialize

"Authentification of the consumer to the data source absent or enumerator failed. The data source object or enumerator remains in the uninitialized state" (MSDN somewhere) )


:)