RE: String Length Limitation for SQLConfigDataSource()



This is not a general ODBC problem. The problem related to specific ODBC
driver.
Also, i can't reproduce your problem with the Access driver shipped inside
MS Office 2007. For specific behavior of different version of MS Office, you
may try a more appropriate forum at:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.access.dataaccess.pages&cat=en_US_7b5272b3-ce05-44bc-9693-e58136c0fcb5&lang=en&cr=US

====================================================================
For this particular problem, i think that it is better to constrain your
path to 255 characters (indeed, you can't create a file whose path is more
than 255 characters from within the shell - or without writing a program).

If it is necessary to have more than 255 characters in your enviornment
(though not recommended), you may try several workarounds (not tested, just
wild guess):
- Prepend "\\?\" at the front of the file path as discussed in
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
- Create a local share, say:
* C:\<200 characters>\<200 characters>\<200 characters>\DB.mdb
* Create a share "abc" point to C:\<200 characters>\<200 characters>\<200
characters>
* Use the path "\\localhost\abc\DB.mdb" instead

Ming.
MDAC Team, Microsoft.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



"kjell@xxxxxxxxxxxxx" wrote:

Hi,

I'm trying to create a data source for a Microsoft Access data base
file using the SQLConfigDataSource() call in a MFC application.

BOOL SQLConfigDataSource(HWND hwndParent,UINT fRequest, LPCSTR
lpszDriver, LPCSTR lpszAttributes);

The problem I run in to is that if the path to the database file in
the lpszAttributes string is too long the data source will fail to
connect to the database file later when I call OpenEx(). The
limitation seems to be somewhere between 200 and 300 characters.

Is there a way around this problem? I would like to specify a longer
path to the database file.

Thanks for your help,
Kjell Uddeborg


PS
The attribute in the lpszAttributes string that I use to specify the
data base file is "DBQ=[Path to data base file]"

.


Loading