CONNECTING TO CRATE WITH ODBC

WHAT is ODBC?

Open Database Connectivity (ODBC) is an API developed by Microsoft to provide an abstraction layer for database access. As part of the Enterprise license Crate provides a proprietary ODBC driver to integrate existing applications and make it a first-class citizen in the Crate’s eco-system.

To obtain a free trial license of the ODBC driver, a license agreement is necessary. After signing, our team will send you the driver package. Sign the trial license agreement here with Hellosign.

Screenshot shows Tableau connected to a Crate cluster

What Can the ODBC Driver Do?

  • Provide a native client library for working with Crate on Windows
  • Enable existing ODBC-suported applications to connect with Crate, such as Tableau, Pentaho and Microsoft Office
  • Use one of the many database tools for ODBC to manage a Crate cluster
  • Use the full power of the .NET platform and Crate to create enterprise ready applications.

Example

Accessing Crate via ODBC follows well-established patterns and only takes a few lines of code.

For example this snippet lists all available nodes including their IDs:

// open connection and prepare statement

conn.Open();

OdbcCommand cmd = conn.CreateCommand();

cmd.CommandText = “SELECT id, name FROM sys.nodes ORDER BY id”;

// create a “cursor” and a row placeholder to populate OdbcDataReader dbReader = cmd.ExecuteReader();

Object[] row = new Object[dbReader.FieldCount];

// read from Crate

while (dbReader.Read()) {

 dbReader.GetValues(row);

 // do stuff

}