docs: add multi-language client specification#448
Conversation
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/1bb8d149-8b3d-47d0-9f4c-763af9cd2c78 Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
rrobetti
left a comment
There was a problem hiding this comment.
Now I want you to link where in the OJP JDBC driver each of these parts are implemented exactly, you don't need to copy code just point to the most relevant classes and methods.
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/da435d87-9c75-4844-b379-03cf974f166f Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Done in d86de06. Every section (§1–§26) now has a
Links use relative paths from the spec file to the source files in the repo. |
|
@copilot there were some recent PR, yesterday and today to fix the way we recognize that an ojp server is down and to rebalance pools, review if that impacts the documentation of this specification |
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/3bdf2786-d9ee-4f1b-a09a-a5b069f4f53f Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Reviewed PRs #442–#449. Five spec sections were out of date — updated in bd1c1bd: §8 Failover
§9 Health Checking
§10 Connection Redistribution
§11 Cluster Health Propagation
§21 Error Mapping
|
|
|
||
| --- | ||
|
|
||
| ## 2. URL Parsing |
There was a problem hiding this comment.
@copilot here you need to remember that in other languages the connection URL will probably not be the JDBC url, so focus on how to assamble the connection details to send to server, not how to parse JDBC URL, remove how to parse JDBC URL.
There was a problem hiding this comment.
Done in 35ae38f. §2 has been completely rewritten as "Connection Configuration and Building ConnectionDetails". The JDBC URL format and parsing rules are gone. The section now:
- Lists the four pieces of configuration a non-Java client collects from the user (OJP server endpoints, datasource name, actual database URL, credentials, optional properties)
- Maps each to the corresponding
ConnectionDetailsproto field in a table - Documents the server-side
connHashcomputation (SHA-256 ofurl + user + password + datasource_name) and the client-side cache key formula so implementors know what must be consistent across clients - Keeps a reference to
MultinodeUrlParsersolely as a Java-specific note at the end of the reference block, making clear it is not needed in non-Java clients
rrobetti
left a comment
There was a problem hiding this comment.
@copilot I want you to enrish each part that interacts with OJP server with a pseudo code example of how to create the grpc request and what is expected in the response. This should be for guiding purposes, not verbose, it does not to be fully acurate but it does have to be clear and easy to understand by a mid level developer.
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/5c0e63ee-e3db-4996-842d-9aaff69c6cab Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…s in CLIENT_SPEC.md Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/759120cb-e3cf-4e95-9329-aacb037ad0b7 Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Done in 11300c6. Every section that calls a gRPC RPC now has a
Also reframed two JDBC-centric sections: §12 now describes the transaction lifecycle in terms of the three RPCs (not autoCommit), and §15 now describes SQL execution in terms of parameterless SQL / parameterized SQL / stored-procedure calls (not Plain/Prepared/Callable Statement). |
rrobetti
left a comment
There was a problem hiding this comment.
You are working on the following file:
documents/multi-language-client-spec/CLIENT_SPEC.md
Your task has TWO parts:
PART 1 — Improve the EXISTING document (for human readers)
Refactor the current document in place to make it clearer, easier to read, and more useful for developers implementing a client.
Goals
Improve readability and flow
Reduce ambiguity
Make concepts easier to understand
Keep all existing technical meaning intact
Rules
DO NOT remove important technical content
DO NOT introduce new features or behavior
DO NOT change the intent of the specification
You MAY reorganize, rewrite, and clarify
Prefer clear paragraphs over excessive bullet points
Avoid overly dense sections
Required Changes
- Restructure the document
Reorganize the content into this structure:
Overview
Core Concepts
Architecture Flow
Client Responsibilities
Lifecycle Walkthrough
Error Handling (high-level)
Minimal Example (pseudo-code)
Implementation Guidance
2. Clarify key concepts
Make these concepts explicitly explained in simple terms:
Virtual connections
Deferred execution (real DB connection only on execution)
Session affinity
Client vs server responsibilities
3. Improve flow
Ensure sections follow a logical progression
Avoid jumping between abstraction levels
Add short transitions between sections where needed
4. Add a simple end-to-end example
Include a language-neutral pseudo-code example:
connect
prepare
execute
close
Keep it simple and readable
- Reduce ambiguity
Where behavior is unclear:
Rewrite to be more explicit
Avoid vague wording like “may”, “typically”, “usually” unless intentional
6. Keep it developer-friendly
Write as if explaining to an experienced engineer new to OJP
Avoid protocol-level deep detail (this will go in the AI spec)
PART 2 — Create a NEW AI-oriented specification
Create a NEW file:
documents/multi-language-client-spec/CLIENT_SPEC_AI.md
This document must be machine-oriented and unambiguous, suitable for code generation tools.
Requirements for the new file
Use strict, formal language
Use RFC-style keywords:
MUST
MUST NOT
SHOULD
MAY
Avoid narrative explanations
Prefer structured definitions
Structure of CLIENT_SPEC_AI.md
- Terminology
Define all important terms precisely
- State Machine (MANDATORY)
Define:
All states
All transitions
Invalid transitions and expected behavior
3. Protocol Model
Define request/response structures in a language-agnostic way:
Example:
ExecuteRequest:
connectionId: string
sql: string
parameters: list
options: map
4. Client Contract
Define:
When connections are created
When real DB connections are acquired
Execution behavior rules
5. Concurrency Model
Define:
Thread safety expectations
Whether concurrent execution is allowed
Ordering guarantees
6. Error Handling & Retry Semantics
Define:
Retry rules
Timeout behavior
Connection invalidation
7. Session & Affinity Rules
Define:
When affinity is required
How it is maintained
8. Versioning & Compatibility
Define:
Version handling expectations
Backward compatibility rules
9. Compliance Requirements
Define what a valid client MUST implement
- Action → Protocol Mapping
Map high-level operations to protocol calls:
Example:
connect() → CreateConnectionRequest
prepare(sql) → PrepareStatementRequest
execute() → ExecuteRequest
Final Notes
Ensure both documents are consistent with each other
The human document explains concepts clearly
The AI document defines exact behavior with no ambiguity
Do not duplicate unnecessary text between the two files
…s in CLIENT_SPEC.md Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/f769d13a-bbd8-4dbc-a3e1-f8f1395a1bf7 Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/6a131905-98ee-408b-8155-88759641e1c0 Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…oncepts, E2E Example, and pseudo-code Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/99757170-ee53-49e9-9a5e-32a90c8c917b Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
rrobetti
left a comment
There was a problem hiding this comment.
Avoid termso like "in the server's HikariCP pool", OJP supports other pools via SPI.
…wording in spec files Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/9a44563c-e1eb-4652-8136-ff1bd686aa0c Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Fixed in 045e484. All four pool-specific "HikariCP pool" phrases in |
rrobetti
left a comment
There was a problem hiding this comment.
Check if latest commits require update on these docs in these PRs. Just double check, I don't believe they do.
Reviewed all commits merged to
The docs are current. |
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/cc5ba102-9987-42f1-a067-4115fdc99a09 Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/94f6dc15-c840-48b2-ae8c-a7d2cdcf087c Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
|
@copilot add this information.
|
Agent-Logs-Url: https://github.com/Open-J-Proxy/ojp/sessions/75e175b5-0175-4c88-bfe3-b40c8cb465ab Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
|



Adds and iteratively improves the multi-language client specification documents for OJP.
Changes Made
Last updated: 2026-04-30note toCLIENT_SPEC.mdandCLIENT_SPEC_AI.mdConnectionDetails" to be language-agnostic (removed JDBC URL parsing)CLIENT_SPEC.mdfor readability: Overview, Core Concepts, Architecture Flow, Client Responsibilities, Lifecycle Walkthrough, Error Handling, Minimal Example, Implementation GuidanceCLIENT_SPEC_AI.mdwith RFC-style keywords, state machine, protocol model, concurrency model, error/retry semantics, session affinity rules, versioning, compliance requirements, and action→protocol mappingCLIENT_SPEC.mdmapping Go, Python, C#/.NET, C++, Node.js, Ruby, PHP, and Dart to their respective standard database-access APIs