You are here: Client Development > Using the NuoDB ODBC Driver > Database Operations Using ODBC Driver

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:

  1. From the Start menu, search for ODBC in the textbox.
  2. In the search results, click Data Sources (ODBC).
  3. Click Add which will bring up the Create New Data Source dialog.
  4. In the Create New Data Source dialog, select NuoDB ODBC Driver from the list of drivers.

  5. Click Finish to bring up the NuoDB ODBC Setup dialog.
  6. In the NuoDB ODBC Setup dialog, define the data source as specified in the table below.
    FieldDescription
    Data Source Name (DSN)Data source name.
    DescriptionOptional.
    Databasedatabase name@hostname
    UserUser name for accessing the database.
    PasswordPassword for accessing the database.
    SchemaOptional. The default schema is USER

    For example, here's the completed dialog for the QuickStart database running on localhost.

  7. Click Test Connection to verify your connection to the NuoDB database.
  8. 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;":