Home MADB Java Library
Post
Cancel

MADB Java Library

High Level API to Manage a Microsoft Access Database (.accdb)

Using the ucanaccess library

Tutorial

  1. Import MADB in your project as a dependency (see Releases for .jar file)
  2. Create MADB object

    1
    
     MADB db = new MADB([your_db_directory]);
    
  3. Now through this object you have access to all of the SQL Methods (INSERT, SELECT, UPDATE etc)

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Insert value at the specific column
db.INSERT("Table_name", "Column_name", value);

//Insert multiple values in multiple columns
db.INSERT("Table_name", new String[]{"Column_name_1", "Column_name_2", "Column_name_3"}, new String[]{value1, value2, value3});

//Select the whole column
ArrayList<Object> arr = db.SELECT("Table_name", "Column_name");

//Update a value based on the custom condition
db.UPDATE("Table_name", "Column_name", value, new Condition("Column", Value, Operator.AND, "Other_Column", Other_Value));

//Delete a row based on the custom condition
db.DELETE("Table_name", "Column_name", new Condition("Column_name", Value));

Creating Conditions

Example - Create the condition: ColumnA = ValueA AND NOT ColumnB = ValueB

1
Condition c = new Condition("ColumnA", ValueA, Operator.AND_NOT, "ColumnB", ValueB);

Available Operators

  • OR
  • AND
  • NOT
  • AND_NOT
  • OR_NOT
  • GREATER_THAN
  • GREATER_OR_EQUAL_THAN
  • LESS_THAN
  • LESS_OR_EQUAL_THAN
  • BETWEEN
  • LIKE
  • IN
  • ANY
  • ALL
  • EXISTS

Dependencies

1
2
3
4
5
<dependency>
    <groupId>kdesp73.madb</groupId>
    <artifactId>MADB</artifactId>
    <version>1.0.7-SNAPSHOT</version>
</dependency>

Clone

1
git clone https://github.com/KDesp73/MADB

TODO

  • Basic SQL Methods (SELECT, INSERT, UPDATE, DELETE)
  • Make dependency fully public on the Maven repository
  • Add more SQL features

Contributing

Contributions are always welcome!

See Contributing.md for ways to get started.

Please adhere to this project’s Code of Conduct.

Authors

Credits

ucanaccess library

License

MIT

Repo

This post is licensed under CC BY 4.0 by the author.