Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Isn't it cool when it comes true? However, the ultralite.NET api seems only works on windows (desktop or mobile).

So I have spent quite some time on building a POC of this and what I have achieved so far:

  • De-compiled Sap.Data.UltraLite.dll and make some changes so it compiles with MonoAndroid
  • created, built and ran an Android application written in C# using above API
  • This android application has successfully loaded the native ultralite library:
  • A function to create database in is invoked from C# but resulted an error

Although I am blocked currently, I believe so far that this approach should be doable. However what confused me is: the API exposed by seems not same with what documented on Ultralite C++ API reference at Appreciated if anyone could guide me on how to:

  • get a ultralite android native library which expose the same APIs as documented on Ultralite C++ API reference at
  • or better, a ultralite .NET API that can be used on Xamarin (that is to say, not limited to Windows)

Bellow is the details of what I have done and encountered:


  • is coming from UltraLite\UltraLiteJ\Android\ARM
  • The function invokded in is _ZN17ULDatabaseManager14CreateDatabaseEPKcS1_P7ULError. There are another 2 functions relate to "database creation", one is JNI method for Java Java_com_sap_ultralitejni17_implementation_JniDbMgr_createDatabase, the other one is ulpp_create_database_a and I choose the weirdest one by intuition. Anyone can tell me why there could be such a name, name mangling in C++, perhaps?
  • This is the C# code to call the native function:

[DllImport("", CharSet = CharSet.Unicode, EntryPoint = "_ZN17ULDatabaseManager14CreateDatabaseEPKcS1_P7ULError")] public unsafe static extern bool ULNativeDBMgrCreateDatabase(string connParms, string createParms); public unsafe bool DBMgrCreateDatabase(string connParms, string createParms) { return ULStandAloneIface.ULNativeDBMgrCreateDatabase(connParms, createParms); }

  • The passed in params: connParams->"DBF=test.udb", createParams->"checksum_level=2"
  • The resulted error:

at <unknown> <0xffffffff> 05-10 17:30:49.110 E/mono-rt ( 7285): at (wrapper managed-to-native) Sap.Data.UltraLite.ULStandAloneIface.ULNativeDBMgrCreateDatabase (string,string) <IL 0x0003e, 0xffffffff> 05-10 17:30:49.110 E/mono-rt ( 7285): at Sap.Data.UltraLite.ULStandAloneIface.DBMgrCreateDatabase (string,string) [0x00001] in ultralite_android\Sap.Data.UltraLite\ULStandAloneIface.cs:24 05-10 17:30:49.110 E/mono-rt ( 7285): at Sap.Data.UltraLite.ULDatabaseManager.DoCreateDatabase (string,string) [0x0002e] in ultralite_android\Sap.Data.UltraLite\ULDatabaseManager.cs:81 05-10 17:30:49.111 E/mono-rt ( 7285): at Sap.Data.UltraLite.ULDatabaseManager.CreateDatabase (string,string) [0x00001] in ultralite_android\Sap.Data.UltraLite\ULDatabaseManager.cs:69

Attempting native Android stacktrace:

at ???+0 [0xe0830fe8] at ???+0 [0xe0cc0578]

Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

Fatal signal 11 (SIGSEGV), code 2, fault addr 0xdda301a1 in tid 7285 (tralite_android)

asked 10 May '16, 06:17

riverlei's gravatar image

accept rate: 0%


You are unlikely to get this to work with the licensed components offered. UltraLite.NET consists of managed and unmanaged code. Even if you were permitted to decompile the managed code (please review your license agreement), there is no unmanaged code available for the Android platform. We do provide a native library for UltraLIteJ on Android but that library is not compatible with UltraLite.NET. And neither the unmanaged code nor the Android native library expose an API that is compatible with the C/C++ API. Those native code components expose the APIs consistent with their parent technology.

