Run-time error 3146, ODBC-call failed, like to know more

Run-time error 3146, ODBC-call failed, like to know more

Post by Korhonen Jouk » Thu, 27 May 1999 04:00:00



I have a connection to database with requred rights (insert,
update,select,delete)

I'm trying to insert the same sentence that goes fine from any other
sql-environment with exacly same uid&pwd (plus33w for example)

-code->
Global variables:

Dim cnn As Connection
Dim wrkspace As Workspace
Dim datab As Database

    'Create ODBCDirect workspace
    Set wrkspace = DBEngine.CreateWorkspace("myWorkSpace", "reports",
"", dbUseODBC)
    'Open database connection
    Set cnn = wrkspace.OpenConnection("my_conn", dbDriverNoPrompt,
False,  "ODBC;DSN=x;UID=y;PWD=z;")

'so here it IS read/write
<clip>

cnn.Execute str, dbRunAsync 'or
cnn.Execute str, dbExecDirect '->3146 error

either of those Execute's won't go through, I noticed that in the
examples they have used database.execute (dbsNorthwind.Execute
strSQLRestore, dbFailOnError)

if I use the following

Set datab = cnn.Database

    datab.Execute str, dbExecDirect '-> 3001 error
    datab.Execute (str) '-> 3146 error
    datab.Execute str '->3146 error
datab.Execute (str,dbExecDirect) ' -> syntax error, = expected

in the other hand the select sentence is working through
    strQ="select * from tableA"
   * = ThisWorkbook.ExecQuery(strQ, recset)

I tried to found out the 3146 code , but didn't manage to find it from
any help file (it tried Jet error messages reference but didn't find it)

Any Ideas ??

BR
-Jouko

 
 
 

Run-time error 3146, ODBC-call failed, like to know more

Post by Korhonen Jouk » Thu, 27 May 1999 04:00:00


Quote:> I'm trying to insert the same sentence that goes fine from any other
> sql-environment with exacly same uid&pwd (plus33w for example)

quess what

I found the bug from here when checkin the ***ing sentence again
it was a syntax error in my sql-sentence after all, so forget the whole
thing

WERY embarrassed
-Jouko

 
 
 

Run-time error 3146, ODBC-call failed, like to know more

Post by Scott Michel » Thu, 27 May 1999 04:00:00


Try this to get more info about your errors:

Dim errWork As Error

For Each errWork in Errors
    With errWork
        MsgBox "Error: " & .Number & ", Description: " & .Description
    End With
Next

This will cycle through DAO's error collection and let you see all of the
error messages that were generated.

Scott




>I have a connection to database with requred rights (insert,
>update,select,delete)

>I'm trying to insert the same sentence that goes fine from any other
>sql-environment with exacly same uid&pwd (plus33w for example)

>-code->
>Global variables:

>Dim cnn As Connection
>Dim wrkspace As Workspace
>Dim datab As Database

>    'Create ODBCDirect workspace
>    Set wrkspace = DBEngine.CreateWorkspace("myWorkSpace", "reports",
>"", dbUseODBC)
>    'Open database connection
>    Set cnn = wrkspace.OpenConnection("my_conn", dbDriverNoPrompt,
>False,  "ODBC;DSN=x;UID=y;PWD=z;")

>'so here it IS read/write
><clip>

>cnn.Execute str, dbRunAsync 'or
>cnn.Execute str, dbExecDirect '->3146 error

>either of those Execute's won't go through, I noticed that in the
>examples they have used database.execute (dbsNorthwind.Execute
>strSQLRestore, dbFailOnError)

>if I use the following

>Set datab = cnn.Database

>    datab.Execute str, dbExecDirect '-> 3001 error
>    datab.Execute (str) '-> 3146 error
>    datab.Execute str '->3146 error
>datab.Execute (str,dbExecDirect) ' -> syntax error, = expected

>in the other hand the select sentence is working through
>    strQ="select * from tableA"
>   * = ThisWorkbook.ExecQuery(strQ, recset)

>I tried to found out the 3146 code , but didn't manage to find it from
>any help file (it tried Jet error messages reference but didn't find it)

>Any Ideas ??

>BR
>-Jouko

 
 
 

Run-time error 3146, ODBC-call failed, like to know more

Post by Korhonen Jouk » Sat, 29 May 1999 04:00:00



> Try this to get more info about your errors:

> Dim errWork As Error

> For Each errWork in Errors
>     With errWork
>         MsgBox "Error: " & .Number & ", Description: " & .Description
>     End With
> Next

> This will cycle through DAO's error collection and let you see all of the
> error messages that were generated.

thanks for your time, how ever that loop (in on error goto ErrorLoop) only
shows the same message information that is in the message box that appears
when the compiler reaches the line and breaks (when no error handling)

anyway I found the error in my code (actually writing error in sql) so the
topic is no longer relevant for me.
thanks anyway from a good idea of those error things

BR
-Jouko

 
 
 

1. Actual ODBC error codes rather than 3146 -- ODBC Call failed

Hello,

I'm using ODBC to query an Informix DB.

At any point if a get an error (wrong password, wrong DSN connect string,
wrong SQL statement..),
I get the same error code:

3146 -- ODBC Call failed.

Is there a way to get the right Informix status code/string ?

Note: I'm using ODBC; what about RDO/ADO/RDS...: is it faster ?

Thx
Sebastien

2. Problem Handling Huge number of recordsets

3. Error 3146: ODBC-call failed with ODBC-direct

4. DTS - Unexpected Behaviour - Please Help!

5. ODBC Call failed error 3146

6. ANN: CAD file data mining/extraction

7. LEFT JOIN - ODBC Call failed - Error 3146 - (#107)

8. total weeks in a year

9. Error 3146 ODBC call failed

10. Error 3146 - ODBC Call Failed

11. ODBC -- Call Failed Error 3146

12. error 3146, ODBC call failed

13. ODBC "3146 ODBC call failed"