Hello fellow B4X'ers,
Here is some example code for connecting your B4J projects to 5 different types of database engines, this tutorial is for learning purposes only and nothing else.
Disclaimer:
This code with some minor changes may also work in B4A. MySQL and MSSQL connectors definitely do work in B4A but I'm not sure about the PostgreSQL, MariaDB and Oracle connectors. Please check on the corresponding connector/J developers website for more information about using and distributing their connector/J drivers.
Directions:
First download and copy the 5 JDBC Cconnector/J files into your additional libraries folder, then open the attached B4J project and set the DBLocation, DBUsername and DBPassword for your particular databases, that's all you have to do.
Download link for all 5 JDBC Connector/J drivers:
https://www.dropbox.com/sh/q2h7qmiwrparzru/AACmjXllUKcYF1XhNOrYkGh3a?dl=0
In my attached example the MariaDB Connector/J is deliberately connecting to a MySQL database, this is because the MariaDB Connector/J can connect to both MySQL and MariaDB database engines with ease. Both database formats were founded by Michael Widenius.
Update file: I've added Oracle Connector/J
I decided to add Oracle Connector/J to the attached file named Database5ConnectionTypes.zip, so download that file instead.
Enjoy...
Here is some example code for connecting your B4J projects to 5 different types of database engines, this tutorial is for learning purposes only and nothing else.
Disclaimer:
This code with some minor changes may also work in B4A. MySQL and MSSQL connectors definitely do work in B4A but I'm not sure about the PostgreSQL, MariaDB and Oracle connectors. Please check on the corresponding connector/J developers website for more information about using and distributing their connector/J drivers.
Directions:
First download and copy the 5 JDBC Cconnector/J files into your additional libraries folder, then open the attached B4J project and set the DBLocation, DBUsername and DBPassword for your particular databases, that's all you have to do.
Download link for all 5 JDBC Connector/J drivers:
https://www.dropbox.com/sh/q2h7qmiwrparzru/AACmjXllUKcYF1XhNOrYkGh3a?dl=0
In my attached example the MariaDB Connector/J is deliberately connecting to a MySQL database, this is because the MariaDB Connector/J can connect to both MySQL and MariaDB database engines with ease. Both database formats were founded by Michael Widenius.
Update file: I've added Oracle Connector/J
I decided to add Oracle Connector/J to the attached file named Database5ConnectionTypes.zip, so download that file instead.
Picked up _JAVA_OPTIONS: -Xmx1024m -Xms1024m -XX:-UseGCOverheadLimit
Waiting for debugger to connect...
Program started.
---------- Northwind Database (MySQL) ----------
categories
customercustomerdemo
customerdemographics
customers
employees
employeeterritories
order details
orders
products
region
shippers
suppliers
territories
---------- Northwind Database (MSSQL) ----------
CustomerDemographics
Region
Employees
Categories
Customers
Shippers
Suppliers
Orders
Products
Order Details
CustomerCustomerDemo
Territories
EmployeeTerritories
---------- Northwind Database (PostgreSQL) ----------
us_states
customers
orders
employees
shippers
products
order_details
categories
suppliers
region
territories
employee_territories
customer_demographics
customer_customer_demo
---------- Northwind Database (MariaDB) ----------
categories
customercustomerdemo
customerdemographics
customers
employees
employeeterritories
order details
orders
products
region
shippers
suppliers
territories
---------- XE Database (Oracle) ----------
LOGMNRGGC_GTLO
LOGMNRGGC_GTCS
LOGMNR_PARAMETER$
LOGMNR_SESSION$
ROLLING$CONNECTIONS
ROLLING$DATABASES
ROLLING$DIRECTIVES
ROLLING$EVENTS
ROLLING$PARAMETERS
ROLLING$PLAN
ROLLING$STATISTICS
ROLLING$STATUS
MVIEW$_ADV_WORKLOAD
MVIEW$_ADV_BASETABLE
MVIEW$_ADV_SQLDEPEND
MVIEW$_ADV_PRETTY
MVIEW$_ADV_TEMP
MVIEW$_ADV_FILTER
MVIEW$_ADV_LOG
MVIEW$_ADV_FILTERINSTANCE
MVIEW$_ADV_LEVEL
MVIEW$_ADV_ROLLUP
MVIEW$_ADV_AJG
MVIEW$_ADV_FJG
MVIEW$_ADV_GC
MVIEW$_ADV_CLIQUE
MVIEW$_ADV_ELIGIBLE
MVIEW$_ADV_OUTPUT
MVIEW$_ADV_EXCEPTIONS
MVIEW$_ADV_PARAMETERS
MVIEW$_ADV_INFO
MVIEW$_ADV_JOURNAL
MVIEW$_ADV_PLAN
AQ$_QUEUE_TABLES
AQ$_QUEUES
AQ$_SCHEDULES
AQ$_INTERNET_AGENTS
AQ$_INTERNET_AGENT_PRIVS
SCHEDULER_PROGRAM_ARGS_TBL
SCHEDULER_JOB_ARGS_TBL
LOGSTDBY$PARAMETERS
HELP
SQLPLUS_PRODUCT_PROFILE
L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LOGMNR_RESTART_CKPT$
LOGMNR_FILTER$
LOGMNR_SESSION_ACTIONS$
REDO_DB
REDO_LOG
LOGSTDBY$EVENTS
LOGSTDBY$APPLY_MILESTONE
LOGSTDBY$SCN
LOGSTDBY$FLASHBACK_SCN
LOGSTDBY$PLSQL
LOGSTDBY$SKIP_TRANSACTION
LOGSTDBY$SKIP
LOGSTDBY$SKIP_SUPPORT
LOGSTDBY$HISTORY
LOGSTDBY$EDS_TABLES
Waiting for debugger to connect...
Program started.
---------- Northwind Database (MySQL) ----------
categories
customercustomerdemo
customerdemographics
customers
employees
employeeterritories
order details
orders
products
region
shippers
suppliers
territories
---------- Northwind Database (MSSQL) ----------
CustomerDemographics
Region
Employees
Categories
Customers
Shippers
Suppliers
Orders
Products
Order Details
CustomerCustomerDemo
Territories
EmployeeTerritories
---------- Northwind Database (PostgreSQL) ----------
us_states
customers
orders
employees
shippers
products
order_details
categories
suppliers
region
territories
employee_territories
customer_demographics
customer_customer_demo
---------- Northwind Database (MariaDB) ----------
categories
customercustomerdemo
customerdemographics
customers
employees
employeeterritories
order details
orders
products
region
shippers
suppliers
territories
---------- XE Database (Oracle) ----------
LOGMNRGGC_GTLO
LOGMNRGGC_GTCS
LOGMNR_PARAMETER$
LOGMNR_SESSION$
ROLLING$CONNECTIONS
ROLLING$DATABASES
ROLLING$DIRECTIVES
ROLLING$EVENTS
ROLLING$PARAMETERS
ROLLING$PLAN
ROLLING$STATISTICS
ROLLING$STATUS
MVIEW$_ADV_WORKLOAD
MVIEW$_ADV_BASETABLE
MVIEW$_ADV_SQLDEPEND
MVIEW$_ADV_PRETTY
MVIEW$_ADV_TEMP
MVIEW$_ADV_FILTER
MVIEW$_ADV_LOG
MVIEW$_ADV_FILTERINSTANCE
MVIEW$_ADV_LEVEL
MVIEW$_ADV_ROLLUP
MVIEW$_ADV_AJG
MVIEW$_ADV_FJG
MVIEW$_ADV_GC
MVIEW$_ADV_CLIQUE
MVIEW$_ADV_ELIGIBLE
MVIEW$_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