Bug #12019 Unable to create DSN Files

Submitted: 18 Jul 2005 19:42 Modified: 14 Feb 2006 2:42
Reporter: Stuart Paulsen Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.5(11) OS:Windows (XP)
Assigned to: Sergey Vlasenko CPU Architecture:Any

[18 Jul 2005 19:42] Stuart Paulsen
Description:
When creating a file DSN using the My SQL ODBC driver I get an error message, 
"A connection could not be made using the file data source parameters entered.  -- Save nonverified file DSN?"

If I choose to sve the file, I can not open it later and I get an error message.  
"Invalid file dsn"

I am able to create System and User DSN connections.

How to repeat:
Open the Windows ODBC Administrative tool.  click on the file tab and then click add.  Follow the steps and the error appears after pressing finish.

Suggested fix:
This used to work in older version fo 3.5  I think I had been running version 9 but when we upgraded the server, I had to upgrade the client.
[19 Jul 2005 6:50] Vasily Kishkin
Tested on Win 2003
[25 Oct 2005 17:44] Peter Harvey
c/odbc support for file based DSN's is being reworked into our cross-platform layer and will be available in a future release.
[22 Dec 2005 11:48] Sergey Vlasenko
Index: myodbc3/connect.c
===================================================================
--- myodbc3/connect.c	(revision 29)
+++ myodbc3/connect.c	(working copy)
@@ -602,15 +602,23 @@
         if ( !pFunc( hdbc, hwnd, pDataSource ) )
         {
             set_dbc_error( hdbc, "HY000", "User cancelled.", 0 );
-            nReturn = SQL_ERROR;
+            nReturn = pDataSource->bSaveFileDSN ? SQL_NO_DATA : SQL_ERROR;
             goto exitDriverConnect0;
         }
     }
 
     if ( my_SQLDriverConnectTry( dbc, pDataSource ) != SQL_SUCCESS )
     {
-        nReturn = SQL_ERROR;
-        goto exitDriverConnect0;
+        if (!pDataSource->bSaveFileDSN)
+        {
+          nReturn = SQL_ERROR;
+          goto exitDriverConnect0;
+        }
+        else
+        {
+          set_dbc_error( hdbc, "08001", "Client unable to establish connection.", 0 );
+          nReturn = SQL_SUCCESS_WITH_INFO;
+        }
     }
 
 exitDriverConnect1:
Index: myodbc3u/MYODBCUtil.h
===================================================================
--- myodbc3u/MYODBCUtil.h	(revision 29)
+++ myodbc3u/MYODBCUtil.h	(working copy)
@@ -184,6 +184,8 @@
     MYODBCUTIL_DATASOURCE_MODE      nMode;      /* ConfigDSN mode or SQLDriverConnect mode.                                     */
     MYODBCUTIL_DATASOURCE_CONNECT   nConnect;   /* SQLDriverConnect() using a DSN or a DRIVER to connect.                       */
     MYODBCUTIL_DATASOURCE_PROMPT    nPrompt;    /* SQLDriverConnect() kind of prompting (if any).                               */
+    
+    BOOL  bSaveFileDSN;         /* Flag specifying that SQLConnect was invoked as part of creation of a file DSN                */
 
 } MYODBCUTIL_DATASOURCE;
 
Index: myodbc3u/MYODBCUtilReadConnectStr.c
===================================================================
--- myodbc3u/MYODBCUtilReadConnectStr.c	(revision 29)
+++ myodbc3u/MYODBCUtilReadConnectStr.c	(working copy)
@@ -173,6 +173,10 @@
                             if ( !pDataSource->pszUSER )
                                 pDataSource->pszUSER = (char *)strndup( pAnchorChar, pScanChar - pAnchorChar );
                         }
+                        else if ( strcasecmp( pszName, "SAVEFILE" ) == 0 )
+                        {
+                          pDataSource->bSaveFileDSN = TRUE;
+                        }
                         else
                         {
                             /* What the ? */
[13 Feb 2006 15:05] Sergey Vlasenko
Fix is available in 3.51.12
[14 Feb 2006 2:42] Paul DuBois
Noted in MyODBC 3.51.12 changelog.

        <para>
          File DSNs could not be saved. (Bug #12019)
        </para>
[20 Jul 2006 15:32] Alex Mauer
This still doesn't work for me in 3.51.12 under Windows XP (or 2000)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.