(10 May '16, 08:43) Chris Keating
Replies hidden

It seems that it is better to build a custom layer around .NET and Android libraries. I have googled a little bit, and see that bindings can be written ( To be honest, I do not like even this approach, because it is so time consuming and clumsy (especially because, as Chris said, APIs are not compatible).

(10 May '16, 09:50) Vlad
Replies hidden

Hello, Chris Glad to hear from you here! I am from SMP enginering of SAP and we had quite a few emails regarding SQLAnywhere performance tuning when I was doing customer sustaining for SMP 2.x of SAP, if you remember. I came across a link in this forum which says "although Android uses the UltraLiteJ API, it actually uses the underlying UltraLite C runtime so the database and SQL supported are identical to the iPhone." I believe it is still true at this time. Although the same link also says "I wish I could say one data access works for all but due to the different development environments (Objective C for iPhone, Java for BlackBerry and Android), one code base isn't going to do it." but it is almost half a decade ago and Xamarin is not around yet. With Xamarin, the development environments are C# for IOS and C# for Android. This is a big leap toward one code base for all IMO. I'd like to refine my questions to: Is it feasible to have a unified C# API across IOS, Andoird (let's put away Windows for a while) based on the same Ultralite C runtime? If the answer is yes, how much effort would it require?

By the way, here is the link I mentioned above:

Thanks and Regards Lei He

(11 May '16, 21:35) riverlei

I agree with you that wrapping the existing .NET and Android libraries is clumsy although it seems possible. What I think best for now is to create a C# layer directly on the Ultralite C runtime after I came across the link I mentioned in my reply to Chris which says "although Android uses the UltraLiteJ API, it actually uses the underlying UltraLite C runtime so the database and SQL supported are identical to the iPhone". However I am not sure how to get started. What would you suggest?

Thanks and Regards

Lei He

(11 May '16, 21:45) riverlei

Hi Lei He,

I do not know for sure. If we are talking about native libraries in general, I would suggest to read this link: This is what .NET offers from the beginning. But I do not know if this approach suits you well.

Kind regards,

(12 May '16, 03:45) Vlad

Let me reiterate that this is not feasible with current SQL Anywhere shipping software. UL.NET requires unmanaged code, a native library, which is provided only as a Windows (desktop and CE) binary. That unmanaged code calls into the UL runtime or into the UL engine (for applications that require concurrent usage by different applications) to implement the UL.NET API. That unmanaged code is not provided as an Android binary nor do we provide development components for UL C/C++ on that platform. What we do provide is a JNI shared library that is compatible with the ULj API but not with the UL.NET API.

(12 May '16, 10:07) Chris Keating
showing 3 of 6 show all flat view

permanent link

answered 12 May '16, 02:20

ddeconin's gravatar image

accept rate: 0%

I wouldn't accept this answer, because Xamarin announced the support of OData web services. This is not what the author requires.

(12 May '16, 03:34) Vlad

@ddeconin, thanks for pointing out. I went through the webinar at It did mentioned a "SAP Mobile .NET SDK" and interesting enough it was developed by Xamarin. However, it seems to me the SDK did not provide offline support (this feature was in its road map) which is to say it probably did not integrate with Ultralite at that time, correct me if I am wrong. Now when I search this SDK at, I dont' find it! Something must had happened after the webinar, I guess.

Having said all these, since your answer is not directly related to the question, I am afraid I cannot accept it. Thanks anyway.

(12 May '16, 03:42) riverlei

I've got a Xamarin binding which wraps the Android UltraLiteJNI12.jar - it's one of the first things I did in Xamarin several years ago!

I'm not sure whether this exposes all the features you want (I'm rather out of the loop regarding Ultralite these days).

Would this help?


permanent link

answered 12 May '16, 03:43

James%20Lavery's gravatar image

James Lavery
accept rate: 0%

@James Lavery, the approach you taken definitely works for Anroid but for IOS another wrapper is required which is not I want. Thanks anyway.

Lei He

(13 May '16, 01:48) riverlei
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 May '16, 06:17

question was seen: 3,125 times

last updated: 13 May '16, 01:48