# Which Database Drivers Are Compatible with DBX's JDBC Plugin System?

> Discover which database drivers are compatible with DBX's JDBC plugin system. Currently, only Xugu and Oracle are supported for seamless integration.

- Repository: [skyler/dbx](https://github.com/t8y2/dbx)
- Tags: api-reference
- Published: 2026-07-05

---

**Only Xugu and Oracle databases are currently compatible with DBX's JDBC plugin system**, which translates JDBC-style URLs into native DSNs for the underlying Go drivers.

DBX implements a lightweight JDBC-style plugin layer to bridge Java-style connection strings with Go's `database/sql` package. According to the t8y2/dbx source code, the system currently supports two enterprise databases through dedicated driver implementations in the `agents/drivers/` directory. Understanding which database drivers are compatible with DBX's JDBC plugin system is essential for configuring cross-platform database connectivity.

## Currently Supported Database Drivers

The DBX JDBC plugin system currently recognizes two database drivers. Both implementations follow a consistent pattern of parsing JDBC URLs and converting them to driver-specific DSN formats.

### Xugu Database Driver

The **Xugu driver** supports JDBC URLs following the pattern `jdbc:xugu://<host>[:<port>]/<database>`.

In [`agents/drivers/xugu/main.go`](https://github.com/t8y2/dbx/blob/main/agents/drivers/xugu/main.go), the `parseXuguJDBCURL` function handles URL detection and extraction. The implementation imports `gitee.com/XuguDB/go-xugu-driver` and registers the driver as `"xugu"` with `sql.Open`. The `buildXuguDSN` function constructs the final connection string using Xugu's native format: `IP=<host>;Port=<port>;DB=<database>;User=<username>;PWD=<password>;CHAR_SET=UTF8`.

### Oracle Database Driver

The **Oracle driver** accepts two JDBC thin URL formats:

- Service name format: `jdbc:oracle:thin:@//<host>:<port>/<service>`
- SID format: `jdbc:oracle:thin:@<host>:<port>:<SID>`

Located in [`agents/drivers/oracle-go/main.go`](https://github.com/t8y2/dbx/blob/main/agents/drivers/oracle-go/main.go), the implementation uses `github.com/sijms/go-ora` (registered as `"oracle"`) and provides the `parseOracleJDBCURL` function for parsing. Rather than manual DSN construction, this driver utilizes `go_ora.BuildJDBC` to generate the native connection string after extracting components from the JDBC URL.

## How DBX Translates JDBC URLs

Both drivers follow a standardized three-step translation process:

1. **Pattern Detection**: The system checks if the connection string matches a recognized JDBC URL pattern using regular expressions in `parseXuguJDBCURL` or `parseOracleJDBCURL`.

2. **Component Extraction**: Host, port, database name (or service name/SID), and credentials from `connectParams` are extracted from the URL structure.

3. **DSN Construction**: The driver-specific builder (`buildXuguDSN` for Xugu, `go_ora.BuildJDBC` for Oracle) generates the native driver DSN required for `sql.Open`.

If the supplied connection string does not match a recognized JDBC pattern, DBX falls back to using the raw DSN provided in `connectParams` or standard URL-style strings.

## JDBC Connection Examples

The following examples demonstrate how to configure connections using JDBC-style URLs with DBX.

### Xugu JDBC Connection

```go
params := connectParams{
    Username: "admin",
    Password: "secret",
    ConnectionString: "jdbc:xugu://dbx-host:5138/sales",
}
db, err := sql.Open("xugu", buildDSN(params))
// Generates: IP=dbx-host;Port=5138;DB=sales;User=admin;PWD=secret;CHAR_SET=UTF8

```

### Oracle Service Name Connection

```go
params := connectParams{
    Username: "scott",
    Password: "tiger",
    ConnectionString: "jdbc:oracle:thin:@//oracle-host:1521/orclpdb1",
}
db, err := sql.Open("oracle", buildDSN(params))
// Uses go_ora.BuildJDBC internally

```

### Oracle SID Connection

```go
params := connectParams{
    Username: "scott",
    Password: "tiger",
    ConnectionString: "jdbc:oracle:thin:@oracle-host:1521:ORCL",
}
db, err := sql.Open("oracle", buildDSN(params))

```

## Extending Support for Additional Drivers

Adding support for new databases (such as PostgreSQL or MySQL) requires implementing the same interface pattern found in the existing drivers. You would need to:

- Import the native Go driver (e.g., `github.com/lib/pq` for PostgreSQL)
- Implement a `parse*JDBCURL` function with regex patterns matching the vendor's JDBC URL format
- Create a DSN builder function to translate components into the driver's native connection format
- Extend the main `buildDSN` dispatcher to route to your new builder

## Summary

- **Only Xugu and Oracle** are currently supported by DBX's JDBC plugin system
- Xugu uses `gitee.com/XuguDB/go-xugu-driver` with `parseXuguJDBCURL` in [`agents/drivers/xugu/main.go`](https://github.com/t8y2/dbx/blob/main/agents/drivers/xugu/main.go)
- Oracle uses `github.com/sijms/go-ora` with `parseOracleJDBCURL` in [`agents/drivers/oracle-go/main.go`](https://github.com/t8y2/dbx/blob/main/agents/drivers/oracle-go/main.go)
- Both drivers translate JDBC URLs to native DSNs through a three-step parsing and building process
- Non-JDBC connection strings fall back to raw DSN usage
- Extending support requires implementing parser and builder functions following the existing pattern

## Frequently Asked Questions

### Which JDBC URL formats does DBX support?

DBX currently supports `jdbc:xugu://<host>[:<port>]/<database>` for Xugu databases and both `jdbc:oracle:thin:@//<host>:<port>/<service>` (service name) and `jdbc:oracle:thin:@<host>:<port>:<SID>` (SID) formats for Oracle databases. These patterns are hardcoded in the respective parser functions within the driver implementations.

### Can I use PostgreSQL or MySQL with DBX's JDBC plugin?

No, PostgreSQL and MySQL are not currently supported by the JDBC plugin system. According to the t8y2/dbx source code, only Xugu and Oracle drivers implement the required `parse*JDBCURL` and DSN builder functions. Adding PostgreSQL support would require importing `github.com/lib/pq` and implementing the parsing interface found in the existing driver implementations.

### How does DBX handle non-JDBC connection strings?

If a connection string does not match a recognized JDBC URL pattern, DBX falls back to using the raw DSN supplied in `connectParams` or standard URL-style strings (such as `xugu://...` or Oracle's standard connection format). The JDBC translation layer only activates when the string begins with the `jdbc:` prefix and matches specific vendor patterns.

### Where is the JDBC parsing logic implemented in the DBX source code?

The JDBC parsing logic resides in [`agents/drivers/xugu/main.go`](https://github.com/t8y2/dbx/blob/main/agents/drivers/xugu/main.go) for Xugu (function `parseXuguJDBCURL`) and [`agents/drivers/oracle-go/main.go`](https://github.com/t8y2/dbx/blob/main/agents/drivers/oracle-go/main.go) for Oracle (function `parseOracleJDBCURL`). Both files contain accompanying unit tests in their respective [`main_test.go`](https://github.com/t8y2/dbx/blob/main/main_test.go) files that verify URL parsing and DSN construction accuracy.