SQLite Multiple Read Only

I am doing some tests with native SQLite plugins and I can get column names but even if I set my Open mode as ready only, I can not get informations from DB if there is another application which currently use it.

Also LoadStatement.IsValid() always give “false” even if I successfully got informations.

void UDeviceInfosBPLibrary::SQLiteGetColumnNames(const FString DB_Path, const FString TableName, TArray<FString> &OutColumnNames, bool &IsSuccessful)
{
    FSQLiteDatabase* SQLiteDB = new FSQLiteDatabase();
    SQLiteDB->Open(*DB_Path, ESQLiteDatabaseOpenMode::ReadOnly);

    if (SQLiteDB->IsValid() == true)
    {
        const FString Query = TEXT("select * from ") + TableName;
        FSQLitePreparedStatement LoadStatement;
        LoadStatement.Reset();
        LoadStatement.Create(*SQLiteDB, *Query, ESQLitePreparedStatementFlags::None);
        
        IsSuccessful = LoadStatement.IsValid();
        OutColumnNames = LoadStatement.GetColumnNames();

        LoadStatement.ClearBindings();
        LoadStatement.Destroy();
        SQLiteDB->Close();
        delete SQLiteDB;
    }
}

Hey,

did you manage to find documentation about the SQLite plugin of UE? :slight_smile:
I’m trying to develop a C++ class responsible for communication with the SQLite file that I’ll be able to call from BP but I’m struggling to understand how to work with it :worried:

Thanks

you can use my repo.

I haven’t try it again since published on Github. So, I can’t say if multiple read is avaible or not.

1 Like

Try this SQLite Plugin:

I am using ODBC. I created a c++ plugin with SAP company’s ODBC Library.

Hello! I am test your FF- plugin, and my use case involves connecting to a database with a ReadOnly flag while concurrently accessing the same database with a Read-Write flag from a different application. I encounter the same error as you did in Unreal Engine 5.3. It appears that the connection opens with a Read-Write-Create flag irrespective of the parameters passed to the method. Did you find a solution?

Yes and no. It seems that problem is about Epic’s implementation. Because they wanted a cross platform system and for that reason they need to cut some features.

I won’t try to fix or re-write SQLite but I will start to make a new plugin with these third party libraries next month.

At September, I tried ODBC and it worked for some of our in-house projects but I had to put it aside because I need to focus on other projects (such as HTTP servers which are non-blocking, HTTPS supported and FRunnableThread based). But I need to return DB plugins.