Database Operations Using ODBC Driver
Defining a Data Source
Before you can use the NuoDB ODBC driver to connect to a NuoDB database, you must define an ODBC data source for the database. In the following steps, as an example, we use the NuoDB SQL QuickStart database as an example. The database name is test
and it is assumed to be running on the current localhost
with the default port of 48004, user dba
, password goalie
. For more information about running QuickStart see Running the SQL QuickStart. To define the QuickStart data source, follow these steps:
-
From the Start menu, search for ODBC in the textbox.
-
In the search results, click Data Sources (ODBC).
-
Click Add which will bring up the Create New Data Source dialog.
-
In the Create New Data Source dialog, select NuoDB ODBC Driver from the list of drivers.
-
Click Finish to bring up the NuoDB ODBC Setup dialog.
-
In the NuoDB ODBC Setup dialog, define the data source as specified in the table below.
Field Description Data Source Name (DSN)
Data source name.
Description
Optional.
Database
database name@hostname
User
User name for accessing the database.
Password
Password for accessing the database.
Schema
Optional. The default schema is
USER
For example, here’s the completed dialog for the QuickStart database running on
localhost
. -
Click Test Connection to verify your connection to the NuoDB database.
-
Click OK to close the dialogs.
Accessing the Data Source
We need an ODBC client to access the Data Source we just created. A good sample one is available on MSDN at ODBC sample. This can be downloaded and built on your machine. The output below uses the MSDN sample program.
Running this ODBC client will pop up the Select Data Source dialog.
Select the Machine Data Source tab, and you should see your newly created Data Source.
Select the NuoDB QuickStart data source and then OK. This will put you at a SQL COMMAND>
prompt. Enter any SQL command, for example, "SELECT * FROM HOCKEY.PLAYERS;":