DBConnector Help

Getting Started

It only takes five steps to go from initialization to connection!

  1. Add AxolotlDev Repository

Add the private repository

<repositories> <repository> <id>axolotldev-repo</id> <url>https://repo.axolotldev.me/repository/maven-public/</url> </repository> </repositories>
repositories { maven { url "https://repo.axolotldev.me/repository/maven-public/" } }
repositories { maven { url = uri("https://repo.axolotldev.me/repository/maven-public/") } }
  1. Load the Core Component

Current Version for Core library
<dependency> <groupId>me.axolotldev.dbconnector</groupId> <artifactId>Core</artifactId> <version>x.y.z</version> </dependency>
implementation 'me.axolotldev.dbconnector:Core:x.y.z@jar'
implementation("me.axolotldev.dbconnector:Core:x.y.z@jar")
  1. Choose the Appropriate Database Connector

Please refer to the available database drivers.

<dependency> <groupId>me.axolotldev.dbconnector</groupId> <artifactId>xxxDriver</artifactId> <version>x.y.z</version> </dependency>
implementation 'me.axolotldev.dbconnector:xxxDriver:x.y.z@jar'
implementation("me.axolotldev.dbconnector:xxxDriver:x.y.z@jar")
  1. Create a Database Connection

import me.axolotldev.dbconnector.core.connect.ConnectBuilder; import me.axolotldev.dbconnector.abstracts.database.DatabaseInfo; import me.axolotldev.dbconnector.driver.xxxDriverData; import me.axolotldev.dbconnector.abstracts.database.Connector; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class DatabaseConnection { public static void main(String[] args) { // Set URI options (e.g., SSL, timezone, etc.) final Map<String, String> options = new HashMap<>(); options.put("ssl", "true"); // Add other parameters as needed // Create the database connection info final DatabaseInfo dbInfo = new DatabaseInfo( "127.0.0.1", // URI 3306, // Port "root", // Username "password", // Password (will be securely handled) "my_database", // Database name options // Connection options ); // Set internal behavior properties (optional) final Properties meta = new Properties(); meta.put("autoReconnect", "true"); // Add more custom settings if needed // Create the database connection final Connector connector = new ConnectBuilder( dbInfo, xxxDriverData.INSTANCE, meta ).build(); // Now you can use the connector for operations } }
import me.axolotldev.dbconnector.core.connect.ConnectBuilder import me.axolotldev.dbconnector.abstracts.database.DatabaseInfo import me.axolotldev.dbconnector.driver.xxxDriverData import me.axolotldev.dbconnector.abstracts.database.Connector fun main() { // Create the database connection info and internal properties in one step val connector = ConnectBuilder( DatabaseInfo( "127.0.0.1", // URI 3306, // Port "root", // Username "password", // Password (will be securely handled) "my_database", // Database name mapOf("ssl" to "true") // Connection options ), xxxDriverData.INSTANCE, Properties().apply { put("autoReconnect", "true") } // Internal behavior properties ).build() // Now you can use the connector for operations }
  1. Connection Complete!

Now you can use the connector to execute queries, transactions, and encapsulate logic, etc.!

01 6月 2025