Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Connect Relational Databases

Connect Zingg to MySQL, PostgreSQL, SQL Server, DB2, MariaDB, and Oracle via JDBC.

Zingg connects to relational databases using the JDBC connector. This covers any JDBC-compatible database including MySQL, PostgreSQL, SQL Server, DB2, MariaDB, and Oracle. Available in all editions.

Download the JDBC driver for your database and add to zingg.conf.

spark.jars=<location of jdbc driver jar>

Python API

from zingg.client import*
from zingg.pipes import*

jdbcPipe =
Pipe("pgInput", "jdbc")
jdbcPipe.addProperty("url", "jdbc:postgresql://localhost:5432/dbname")
jdbcPipe.addProperty("dbtable", "your_table")
jdbcPipe.addProperty("driver", "org.postgresql.Driver")
jdbcPipe.addProperty("user", "postgres")
jdbcPipe.addProperty("password", "your_password")
args.setData(jdbcPipe)

JSON Config

{
  "data" : [ {
    "name" : "test",
    "format" : "jdbc",
    "props" : {
      "url" : "jdbc:postgresql://localhost:5432/<db_name>",
      "dbtable" : "<testData>",
      "driver" : "org.postgresql.Driver",
      "user" : "<postgres>",
      "password" : "<postgres>"
    }
  } ]
}

Python API

JSON Config

SQL Server, DB2, MariaDB, Oracle and other JDBC databases

For any JDBC-compatible database, use the same pattern as PostgreSQL. Change two things only:

  1. The url format for that database

  2. The driver class name

Common driver class names and URL formats:

  • SQL Server:

    • url: jdbc:sqlserver://host:1433;databaseName=dbname

    • driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

  • MySQL:

    • url: jdbc:mysql://host:3306/dbname

    • driver: com.mysql.cj.jdbc.Driver

  • DB2:

    • url: jdbc:db2://host:50000/dbname

    • driver: com.ibm.db2.jcc.DB2Driver

  • MariaDB:

    • url: jdbc:mariadb://host:3306/dbname

    • driver: org.mariadb.jdbc.Driver

  • Oracle:

    • url: jdbc:oracle:thin:@host:1521:dbname

    • driver: oracle.jdbc.OracleDriver

Download the JDBC driver JAR from the database vendor and add it to spark.jars in zingg.conf before running.

Last updated

Was this helpful?