Skip navigation links

Package com.mckoi.database.jdbc

The JDBC interface to Mckoi.

See: Description

Package com.mckoi.database.jdbc Description

The JDBC interface to Mckoi.

Establishing a Connection

An application establishes a JDBC Connection by calling java.sql.DriverManager.getConnection(String url, Properties info). DriverManager.getConnection calls java.sql.Driver.connect, which figures out that the URL is a Mckoi URL, so calls com.mckoi.database.jdbc.MDriver, which was registered by a static initializer in com.mckoi.JDBCDriver.

If the URL is local (embedded mode), MDriver creates an instance of com.mckoi.database.jdbcserver.LocalDatabaseInterface, which in turns creates and wraps up an instance of com.mckoi.database.jdbcserver.JDBCDatabaseInterface, and calls its connectToJVM method to initialize it.

If the URL is remote (client/server mode), MDriver creates an instance of TCPStreamDatabaseInterface and calls its connectToDatabase method in order to establish a TCP connection to the Mckoi database server. For more information on how the server handles connections, see the package com.mckoi.database.jdbcserver.

In either case, the resulting DatabaseInterface is wrapped up in a MConnection, and returned to the application as an instance of java.sql.Connection.

Executing a Query

When an application calls java.sql.Connection.createStatement() on its MConnection, it gets back an instance of MStatement, which carries a pointer to the MConnection.

When the application calls java.sql.Statement.executeQuery(String) on its MStatement, Mckoi creates an SQLQuery from the String, creates an empty MResultSet, then calls MStatement.executeQuery with those two objects. MStatement.executeQuery turns around and calls Mconnection.executeQuery, which calls execQuery on its DatabaseInterface. Depending on whether the connection is local or remote, this call is either to com.mckoi.database.jdbcserver.LocalDatabaseInterface.execQuery for local connections, or to RemoteDatabaseInterface.execQuery for remote connections. These are described more fully in the package description for com.mckoi.database.jdbcserver under Local Queries and Remote Queries.

Skip navigation links

Copyright © 2015. All rights reserved.