[Qt-interest] MSSQL Mac query
Wolfgang Kriener
wkriener at fms-computer.de
Wed Jul 22 17:56:37 CEST 2009
Am 22.07.2009 um 17:46 schrieb Diego Schulz:
> On Wed, Jul 22, 2009 at 9:58 AM, Wolfgang
> Kriener<wkriener at fms-computer.de> wrote:
>> Hi,
>>
>> is anybody successful in connecting and retrieving data from a MS SQL
>> Server using a Mac with OS X?
>> On my Mac i use the Actual ODBC driver, which works using Excel or
>> RealBasic...
>>
>> i built plugin-sql-odbc as described in the Documentation except i
>> used iodbc
>> qmake "INCLUDEPATH+=/Developer/SDKs/MacOSX10.5.sdk/usr/include" "LIBS
>> +=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -liodbc"
>> make - compiles with no error
>>
>> For testing i made a small workaround:
>>
>> QSqlDatabase db;
>> db = QSqlDatabase::addDatabase("QODBC");
>> QString s = "DRIVER={Actual SQL
>> Server};SERVER=myServerIP;UID=myUser;PWD=myPass;DATABASE=myDB";
>> // the same connect String i use to connect RealBasic and works
>> db.setDatabaseName( s );
>> db.setConnectOptions("SQL_ATTR_ODBC_VERSION=SQL_OV_ODBC3");
>> if (db.open())
>> {
>> QSqlQuery query;
>> query.exec("SELECT * FROM TestTable");
>> while (query.next()) {
>> QString f1 = query.value(0).toString();
>> QString f2 = query.value(1).toString();
>> QString f3 = query.value(2).toString();
>> }
>> }
>>
>> db.open() reports no error as long as the database name (s) ist set
>> up
>> correct.
>> query.exec() ends with no result.
>>
>> also a second workaround using QSqlTableModel and model->select()
>> the
>> model stays empty.
>>
>> any ideas?
>
> Hi,
>
> Have you tried
>
> QSqlQuery query(db);
>
> instead of
>
> QSqlQuery query;
>
>
> ??
Yes i did, no change in result
wolfgang
>
>
>>
>> Wolfgang
>
>
> Regards,
>
> diego
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list