#1 2016-04-30 10:17:30

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Error SQLITE_ERROR when change PostgreSQL to Mysql in Sample 28

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

#2 2016-05-01 02:34:36

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Re: Error SQLITE_ERROR when change PostgreSQL to Mysql in Sample 28

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

#3 2016-05-01 04:17:57

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Re: Error SQLITE_ERROR when change PostgreSQL to Mysql in Sample 28

When change from FireDAC to ZEOS  every think work fine.
What difference?


Jongruk Aripoo

Offline

#4 2016-05-01 08:36:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Error SQLITE_ERROR when change PostgreSQL to Mysql in Sample 28

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

Board footer

Powered by FluxBB