OceanBase SQL Parser for Java
General SQL Parser (GSP) parses OceanBase with a dedicated, hand-tuned grammar — full AST access, offline syntax validation, formatting, rewriting, and column-level data lineage, including complete procedural SQL support. One commercial SDK — OceanBase is available in the Java edition.
OceanBase SQL that GSP parses
CREATE TABLEGROUP tg_orders
PRIMARY_ZONE = 'zone1',
LOCALITY = 'F@zone1,F@zone2,F@zone3',
BINDING = TRUE
PARTITION BY HASH PARTITIONS 8; Parse it in Java
import gudusoft.gsqlparser.*;
TGSqlParser parser = new TGSqlParser(EDbVendor.dbvoceanbase);
parser.sqltext = sql; // the OceanBase SQL above
if (parser.parse() == 0) {
System.out.println(parser.sqlstatements.size() + " statement(s) parsed");
} else {
System.out.println(parser.getErrormessage());
} Java edition only. The .NET library has no OceanBase grammar, so this dialect cannot be parsed from C# or VB.NET. See the .NET SQL Parser SDK for the dialects it does cover.
What GSP handles in OceanBase
- Three tenant parser modes — MySQL, Oracle, and system (sys) — selected per parser instance
- Multi-tenant DDL: CREATE / ALTER / DROP TENANT, resource pools, and resource units
- Tablegroups with hash, key, range-columns, and list-columns partitioning and subpartitions
- The ALTER SYSTEM family — switch replica, bootstrap, restore, minor freeze, zone and server management
- XA transactions in MySQL mode
- FLASHBACK TENANT, PURGE, and recyclebin SHOW extensions
- Procedural SQL: OceanBase Oracle-mode PL/SQL — packages, anonymous blocks, and PL/SQL routines via a dedicated Oracle-mode parser (MySQL and system tenant modes are SQL-only)
Beyond parsing, the same AST powers table/column extraction, validation, formatting, and column-level lineage for OceanBase.
Recent OceanBase parser updates
- 2026-06-11 [OceanBase] Add Q-quote regression test for Oracle mode
- 2026-04-14 [OceanBase] Support SWITCH REPLICA LEADER SERVER/TENANT options
- 2026-04-14 [OceanBase] Support ALTER SYSTEM ADD ZONE IDC/ZONE_TYPE options
Full history in the release notes.
OceanBase resources
- Java quick start — Maven/Gradle setup and first parse
Common questions
Does GSP parse OceanBase stored procedures and procedural SQL?
Yes. GSP parses OceanBase Oracle-mode PL/SQL — packages, anonymous blocks, and PL/SQL routines via a dedicated Oracle-mode parser (MySQL and system tenant modes are SQL-only) into a full AST — procedure bodies become real statement trees you can traverse, not opaque text blocks. This is what makes lineage and impact analysis work inside procedural code.
Do I need a live OceanBase database connection to validate SQL?
No. GSP validates OceanBase syntax completely offline. You get error line and column positions, the offending token, and a hint — with no server, driver, or credentials involved.
Can I use the OceanBase parser from C# / .NET?
Not currently. OceanBase is a Java-edition dialect — the .NET library ships 15 dedicated grammars and OceanBase is not one of them, so there is no C# code path for it. Everything else on this page describes the Java SDK. If you need OceanBase in .NET, email info@sqlparser.com; customer demand is how dialects get prioritized for the .NET port.
Can GSP extract column-level lineage from OceanBase SQL?
Yes. The built-in DataFlowAnalyzer produces column-level lineage, impact analysis, and call graphs from OceanBase scripts — it is the engine behind Gudu SQLFlow and the lineage integrations for DataHub and OpenMetadata.