You are not logged in.
Pages: 1
I'm trying to use mORMot with SQL Server 2005 Express.
My code is a lot like andrey's code in this old thread, except I haven't had any luck with OLE (I keep getting "class not registered").
With ODBC, I've gotten a bit further. If I create the database ORMPOCTest beforehand, I am able to connect with the connection properties below:
FProps := TODBCConnectionProperties.Create('', 'Driver={SQL Native Client};Server=.\SQLExpress;Database=ORMPOCTest;Trusted_Connection=yes;', '', '');
I follow this up with:
FModel := TSQLModel.Create([TMovie, TBook]);
VirtualTableExternalRegister(FModel, [TMovie, TBook], FProps);
FServerDB := TSQLRestServerDB.Create(FModel, ':memory:');
FServerDB.CreateMissingTables;
The tables are created. Everything looks good. Now...
NewBook := TBook.Create;
try
NewBook.Title := 'The Last Wish';
NewBook.Author := 'Andrzej Sapkowski';
NewBook.ISBN := '9780316029186';
NewID := FServerDB.Add(NewBook, True);
finally
NewBook.Free;
end;
I used this same code with straight-up SQLite3 and it worked. But here I get this error message:
TODBCStatement - TODBCLib error: [HY000] [Microsoft][ODBC Driver 13 for SQL Server]Connection is busy with results for another command (0)
Similarly, I have test code for retrieving, updating, and deleting records. With this connection, all of them fail with the above error.
Except for my RetrieveList code,
SearchResults := FServerDB.RetrieveList(TMovie, 'RunningTime > ? AND Released >= ?', [130, DateToSQL(2000, 5, 7)]);
This fails with a different error:
TODBCStatement - TODBCLib error: [HYC00] [Microsoft][ODBC Driver 13 for SQL Server]Optional feature not implemented (0)
I get the same results for all the drivers below:
SQL Native Client
SQL Server Native Client 11.0
ODBC Driver 13 for SQL Server
Any suggestions on what I could be doing wrong here?
P.S. I realize that Microsoft hasn't supported SQL Server 2005 since April 2016.
Offline
You're right, the problem is definitely my ODBC driver. Finding a 32-bit one for 2005 that works on 64-bit Windows 7 might prove difficult.
In the meantime, I got the OLE connection working. I was using the wrong connection properties class – it should have been TOleDBMSSQL2005ConnectionProperties. Works beautifully now!
Offline
Pages: 1