Quick Start¶
Get up and running with General SQL Parser in just a few minutes! This guide will walk you through installation, basic setup, and your first SQL parsing example.
Prerequisites¶
- Java 8 or higher (Java 11+ recommended)
- Maven or Gradle for dependency management
- IDE (IntelliJ IDEA, Eclipse, or VS Code recommended)
Installation¶
General SQL Parser is published to Gudu Software's public Maven repository at https://www.sqlparser.com/maven/. Add the repository and a single dependency to your build — nothing to download, install, or configure locally.
The public Maven artifact is the trial build
The artifact at com.gudusoft:gsqlparser is the trial edition of
General SQL Parser. It is fully functional for evaluation and covers every
example on this page. Commercial builds may carry newer fixes and use a more
specific four-part version. See the licensing FAQ before production
use. The public Maven version is a three-part number (for example 4.1.6)
and does not necessarily match the four-part product version shown in the
release notes.
Maven¶
A complete, minimal pom.xml — copy it into an empty directory and it builds
on Java 8 through the latest LTS:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
Create your class at src/main/java/QuickStartExample.java (see
Your First SQL Parser below), then compile and run
in one step:
1 | |
That's it — Maven downloads gsqlparser-4.1.6.jar from
https://www.sqlparser.com/maven/com/gudusoft/gsqlparser/4.1.6/ into your
local ~/.m2/ cache on first build.
Data lineage on Java 11+
The DataFlowAnalyzer (data-lineage) APIs generate XML through JAXB, which
was removed from the JDK in Java 11. As of 4.1.6 the published POM declares
the JAXB runtime, so lineage works on Java 11+ with only the GSP dependency —
no extra setup. On Java 8 the JDK-bundled JAXB is used.
Gradle¶
A complete build.gradle.kts (Kotlin DSL). The application plugin supplies
the implementation configuration and a run task:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
Create your class at src/main/java/QuickStartExample.java (see
Your First SQL Parser below), then build and run with
the installed Gradle (listed in the prerequisites):
1 | |
Using the Gradle wrapper
An empty project has no gradlew wrapper script yet. Generate one first with
gradle wrapper, after which you can use ./gradlew clean run
(gradlew.bat clean run on Windows) for a version-pinned, reproducible build.
Latest version
The current release is 4.1.6. You can always check the latest version
by viewing
maven-metadata.xml.
Maven coordinates are write-once — once a version is published it never
changes, so it's safe to pin any specific release.
Running your program¶
The complete pom.xml above already includes the exec-maven-plugin, so once
you've created QuickStartExample.java you can compile and run in one command:
1 | |
To run a different class, change the plugin's <mainClass> (or override it on
the command line with -Dexec.mainClass=YourClass).
Offline / air-gapped installs¶
If your build environment cannot reach the internet, you must transfer the
complete dependency closure — not just the GSP JAR. Since 4.1.6 declares
JAXB (which lives on Maven Central), installing only the GSP JAR and POM is not
enough: Maven would still try to fetch jakarta.xml.bind-api, jaxb-runtime,
and the build/exec plugins from a remote repository.
The reliable approach is to build a portable local repository on a
connected machine and transfer it whole. Prime it by running the actual build
commands once — this captures the exact plugin + dependency closure the build
uses. (dependency:go-offline is not sufficient here: it misses some
default-lifecycle plugin dependencies and the build still fails offline.)
On a machine with internet access — using the complete pom.xml and
QuickStartExample.java from the sections above:
1 2 3 4 5 | |
Transfer the project directory and the offline-m2/ folder to the
air-gapped host, then run the same offline command there:
1 | |
Verifying artifact integrity
The published JAR checksum can be checked against the download:
1 2 | |
Your First SQL Parser¶
Let's create a simple example that parses a SQL statement:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
Expected Output¶
1 2 3 | |
Database Vendor Support¶
General SQL Parser supports 30+ database vendors. Here are some common examples:
1 2 | |
1 2 | |
1 2 | |
1 2 | |
1 2 | |
Common Use Cases¶
1. SQL Syntax Validation¶
parse() == 0 confirms the SQL is syntactically valid for the selected
dialect. It does not check that the referenced tables/columns exist, that
types are compatible, or that the statement would execute — catalog-aware
validation requires metadata and the resolver APIs.
1 2 3 4 5 | |
2. Extract Table Names¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
3. Format SQL¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Error Handling¶
Always handle parsing errors gracefully:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Next Steps¶
Now that you have General SQL Parser running, explore these areas:
Continue Learning
- Getting Started with GSP - Comprehensive tutorial
- Basic SQL Parsing - Learn parsing fundamentals
- Working with Different Databases - Multi-vendor support
- Performance Optimization - Speed up your parsing
- Error Handling - Robust error management
- Parse Oracle PL/SQL - Advanced Oracle features
- API Documentation - Complete API reference
- SQL Syntax Support - Supported SQL features
- Configuration Options - Parser configuration
Troubleshooting¶
Common Issues¶
Parse Error: Unexpected token
Solution: Check that you're using the correct database vendor. SQL syntax varies between databases.
1 2 3 4 5 6 7 | |
ClassNotFoundException
Solution: Ensure the GSQLParser JAR is in your classpath and all dependencies are included.
OutOfMemoryError
Solution: For large SQL files, consider parsing statements individually or increase JVM heap size.
Getting Help¶
- 📖 Check our FAQ for common questions
- 💬 Visit our Support page for community help
- 📧 Contact technical support for commercial licenses
Ready for more advanced features? Continue with our comprehensive tutorials or explore specific how-to guides.