B4J Question [ABMaterial] Where should I declare and connect my DB?

Cableguy

Expert
Licensed User
Longtime User
Hi guys

So it's time I make my ABM project connect to its DB...
Many questions arise but I'll start with only 2...
1 - where should I declare my connector?
In Main, Application or Page?
2 - where and when shall I open the connection and close it, knowing that I will be accessing it in a few pages
 
Last edited:

Harris

Expert
Licensed User
Longtime User


More specifically,

https://www.b4x.com/android/forum/threads/abmaterial-for-dummies-beginner-lessons.88346/#post-560669

In the Template Main (lesson3.zip) you will find:

B4X:
' init the mysql driver
    ' you will need YOUR database name, user name (login), passowrd and pool size
    
    '                                               DB Name                               username        password      pool size
    ' DBM.InitializeMySQL("jdbc:mysql://localhost/   harris   ?characterEncoding=utf8",    "harris",     "b12xw3455",      100     )
    ' or...
    ' DBM.InitializeMySQL("jdbc:mysql://localhost/database?characterEncoding=utf8",  "username", "password",  100)
    
    
    DBM.InitializeMySQL("jdbc:mysql://localhost/harris?characterEncoding=utf8",     "harris",    "b12xxxx",   100)
 
Last edited:
Upvote 0
Top