[SOLVED] Qt 4.7.3, ODBC driver, error when connecting to db
-
As long as your application is 64bit, all loaded libs must be 64bit too. As your application works as 32bit version, it's very likely that you do not have the 64bit drivers installed or in the right path. Fortunately I didn't have to deal with ODBC so far, so unfortunately for you I cannot be of big help here :-)
-
Yes, my all libs all are 64 bit (for case 2), but it seems that the ODBC driver comes with the Office (and it is 32 bits in my case ). It is possible to install "MS AccessDatabaseEngine X64", but then office is not working correctly any more. (according to the forum here (sorry in German) http://www.windows-7-forum.net/windows-7-software/15054-32-bit-64-bit-odbc-problem.html )
But anyway, thanks for pointing me to the right direction, now I know at least where to search :-)
-
The solution was really easy:
The connection string must be exactly this@
"DRIVER={Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)};DBQ=".
@Without those stupid "*.ndx, *.mdx" it doesn't work on x64 but works perfectly on x86.
(Database is *.dbf)
I "love" Microsoft :-)[EDIT: code formatting for the string, Volker]
-
"_db_path" is just a path to your DB directory, i.e. the location of your DBF files. Note, that you don't need to include a "DBF" filename here, only the path to the directory. The DBF can be accessed then like following:
"SELECT * FROM YOURFILENAME.DBF" -
No. "_db_path" is appended to the connection string (in the above example).
I mean that you should include only the folder name into the "_db_path".
The filename is used as a table name in the sql query. "SELECT ..." is the SQL query of course. -
Oh Ok. Sorry I'm new to Qt and SQL and. So I would replace _db_path with "C:\Users..." pointing to the folder the .dbf is in? Also can you tell me how to create the .dbf? The only examples I've seen use SQLlight and .dat files so I can't figure out how to make the .dbf or just access a database I made directly in SQL. Would I just add the disired filename here
@QString connect_str("DRIVER={Microsoft dBASE Driver (*.dbf)};DBQ=");@like this
@QString connect_str("DRIVER={Microsoft dBASE Driver (*.dbf)};DBQ=filename");@ -
[quote author="confused" date="1342446698"]So I would replace _db_path with "C:\Users..." pointing to the folder the .dbf is in? [/quote]
Yes
[quote author="confused" date="1342446698"]
Also can you tell me how to create the .dbf?
[/quote]You should execute a query "CREATE TABLE YOURFILE.DBF"