Zero data migration required. CUBRID's JDBC driver and Python driver (
pycubrid) use the same CAS broker protocol — your database, schema, and data stay exactly as-is.
| Dimension | Java (JDBC) | Python (pycubrid) | Python (SQLAlchemy) |
|---|---|---|---|
| Connection setup | 8–12 lines | 4 lines | 3 lines |
| CRUD (full cycle) | ~60 lines | ~25 lines | ~20 lines |
| Batch insert 1K rows | ~30 lines | 3 lines (executemany) |
2 lines (add_all) |
| Transaction handling | Manual try/catch/finally | with context manager |
Session auto-rollback |
| Error handling | Checked exceptions | Python exceptions | SQLAlchemy exceptions |
| ORM integration | JPA/Hibernate (complex) | SQLAlchemy (simple) | Built-in |
Java JDBC pycubrid SQLAlchemy
Connection 12 4 3
Single INSERT 8 3 2
SELECT + iterate 15 5 4
Transaction block 20 6 5
Batch INSERT (1K rows) 30 3 2
─────────────────────────────────────────────────────────
Total 85 21 16
Reduction — 75% 81%
Our benchmark results show pycubrid performs well after recent optimizations:
- SELECT 10K rows: 78ms total (fetch + parse)
- Connection: 1.7ms
- Single INSERT + COMMIT: ~55ms (COMMIT is the dominant cost at ~47ms)
COMMIT is 7× more expensive than INSERT execute. Batch your writes!
| File | What You'll Learn |
|---|---|
| 01_connection.py | Connection patterns — JDBC DriverManager → pycubrid connect() |
| 02_crud_dbapi.py | CRUD with raw DB-API — PreparedStatement → parameterized queries |
| 03_crud_orm.py | CRUD with SQLAlchemy ORM — JPA Entity → Mapped class |
| 04_transaction.py | Transaction patterns — try/catch/finally → with blocks |
| 05_batch_operations.py | Batch operations — addBatch/executeBatch → executemany |
- Install Python dependencies:
pip install -r requirements.txt - Replace JDBC connection strings with pycubrid
connect()calls - Replace
PreparedStatementwith parameterizedcursor.execute(sql, params) - Replace
ResultSetiteration withfetchall()/fetchone()/fetchmany() - Replace try/catch/finally with Python
withblocks or try/except/finally - Replace
addBatch/executeBatchwithcursor.executemany() - Replace JPA entities with SQLAlchemy models (optional — pycubrid works fine standalone)
- Update CI/CD pipeline (Maven/Gradle → pip/Poetry)
- Run existing SQL queries unchanged — CUBRID SQL syntax is identical regardless of driver
- Parameter markers: JDBC uses
?— pycubrid also uses?(same!) - Auto-commit: JDBC defaults to auto-commit ON — pycubrid defaults to auto-commit OFF
- Resource cleanup: JDBC requires explicit
close()in finally — Python haswithstatements - Null handling: JDBC
wasNull()pattern — Python returnsNonenaturally - Type mapping: Java types map cleanly to Python types (see table below)
| CUBRID Type | Java Type | Python Type |
|---|---|---|
| INT | int |
int |
| BIGINT | long |
int |
| DOUBLE / FLOAT | double |
float |
| VARCHAR / CHAR | String |
str |
| DATE | java.sql.Date |
datetime.date |
| TIME | java.sql.Time |
datetime.time |
| TIMESTAMP | java.sql.Timestamp |
datetime.datetime |
| BLOB / CLOB | Blob / Clob |
bytes / str |
| NULL | null + wasNull() |
None |