Recent

Author Topic: can i connect mysql database or firebird database with LAMW  (Read 4225 times)

kadrisoft2006

  • New Member
  • *
  • Posts: 18
can i connect mysql database or firebird database with LAMW
« on: September 21, 2016, 04:09:12 pm »
hi all
i need information ,
can i connect mysql database or firebird database with LAMW  using zeosdb or other dac connections.

Handoko

  • Hero Member
  • *****
  • Posts: 4327
  • My goal: build my own game engine using Lazarus
Re: can i connect mysql database or firebird database with LAMW
« Reply #1 on: September 21, 2016, 07:26:25 pm »
LAMW has jSqliteDataAccess and jSqliteCursor, they are located under Android Bridges Extra tab on the Component Palette.

If you understand JVM programming, you can connect Firebird 'manually' just like what this fellow did:
http://forum.lazarus.freepascal.org/index.php/topic,32686.msg210936.html#msg210936

Info about using JVM on Lazarus:
http://wiki.freepascal.org/Lazarus_JVM
« Last Edit: September 21, 2016, 07:36:18 pm by Handoko »

jmpessoa

  • Hero Member
  • *****
  • Posts: 1918
Re: can i connect mysql database or firebird database with LAMW
« Reply #2 on: September 21, 2016, 09:19:31 pm »
Hi kadrisoft2006,

[Just a attempt... not tested!]

You can get  a "libfbclient.so.3.0.0" here:

http://www.firebirdnews.org/firebird-client-3-0-alpha-2-for-android-download/

Then go to your " Controls.java" in your project folder ".../src/.... and repeat this pattern:

Code: Java  [Select][+][-]
  1. //Load Pascal Library
  2. static {
  3. /*--nogui--
  4.     try {
  5.         System.loadLibrary("freetype"); // for "libfreetype.so"
  6.     } catch (UnsatisfiedLinkError e) {
  7.          Log.e("JNI_Load_LibFreetype", "exception", e);
  8.     }
  9. --graphics--*/ 
  10.     try {
  11.         System.loadLibrary("controls"); //for "libcontrols.so"
  12.     } catch (UnsatisfiedLinkError e) {
  13.          Log.e("JNI_Load_LibControls", "exception", e);
  14.     }  
  15. }
  16.  

and then include all firebird ".pas" interface to your  ".../jni" project folder

and then include "libfbclient.so.3.0.0" in your project folder  "...\libs\armeabi"  together "libcontrols.so"

before your try any "build":

      Copy "llibfbclient.so.3.0.0" to NDK location    "....\platforms\android-XX\arch-arm\usr\lib"
      where XX = 14 or 15 or 16... or 21 .. etc

      For Lamw project you can look for "XX" value in menu:
      "Project" --->> "Project Options" ---> "Compile Options" -->> "Paths" --->> Libraries [-Fl]

More info: please read the section:
 "Version 0.6 - rev. 22 - 18 April 2015" 
in LAMW "readme.txt"


« Last Edit: September 21, 2016, 09:30:21 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

kadrisoft2006

  • New Member
  • *
  • Posts: 18
Re: can i connect mysql database or firebird database with LAMW
« Reply #3 on: September 22, 2016, 08:55:46 am »
thanks for all your information.
after insert the code ;

Code: Java  [Select][+][-]
  1. //Load Pascal Library
  2. static {
  3. /*--nogui--
  4.     try {
  5.         System.loadLibrary("freetype"); // for "libfreetype.so"
  6.     } catch (UnsatisfiedLinkError e) {
  7.          Log.e("JNI_Load_LibFreetype", "exception", e);
  8.     }
  9. --graphics--*/
  10.     try {
  11.         System.loadLibrary("controls"); //for "libcontrols.so"
  12.     } catch (UnsatisfiedLinkError e) {
  13.          Log.e("JNI_Load_LibControls", "exception", e);
  14.     }  
  15. }
  16.  

when iam build all my add code deleted !

jmpessoa

  • Hero Member
  • *****
  • Posts: 1918
Re: can i connect mysql database or firebird database with LAMW
« Reply #4 on: September 22, 2016, 08:30:11 pm »
Hi kadrisoft2006,

The displayed code is the standard/default...

you need something like:

Code: Java  [Select][+][-]
  1. //Load Pascal Library
  2. static {
  3.  
  4.     try {
  5.         System.loadLibrary("fbclient"); // for "libfbclient.so.3.0.0
  6.     } catch (UnsatisfiedLinkError e) {
  7.          Log.e("JNI_Load_Libfbclient", "exception", e);
  8.     }
  9.  
  10.  
  11. /*--nogui--
  12.     try {
  13.         System.loadLibrary("freetype"); // for "libfreetype.so"
  14.     } catch (UnsatisfiedLinkError e) {
  15.          Log.e("JNI_Load_LibFreetype", "exception", e);
  16.     }
  17. --graphics--*/
  18.     try {
  19.         System.loadLibrary("controls"); //for "libcontrols.so"
  20.     } catch (UnsatisfiedLinkError e) {
  21.          Log.e("JNI_Load_LibControls", "exception", e);
  22.     }  
  23. }
  24.  

But yes,  LAMW will overwrite your modifications and return to default one!!!

so, you will need [BEFORE load your project!] go to Lazarus menu

"Tools"---> "[Lamw] Android Module Wizard" --->
"[configure] CanUpdateJavaTemplate"

and set it to "False" .

NOTE: you can persist your modification hard code it in the
LAMW framework "Controls.java" located in folder  "...\java"
« Last Edit: September 22, 2016, 08:37:10 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018