You are not logged in.
aProps := TODBCConnectionProperties.Create('','Driver=PostgreSQL Unicode'+
{$ifdef CPU64}'(x64)'+{$endif}';Database=postgres;'+
'Server=localhost;Port=5433;UID=postgres;Pwd=postgresPassword','','');
change to
FDPhysMySQLDriverLink := TFDPhysMySQLDriverLink.Create(Nil);
aProps := TSQLDBFireDACConnectionProperties.Create('MySQL?Server='+_SERVERIP,_DBNAME,_DBUSRNAME,_DBPASSWD);
after run the error is :
---------------------------
ESQLite3Exception with message 'Error SQLITE_ERROR (1) [INSERT INTO Person (Name) VALUES (?);] using 3.11.1 - no such table: Person, extended_errcode=1'.
please help me
thank you.
Jongruk Aripoo
Offline
What is wrong?
begin
// set logging abilities
SQLite3Log.Family.Level := LOG_VERBOSE;
//SQLite3Log.Family.EchoToConsole := LOG_VERBOSE;
SQLite3Log.Family.PerThreadLog := ptIdentifiedInOnFile;
// ODBC driver e.g. from http://ftp.postgresql.org/pub/odbc/versions/msi
//aProps := TODBCConnectionProperties.Create('','Driver=PostgreSQL Unicode'+
// {$ifdef CPU64}'(x64)'+{$endif}';Database=postgres;'+
// 'Server=localhost;Port=5433;UID=postgres;Pwd=postgresPassword','','');
FDPhysMySQLDriverLink := TFDPhysMySQLDriverLink.Create(Nil);
aProps := TSQLDBFireDACConnectionProperties.Create('MySQL?Server='+_SERVERIP,_DBNAME,_DBUSRNAME,_DBPASSWD);
// aProps.ForcedSchemaName := 'sam';
try
// get the shared data model
aModel := DataModel;
VirtualTableExternalRegisterAll(aModel, aProps, false);
try
// create the main mORMot server
aRestServer := TSQLRestServerDB.Create(aModel,SQLITE_MEMORY_DATABASE_NAME,false); // authentication=false
try
// create tables or fields if missing
aRestServer.CreateMissingTables;
// serve aRestServer data over HTTP
aHttpServer := TSQLHttpServer.Create(SERVER_PORT,[aRestServer],'+',useHttpApiRegisteringURI);
try
aHttpServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
writeln('Background server is running.'#10);
write('Press [Enter] to close the server.');
readln;
finally
aHttpServer.Free;
end;
finally
aRestServer.Free;
end;
finally
aModel.Free;
end;
finally
aProps.Free;
end;
end.
Jongruk Aripoo
Offline
Please try to update your framework source to the latest version (including SQLite3 obj).
The aRestServer.CreateMissingTables seems to not have created the tables as expected.
Could be a connection problem.
Please check and validate your connection string used with TSQLDBFireDACConnectionProperties.
Offline