DATABASEX DOCUMENTATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Complete technical and architectural guide for administrators & developers
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. INSTALLATION
────────────────────────────────────────────────────
-
Download the DataBaseX.jar file.
-
Place it in your server's /plugins/ directory.
-
CRITICAL FOR JAVA 21+: DataBaseX uses Java's native Instrumentation API. It starts and injects itself 100% automatically without requiring any `-javaagent` startup flags!
-
Restart your server to generate configuration files and attach the agent to the JVM.
-
Customize config.yml to fine-tune your cache rules.
2. CONFIGURATION GUIDE
────────────────────────────────────────────────────
General Tuning Settings:
-
slow-query-threshold-ms: Maximum duration allowed for a query before it triggers the automatic Explain Advisor (default: 10.0ms).
-
alert-main-thread-queries: Prints a big red warning in console if a plugin executes a query on the Main Spigot Thread (which blocks the TPS tick).
-
auto-repair-leak-threshold-ms: Max idle lifespan of a JDBC Statement in RAM before the Leak Hunter auto-closes it to prevent RAM leaks (default: 300000 = 5min).
Smart Caffeine Cache Tuning:
-
cache.default-ttl-seconds: Default lifetime of database records stored in RAM cache. Recommended: 5 to 10s.
-
cache.rules:<tableName>: Define per-table TTL values. Lowercase tables only. Set to 0 to completely exclude high-sensitivity tables (like player balances) from being cached.
WAF Anti-Flood Firewall:
Centralized SQL Provider:
-
database-provider.enabled: Enable the global shared pool. Allows other plugins to bypass configuring credentials.
-
pool.maximum-pool-size: Max concurrent MySQL connections allowed globally (default: 20).
-
pool.minimum-idle: Minimum idle connections maintained to avoid startup latency (default: 5).
3. DEVELOPER INTEGRATION (API)
────────────────────────────────────────────────────
Developers no longer need to bundle HikariCP or ask admins for DB passwords. DataBaseX provides a clean, enterprise-grade static gateway.
Get a Managed SQL Connection:
Add DataBaseX as a dependency in your pom.xml (provided) and call the gateway in your code:
Code (Java):
// 100% Managed, 100% Optimized, 0ms Configuration!
try
(
Connection conn
= fr.
skynex.
databasex.
api.
DataBaseXAPI.
getConnection
(
)
)
{
try
(
PreparedStatement ps
= conn.
prepareStatement
(
"SELECT * FROM players WHERE uuid = ?"
)
)
{
ps.
setString
(
1, uuid.
toString
(
)
)
;
// ... Rest of your business logic ...
}
}
catch
(
SQLException e
)
{
e.
printStackTrace
(
)
;
}
Under the hood: The Namespace Magic
When using our shared API, DataBaseX transparently uses **Bytecode Mutation** to rewrite your queries at the JVM level to isolate your tables!
If your plugin named "LootGlow" executes:
Code (SQL):
CREATE
TABLE
IF
NOT
EXISTS stats
(uuid
VARCHAR
(
36
)
, coins
INT
);
DataBaseX automatically intercept it and translates it behind your back into:
Code (SQL):
CREATE
TABLE
IF
NOT
EXISTS dbx_lootglow_stats
(uuid
VARCHAR
(
36
)
, coins
INT
);
Benefit: Absolute zero table name collision risk with other plugins, even on shared databases!
️ 4. COMMANDS & DASHBOARDS
────────────────────────────────────────────────────
| /dbx |
Show active stats, Cache Hits, Cache Misses and Coalesced queries. |
| /dbx active |
The SQL "htop". Shows running background queries, their thread names, and live elapsed time. |
| /dbx top |
List the Top 10 slowest recorded queries, with automatic diagnostic advice. |
| /dbx explain <sql> |
Simulate a SELECT query and get indexing advice directly in the game chat. |
| /dbx purge |
Purges the Caffeine RAM Cache (instantly frees memory). |
5. PERMISSIONS
────────────────────────────────────────────────────
-
databasex.admin — Access to all administrative commands (/dbx active, explain, top, purge, reload). Recommended only for high-level technical administrators.
-
databasex.notify — Admins with this node will receive live red-alert notifications in-game when an N+1 Loop or a critical Main Thread execution is detected.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Questions? Technical issues? Join us on Discord!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
![[IMG]](//proxy.spigotmc.org/d0a30626b5d2fb81a070a9a88cf2e187738dea11/68747470733a2f2f696d6167652e6e6f656c736861636b2e636f6d2f66696368696572732f323032362f31392f322f313737383030323430342d756e6976657273616c2d62616e6e65722d6564697465642d66696e616c2d3137373830303232343738363131322e706e67)