A lightweight HTTP service that provides JDBC database access through HTTP endpoints.
- Download the latest JAR file from releases
- Run the JAR file:
java -jar jdbc-adapter-server-1.0-all.jar
- The HTTP API will be available on port 7823
Endpoint | Description |
---|---|
connect | Establish a database connection using JDBC URL |
alive | Verify connection status |
execute | Execute SQL queries |
cancel | Cancel ongoing SQL execution |
close | Close database connection |
POST http://127.0.0.1:7823/connect
Content-Type: application/json
{
"jdbcUrl": "jdbc:mysql://localhost:3306/test",
"driver": "com.mysql.cj.jdbc.Driver",
"driverPath": "D:/mysql-connector-java-8.0.29.jar",
"username": "root",
"password": "root",
"readonly": false,
"id": "mysql-connection"
}
Parameter | Required | Type | Description |
---|---|---|---|
id | ✅ | String | Unique identifier for the connection |
jdbcUrl | ✅ | String | JDBC connection URL |
driverPath | ✅ | String | Path to JDBC driver (supports JAR, directory, or archive) |
driver | ❌ | String | JDBC driver class name |
username | ❌ | String | Database username |
password | ❌ | String | Database password |
readonly | ❌ | Boolean | Enable read-only mode |
POST http://127.0.0.1:7823/alive
Content-Type: application/json
{
"id": "mysql-connection"
}
POST http://127.0.0.1:7823/execute
Content-Type: application/json
{
"id": "mysql-connection",
"sql": "select * from mysql.user where user=?",
"params": [{"value": "root"}],
"sqlList": ["select * from mysql.user","select * from mysql.user"]
}
sql
: SQL query to executeparams
: Query parameters in format[{"value": "value1"}, {"value": "value2"}]
sqlList
: Batch SQL queries to execute (takes precedence oversql
parameter)
POST http://127.0.0.1:7823/cancel
Content-Type: application/json
{
"id": "mysql-connection"
}
POST http://127.0.0.1:7823/close
Content-Type: application/json
{
"id": "mysql-connection"
}
To build the project, run:
gradle fatJar