Hi Jorge,
Config.AppDir points to Application Data
Folder: /data/user/0/com.companyname.TS/files/.config/
Config.FirebirdServerLib points
to /data/user/0/com.companyname.TS/files/.config/firebird/lib/libfbclient.so
FIREBIRD_LOCK points to
/data/user/0/com.companyname.TS/files/.config/firebird/
Config.FirebirdFile points
to /data/user/0/com.companyname.TS/files/.config/TSDB.FDB
and its not working, invalid database handle
On Wed, Apr 25, 2018 at 3:07 PM, Jorge Gonçalves <projo...@gmail.com> wrote:
> Hi,
> I don't have the code with me right now...
>
> have you tried to put your files in AppDir/files ?
>
> and don't create the database on AppDir, I'm not sure that you have
> permissions to write on that folder, create the database on AppData/files
>
>
>
> Regards
> jGoncalves
>
>
>
> On Wed, Apr 25, 2018 at 2:31 AM, Luiz Alberto Tessarolli <
> tessaro...@gmail.com> wrote:
>
>> Hi Jorge, first of all, Thanks for the answer!!
>>
>> By following your steps, i have made some progress into creating a
>> firebird database on an embedded server in android, but, unfortunately, i'm
>> getting another error when i'm trying to create a new database: invalid
>> database handle (no active connection)
>>
>> Let me add a little detail here:
>> I have added the files you listed (except firebird.msg, because it was
>> missing from the download), to the Assets folders, on Android Project.
>> I have configured, for each file, the property BuildAction to AndroidAsset
>>
>> During runtime, i'm checking and creating the directories:
>> public static string AppDir { get => System.Environment.GetFolderPa
>> th(System.Environment.SpecialFolder.ApplicationData).Replace(".config",
>> ""); }
>> public static string FirebirdFile { get => Path.Combine(Config.AppDir,
>> "TSDB.FDB"); }
>> public static string FirebirdServerLib { get; set; }
>>
>> Setting Directories and Enviroment Variables:
>> Environment.SetEnvironmentVariable("FIREBIRD_LOCK",
>> Path.Combine(Config.AppDir, "firebird"));
>> Config.FirebirdServerLib = Path.Combine(Config.AppDir,
>> "firebird/lib/libfbclient.so");
>>
>> string fbFolder = Path.Combine(Config.AppDir, "firebird");
>> if (!Directory.Exists(fbFolder)) Directory.CreateDirectory(fbFolder);
>> if (!Directory.Exists(Path.Combine(fbFolder, "plugins")))
>> Directory.CreateDirectory(Path.Combine(fbFolder, "plugins"));
>> if (!Directory.Exists(Path.Combine(fbFolder, "lib")))
>> Directory.CreateDirectory(Path.Combine(fbFolder, "lib"));
>> if (!Directory.Exists(Path.Combine(fbFolder, "intl")))
>> Directory.CreateDirectory(Path.Combine(fbFolder, "intl"));
>>
>> Here, i'm copying the files from Assets, to those folders:
>> protected void preparaFirebirdEmbedded()
>> {
>>
>> string fbFolder = Path.Combine(Config.AppDir, "firebird");
>> if (!File.Exists(Path.Combine(fbFolder,
>> "plugins/libEngine12.so"))) CopiarArquivoDoAssets("libEngine12.so",
>> Path.Combine(fbFolder, "plugins"));
>> if (!File.Exists(Path.Combine(fbFolder,
>> "lib/libfbclient.so"))) CopiarArquivoDoAssets("libfbclient.so",
>> Path.Combine(fbFolder, "lib"));
>> if (!File.Exists(Path.Combine(fbFolder,
>> "lib/libfbclient.so.2"))) CopiarArquivoDoAssets("libfbclient.so.2",
>> Path.Combine(fbFolder, "lib"));
>> if (!File.Exists(Path.Combine(fbFolder,
>> "lib/libfbclient.so.3.0.3"))) CopiarArquivoDoAssets("libfbclient.so.3.0.3",
>> Path.Combine(fbFolder, "lib"));
>> if (!File.Exists(Path.Combine(fbFolder,
>> "intl/libfbintl.so"))) CopiarArquivoDoAssets("libfbintl.so",
>> Path.Combine(fbFolder, "intl"));
>> if (!File.Exists(Path.Combine(fbFolder,
>> "intl/fbintl.conf"))) CopiarArquivoDoAssets("fbintl.conf",
>> Path.Combine(fbFolder, "intl"));
>> if (!File.Exists(Path.Combine(fbFolder, "firebird.conf")))
>> CopiarArquivoDoAssets("firebird.conf", fbFolder);
>>
>> }
>>
>> protected void CopiarArquivoDoAssets(string AssetName, string
>> DestinationFolder)
>> {
>> try
>> {
>> using (var asset = Assets.Open(AssetName))
>> {
>> using (var dest =
>> File.Create(Path.Combine(DestinationFolder,
>> AssetName)))
>> asset.CopyTo(dest);
>> }
>> }
>> catch (Exception)
>> {
>> }
>>
>> }
>>
>>
>> and Here i'm trying to create the database
>>
>> public static void CriarDatabase()
>> {
>> try
>> {
>> if (!File.Exists(Config.FirebirdFile))
>> FbConnection.CreateDatabase($"
>> User=SYSDBA;Password=masterkey;Database={Config.FirebirdFile
>> };Charset=UTF8;ClientLibrary={Config.FirebirdServerLib};ServerType=1;",
>> 16384);
>> }
>> catch (Exception ex)
>> {
>> throw ex;
>> }
>> }
>>
>> Thats where i'm getting the exception invalid databse handle...
>>
>> Did you encounter that problem also?
>>
>> On Mon, Apr 23, 2018 at 5:45 PM, Jorge Gonçalves <projo...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> from my attempt to put FB running on Android ....
>>>
>>>
>>> The process is a little tricky.
>>>
>>> 1º
>>> You must put the files( libfbclient, libEngine12, .. ) on asset folder
>>> and then copy that to app/files folder.
>>> The folder structure must be kept in order to work.
>>>
>>> ex :
>>> .../app.com/files/fb/firebird.conf
>>> .../app.com/files/fb/firebird.msg
>>> .../app.com/files/fb/lib/libfbclient.so
>>> .../app.com/files/fb/plugins/libEngine12.so
>>> .../app.com/files/fb/intl/intl.conf
>>> .../app.com/files/fb/intl/libfbintl.so
>>>
>>> I don't know if all files are necessary.
>>> The process of putting native libraries on the lib folder will not work
>>> because the embedded version must have the above structure.
>>>
>>>
>>> 2º
>>> Load the libfbclient.so using the full path.
>>>
>>>
>>> 3º
>>> FB tries to create the lock file on /data/local/tmp. In versions higher
>>> than 5 this folder isn't writable.
>>> You may set env variable FIREBIRD_LOCK to app/cache.
>>>
>>>
>>> After that you should have the embedded version running.
>>>
>>>
>>> Regards
>>> jGoncalves
>>>
>>> On Mon, Apr 23, 2018 at 3:41 PM, Luiz Alberto Tessarolli <
>>> tessaro...@gmail.com> wrote:
>>>
>>>> Hello, i'm working on a cross-platform project, and i would like to
>>>> unify the database management system.
>>>> I've always worked with firebird, server and embedded, on linux and
>>>> windows with total success for more than a decade.
>>>> And for this new project, i'm looking into firebird embedded on Android
>>>> and iOS devices, using xamarin forms and visual studio (C#, DotNet).
>>>> So far, i've not been able to run embedded on android emulator, there
>>>> is little to none documentation on how to do that. After some time i
>>>> figured out how to ship the *.so files with the apk into the emulator, but
>>>> its not running. At first i though it was because the android port is
>>>> compile for arm, and the emulator is running in x86, so i tried the linux
>>>> port for x86, and it does not load libfbclient.so because it fails to find
>>>> librt.so.1 (libc6).
>>>>
>>>> I have tried downloading the *.so files in user folders on runtime, but
>>>> the DLLImport always looks on /data/app/appname/lib/x86/*
>>>>
>>>>
>>>> So i'm stuck.
>>>>
>>>> Any help is appreciatted
>>>>
>>>> Thanks,
>>>> Luiz Alberto
>>>> from Brazil.
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> Firebird-Devel mailing list, web interface at
>>>> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>>>>
>>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> Firebird-Devel mailing list, web interface at
>>> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>>>
>>>
>>
>>
>> --
>> Abraços...
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> Firebird-Devel mailing list, web interface at
>> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>>
>>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> Firebird-Devel mailing list, web interface at
> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>
>
--
Abraços...
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel