B4J Library [ABMaterial] Template

Hello.

Some time ago I prepared for myself a ready-made Template for a project for ABMaterial. It makes it easier to create new projects.
Changes:

1. DBM 4 different connection to databases:
- Mysql/mariadb
- SQLite
- Hikari (very fast mysql/mariadb)
- H2
Depending on which database we are going to support we need to unblock the jar biblite loading in the Main module.
' #AdditionalJar: sqlite-jdbc-3.7.2.jar
' #AdditionalJar: HikariCP-3.4.5.jar
' #AdditionalJar: mariadb-java-client-2.6.0.jar
' #AdditionalJar: h2-1.4.200.jar
Additionally gives link to jar conector database libraries so you don't have to search the net.
Link for odbc jar

2. Added ready Settings module for settings in project. I always use it in my projects. It makes my work very easy. The homepage has an example of using settings from settings.
More about it here: About page settings

3. Added hashpass module. There is password generator (code from B4X forum) , support for encryption with library Decrypter by @DonManfred.
Library Decrypter
At first you need to initialize InitDe(value As String) value is your arbitrary password string. After that, you can already use to : EncryptHash(value As String) As String and DecryptHash(value As String) As String .
3a. Additional simple but effective function Hash Password: Hash128(email As String, password As String) good for creating password stored in database of given user.
3b. Added 2 functions to replace national characters with acceptable ones in encryption and decryption functions.
- replacePL(value As String) As String
- dereplacePL(value As String) As String
They are for polish language, everyone can replace them with own national characters.

4. In ABMpplication module in line 22 if we have our own DonatorKey we enter it to use additional options for Donator.

5. In ABMShared added function to send Email from SMTP. SMTP account data is set in settings.
SendEmail(odbiorca As String, tytul As String, body As String, html As Boolean) ; odbiorca - recipient's email address, tytul - title email

6. You don't have to enter the full path to the project in the browser. The domain itself is enough, e.g. http://localhost and you will be immediately redirected to the initial page.

Copy ABMaterial.b4xtemplate file to root folder of B4J library.

################################################################
Update:2021-11-09
- Improved connection to databases
- Added complete b4x and connector jar libraries (up Link for odbc jar)
- Added LetsCrypt SSL support based on ABKeystoreSSL @alwaysbusy
- Added some new parameters in 'config.prop' configuration file regarding SSL.
- Enabling SSL will force https connection

newprojekt.png
 

Attachments

  • ABMaterial.b4xtemplate
    36.4 KB · Views: 91
Last edited:

MichalK73

Active Member
Licensed User
Update:2021-11-09
- Improved connection to databases
- Added complete b4x and connector jar libraries
- Added LetsCrypt SSL support based on ABKeystoreSSL @alwaysbusy
- Added some new parameters in 'config.prop' configuration file regarding SSL.
- Enabling SSL will force https connection

First post updated with the changes.
 

Harris

Expert
Licensed User
Longtime User
Got this error when using the template...
I have added the other jars required...

Thx

B4X:
Compiling generated Java code.    Error
Cannot find: C:\Anywhere Software\B4J\libraries\acme4j-client-2.11.jar



B4X:
#Region  Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True     
    #AdditionalJar: bcprov-jdk15on-154
'    #AdditionalJar: conscrypt-openjdk-uber-1.1.4
    #VirtualMachineArgs: -Xms2048m -Xmx2048m
    
    ' **** load the odbc library for your database type ****
    'HicariCP
'    #AdditionalJar: HikariCP-5.0.0.jar
'    #AdditionalJar: slf4j-api-1.7.32.jar
                    
    'enabled for HicariCP/MySql/MariaDB
'    #AdditionalJar: mariadb-java-client-2.6.0.jar       
     #AdditionalJar: mysql-connector-java-5.1.44-bin

    'enabled for mysql
'    #AdditionalJar: c3p0-0.9.1.2.jar             

    'enabled for SqLite
'    #AdditionalJar: sqlite-jdbc-3.7.2.jar       

    ' *******************************************************
#End Region
 
Last edited:

MichalK73

Active Member
Licensed User
@up
Are you adding a mysql jar because you can't see it in the name?
The bug does not apply to the template because it does not use the library you mentioned in the error code.
 

MichalK73

Active Member
Licensed User
In the attached package that I shared in 1 post you need libraries, including 'ABKeystoreSSL'. I did not include only ABMaterial libraries, because everyone can apply their version.
 

Harris

Expert
Licensed User
Longtime User
Thanks guys... I knew it had to be something simple.

The reason why I included my - mysql driver was because I didn't understand which one(s) to enable that you included for mysql.
I am playing with this to see how others use ABM for their projects - and help simplify / better mine....
I am liking the concepts... and I will work this issue out.

Harris
 
Top