Lazarus
Programming => Operating Systems => Android => Topic started by: amartitegui on November 15, 2017, 04:37:53 pm
-
Has anyone made something with lazarus-android with mysql?
Tsqlconnector wont work? what external library could be used?
I know Oracle has connector/j & connector/node.js
but...
Any comments helpfull.
thanks
-
You can try jSqliteDataAccess and jSqliteCursor.
FYI, there are many demos you can try and see how they work. They're inside your LAMW_folder\trunk\demos.
-
But can connect to Mysql server?
I allready have Mysql server running for many machines changing data at factory.
Just want to Make tablets been able to see data too.
With B4A there is a mysql conenctor and tested and worked fine.
The interesting part of it uits that i have created some application modules for slower machines with lazarus. And event Im thinking about conventing the whole project to lazarus.
The real usefull part of android with lazarus is to use same classes and functions. full units. within android program. Even if i gotta change the controls (regular Os buttons, etc).... well that does not worries me.
So, Mysql it soeems important to the idea. Thats why i asked.
As I know there are mysql connectors for java...
well if someone know something.... thankfull
-
What about access your server ( Mysql or any...) via http?
-
Its a solution. or it may be.
Other may be..:
Zeos? anyone tryied with android?
also read something about MorMot.... dont know if it works though ...
and have a couple of other things i want to check.
but it's possible to arrange something eith http:... using synapse. 'cause synapse works within lazarus+android right?
I allready have something built with synapse that may work.
-
Zeos uses external connector.... so one down.
-
NOpe... as far a as I've seen no way, unless webserivce/http
thanks
-
NOpe... as far a as I've seen no way, unless webserivce/http ....
A simple "CGI/Rest/RestFull" is enough.....
In fact what you need is a mySQL ".so" client for android ....
[I know there is a ".so" firebird client for android... but I never tested it...]
-
foun this interesting matter bout synopse/mormot.
Have you ever try to work with mormot?
http://blog.synopse.info/post/2013/09/19/FreePascal-Lazarus-and-Android-Native-Controls
-
Also found somthing like this to try.
https://github.com/0x-ff/libmysql-android
-
Furthermore, take a look at this guy's info.
Very interesting... and maybe someone also needs o its interested in this.
https://mymegabyte.com/2011/03/cross-compile-libmysql/
got to it from: http://www.qtcentre.org/threads/56202-mysql-plugin-on-android-requires-libmysqlclient_r-so-built-with-android-toolchain
-
and... finaly yes.
Im gonna try all that stuf or compile (or try to compile the lib)
found many info about it using NDK.
-
I thought I got it.
Mysql found library.
BUT and its a big BUT, there is an error using SQLDBLaz. When compiling appears the famous
Messages, Hints: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: C:\lamw\projects\ALFONSO_TEST_1\test_mysql\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\lamw\projects\ALFONSO_TEST_1\test_mysql\obj\controls\controls.o"
Note: Duplicate unit "controls" in "LCLBase 1.7", ppu="C:\lamw\laz4android\lcl\units\arm-android\controls.ppu", source="C:\lamw\laz4android\lcl\controls.pp"
Compile package CodeTools 1.0.1: Aborted
Compile package LCL 1.7: Exit code 1, Errors: 1
gtk2cellrenderer.pas(30,3) Fatal: Cannot find gtk2 used by Gtk2CellRenderer of package LCL.
Ideas?
-
Should I go with Zeos?
-
Uses LCL too.
:'(
-
Yes, LCL not is supported in LAMW ... so we need a core/raw ".so" for arm/android or x86/android, etc...
but, MorMot + LAMW is possible!
There is a demo [by DonAlfredo] here:
https://github.com/jmpessoa/lazandroidmodulewizard/tree/master/demos/GUI/AppmORMotDemo1
-
I thought I got it.
Mysql found library.
BUT and its a big BUT, there is an error using SQLDBLaz.
You should not use SQLDBLaz package. Instead you need units for fcl-db: sqldb, mysqlXXconn (where XX is your libMySql version), etc.
-
Mmmmmm you mean... use just the component units instead of the pakage rigth?
Necer thought of it. Gotta check also if they dont include lcl... but its a nice idea
Thanks. Gonna try.
I was making some tries creating the app without LAWN Too. But apk building its a pain in the ass.
Cant get it properly working.
Only got to buil .ap_ but stuck with .dex and signing. Mainly i think because of the dex part.
-
Jmpessoa I think that, as A.S said it may work with LAWM. using the units and not the package (felt kinda stupid 'cause I do it all the time with nongraphical classes/units) It compiles, and it builds .APk.
But i think the library is not correct. I've checked and its buit for x86 android and api 14. Im running API19 and arm7. So it gives me an error (catched as exception) runtime.
Checked and should work. Iges its library. So to build library ....
Someone with experience compiling with android ndk?
I need to compile libmysqlclient_r.so, libmysqlclient.so and libmysql.so properly for arm-7.
I know that its possible to compile with android NDk but have no experience at all.
anyone?
thanks
-
I need to compile libmysqlclient_r.so, libmysqlclient.so and libmysql.so properly for arm-7.
Can you come up with "C" code [localization] ?
-
Sorry I've been on working trip.
Im back.
I think I built a lib , and also i have another allready built.
I installed lawm in ubuntu 17, 64 bit.
Managed to have all working.
made a simple prog test.
compiled.... everything green... should be fine.... but i get:
Ventana de Mensajes, Sugerencias: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: /home/osboxes/Documents/LAZ_droid_projects/TEST_droid_1/Test_mysql_14_1/libs/armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Unidad duplicada "controls" en "test_mysql_14", orphaned ppu "/home/osboxes/Documents/LAZ_droid_projects/TEST_droid_1/Test_mysql_14_1/obj/controls/controls.o"
Note: Unidad duplicada "controls" en "LCLBase 1.8.0.5", ppu="/home/osboxes/.lazarus/lib/LCLBase/units/arm-android/controls.ppu", source="/usr/share/lazarus/1.8.0RC5/lcl/controls.pp"
Compilar proyecto, OS: android, CPU: arm, Objetivo: /home/osboxes/Documents/LAZ_droid_projects/TEST_droid_1/Test_mysql_14_1/libs/armeabi-v7a/libcontrols.so: Éxito
Building APK... : Éxito
Installing APK... : Éxito
Starting APK... : Éxito
Starting: Intent { cmp=org.lamw.test_mysql_14_1/.App }
Error type 3
Error: Activity class {org.lamw.test_mysql_14_1/org.lamw.test_mysql_14_1.App} does not exist.
do you know why?
thanks
-
I think library is not correct.
pain in the .... to build it
-
FInally I compilled So lib and as far as I know its ok.
I mounted in a simple program test withg LAMW.
The only problem I get is:
I put the limbysqlclient.so in folder libs.
but when I run the app it does not find the so.
Do i have to do something with the .so file?
I mean, just put the .so library in the libs folder .... I was assuming that it would be packed.... but maybe I need to do something else.
Anyone knows?
thanks
-
NEVER MIND.
It works.
Its just that when compiling my so was called libmysql.so and not libmysqlclient.so
IT WORKS.
thanks anyway.
I will try to post something for this, so anyone can do it without so much trouble.
-
Good News and Great Work!
I will try to post something for this, so anyone can do it without so much trouble.
Much appreciated!
Thank you!
-
Ok, there it is.
I will write a tuto, or something similar.
But here. If anyone needs the SO for android of mysql :
https://mega.nz/#F!sbATBbjL!l-Uc0hpfg9-XwJDb3Vc_mg
for android 19, 21, 23, and 24.
So library should be placed in project folder, /libs/armeabi-v7a (if using arm7)
How to use.
WITH LAMW:
IMPORTANT: SkipLibraryVersionCheck:=true;
Doing so, I checked it works with TMySQL56Connection and TMySQL55Connection
DO NOT use the registered tool in SQLdb (uses LCL). Just declare the TMySQL56Connection, TSQLQuery,TSQLTransaction classes.
in Activity/form:
{DECLARATION OF USES}
uses
Classes, SysUtils, AndroidWidget, Laz_And_Controls,
mysql56conn,sqldb, And_jni, surfaceview, drawingview;
{PRIVATE DECLARATIONS}
private
MySQL56Connection1:TMySQL56Connection;
SQLQuery1: TSQLQuery;
SQLTransaction1: TSQLTransaction;
And to use it... for example:
{PROCEDURES}
procedure TAndroidModule1.AndroidModule1ActivityCreate(Sender: TObject;
intentData: jObject);
begin
try
MySQL56Connection1:=TMySQL56Connection.Create(nil);
MySQL56Connection1.SkipLibraryVersionCheck:=true;
ShowMessage('correcto');
except
ShowMessage('problema');
end;
end;
procedure TAndroidModule1.jButton1Click(Sender: TObject);
begin
try
try
SQLTransaction1:=TSQLTransaction.Create(nil);
SQLQuery1:=TSQLQuery.Create(nil);
SQLTransaction1.DataBase:=MySQL56Connection1;
SQLQuery1.DataBase:=MySQL56Connection1;
SQLQuery1.Transaction:=SQLTransaction1;
ShowMessage('So far so good');
except
ShowMessage('query transactor');
end;
with MySQL56Connection1 do
begin
DatabaseName:='YOUR DATABASE NAME';
HostName:='YOUR HOST.IP OR ALIAS';
Port:={PORT NUMBER WITHOUT QUOTES, ITS NUMBER NOT STRING};
Password:='YOUR PASSWORD';
UserName:='YOUR USERNAME';
end;
MySQL56Connection1.Open();
MySQL56Connection1.Connected:=true;
// ShowMessage('So far so good... still');
except
On E :Exception do begin
ShowMessage(E.Message);
end;
//ShowMessage('ERROR conection');
end;
if MySQL56Connection1.connected then begin
try
SQLQuery1.close;
SQLQuery1.SQL.Text:='YOUR QUERY...FOR THIS WITH LIMIT 1';
SQLQuery1.active:=true;
SQLQuery1.Open;
jTextView1.Text:=SQLQuery1.FieldByName('sql_field_name_1').value;
jTextView2.Text:=SQLQuery1.FieldByName('sql_field_name_2').value;
jTextView3.Text:=SQLQuery1.FieldByName('sql_field_name_3').value;
jTextView4.Text:=SQLQuery1.FieldByName('sql_field_name_4').value;
SQLQuery1.Close;
finally
end;
end;
end;
-
Great!!
Here is my suggestion to configure your "Application.mk"
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-19
No need for others 20, 21, etc...
Thank you!
-
Thanks man. Will try
;)
-
jmpessoa, good morning.
Application.mk should be in Jini folder ...
you mean application.mk in the test project where I use the .so file? If so:
Cant find Application.mk in the project folder...
I see the Application Tab in project options, in LAMW project options which refers Android Manifest and Application.
I see manifest, But cannot fin the file....
thanks
-
you mean application.mk in the test project where I use the .so file
No!
"application.mk" is used to configure the ".so" builder project [not LAMW project] ... that is, if you
have the "C" code to produce the ".so" using core NDK...
-
IMHO You shouldn't connect to an external database directly (with TCP cipher better). It's better and easy to make an HTTP Rest api and publish methods to retrieve and put data.
-
I disagree... deeply.
It depends on the overall system u may have. just as any other database.
Im not running Mysql server hosted on internet, nor I have (dont need it) web server...
I have a mysql server in a local machine, and use it to store datas from computers, pcls ....
running in LAN, host filter assigned to users in certain machines...
Dont see the need of creating a webserver, php ....
So, as I said... It depends on the system layout.
-
Great, no problem : ;)
Also IMHO it's not the best protocol to use over internet.
-
I connect mariadb notwork
and i connect postgresql libpg.so.5 not work
help me please
-
Get [MySQL57Bridge.rar] from the attachment [below] .... and install "mysql57bridge_pack.lpk"
an try the demo "AppMySqlDemo1.rar" ......
-
after install "mysql57bridge_pack.lpk"
try the demo "AppMySqlDemo1.rar" [above]
-
Get [MySQL57Bridge.rar] from the attachment [below] .... and install "mysql57bridge_pack.lpk"
an try the demo "AppMySqlDemo1.rar" ......
Hello, guys. How about this MySQL Bridge result? Is that works? What .so file I should use?
-
Please, wait ... I need updated it!!!
-
Please, wait ... I need updated it!!!
Thanks! :D
-
Done!!
LAMW Introduce "FCL Bridges" component palette.....
[to hold FCL based libraries...]
Intall "fcl_bridges_pack.lpk" .... from new folder "fcl_bridges"
NEW demo "AppFCLMySQL57ConnectionBridgeDemo1"
-
Done!!
LAMW Introduce "FCL Bridges" component palette.....
[to hold FCL based libraries...]
Intall "fcl_bridges_pack.lpk" .... from new folder "fcl_bridges"
NEW demo "AppFCLMySQL57ConnectionBridgeDemo1"
Thank you :D
Btw, where I can find the libmysql.so? Which one did you used?
-
LAMW will handle automatically for you!!!
But you can look here:
\lazandroidmodulewizard\android_wizard\smartdesigner\fcl\libso
-
LAMW will handle automatically for you!!!
But you can look here:
\lazandroidmodulewizard\android_wizard\smartdesigner\fcl\libso
Handle automatically?!! That's awesome.
Thanks for a great job!
-
There are problems with new mysqlbridge and old mysqlbridge.
The problem looks the same, but the behavior is different. The old one it does do nothing when I do a query, no exception, just press the button and there's nothing. The new one is crashing at the app launch.
I tried the demo, it behaves the same way. :)
I am using target JDK 1.8.0, SDK 27, NDK 10e, Ant 1.9.7, and Gradle 4.7. :D
edit: I got the error, it said: "Database is not assigned". But when I looking into the mysql57connectionbridge unit, but I quite sure it's assigned. It's confusing. Hahaha...
-
I just added MySQL47ConnectionBridge.MySQL57Connection.Transaction := TSQLTransaction.Create(nil);, and it works, but that so weird, because if I added that in the mysql57connectionbridge unit in the fcl-brige_pack it doesn't work. %)
Is that an FCL bug or something?
Update: I'm using my own unit, it just works. That's so weird.
-
Good!!!
I will try mimic your code!
and, of course, assign the credit to you!
[please, put your demo in some open/cloud drive!]
Thank you!
-
Good!!!
I will try mimic your code!
and, of course, assign the credit to you!
[please, put your demo in some open/cloud drive!]
Thank you!
Yeah, sure.
-
This is the demo drive link :)
https://drive.google.com/open?id=1wwAWNFVIqppd7tO-CMp26tC8zLSxANdL (https://drive.google.com/open?id=1wwAWNFVIqppd7tO-CMp26tC8zLSxANdL)