Developer Guide: Code Assist MCP with JDBC

Build Java applications faster with AI-assisted development. This guide walks you through using CData Code Assist MCP with an AI coding tool like Cursor to generate production-ready Java code that connects to live data using CData JDBC Drivers.

Code Assist MCP provides schema-aware context to your AI coding assistant, enabling it to discover tables, columns, and data types from your actual data source. The AI generates accurate JDBC code that you can run in production using CData JDBC Drivers - no guessing, no hallucinated field names.

By the end of this guide, you'll have a working Java console application that:

  • Connects to Google Sheets using the CData JDBC Driver
  • Queries customer data using standard JDBC patterns
  • Displays results in a formatted table

Architecture Overview

Code Assist MCP bridges AI-assisted development with production-ready data access:

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│                 │     │                  │     │                 │
│  Cursor IDE     │────>│  Code Assist MCP │────>│  Google Sheets  │
│  (Development)  │     │  (Schema)        │     │  (Live Data)    │
│                 │<────│                  │<────│                 │
└─────────────────┘     └──────────────────┘     └─────────────────┘
        │
        │  Generated Java Code
        v
┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│                 │     │                  │     │                 │
│  Your Java App  │────>│  CData JDBC      │────>│  Google Sheets  │
│  (Production)   │     │  Driver          │     │  (Live Data)    │
│                 │<────│                  │<────│                 │
└─────────────────┘     └──────────────────┘     └─────────────────┘

How it works:

  1. Code Assist MCP connects to your data source and exposes schema information to Cursor
  2. Cursor's AI uses this context to generate accurate JDBC code with correct table and column names
  3. Your production application uses the CData JDBC Driver - same schema, same SQL syntax

Prerequisites

Before you begin, ensure the following are installed:


Step 1: Set Up Sample Data in Google Sheets

We'll use a sample Google Sheet containing sample CRM data to demonstrate the workflow.

  1. Navigate to the sample CRM spreadsheet
  2. Click File > Make a copy to save it to your Google Drive
  3. Give it a memorable name (e.g., "demo_organization") - you'll need this later

The spreadsheet contains four sheets:

  • account - Company information (Name, Industry, AnnualRevenue, NumberOfEmployees)
  • opportunity - Sales pipeline data (StageName, Amount, Probability, CloseDate)
  • tickets - Support cases (Subject, Priority, Status, CreatedAt)
  • usage - Product usage statistics (PRODUCT_GROUP, S_STANDARDJOBRUNS, S_RECORDSAFFECTED)

Step 2: Install and Configure Code Assist MCP

  1. Download and install the CData Code Assist MCP for Google Sheets
  2. Launch the Code Assist MCP configuration wizard after installation
  3. Create a new configuration and name it (e.g., "cdata-googlesheets")
  4. Configure your Google Sheets connection:
    • Click Connect to authenticate with Google via OAuth
    • After authentication, enter your spreadsheet name in the Spreadsheet field (e.g., "demo_organization")
    Google Sheets MCP connection configuration showing OAuth and Spreadsheet fields
  5. Click Save & Test to validate the connection Connection successful message with Next button highlighted

Step 3: Configure Cursor to Use Code Assist MCP

  1. After saving your connection, click Next in the configuration wizard
  2. Select Cursor from the AI MCP Tool dropdown AI MCP Tool dropdown with Cursor selected
  3. Follow the instructions to create the MCP configuration:
    • Create a .cursor folder in your project directory
    • Create a file named mcp.json inside the .cursor folder
    MCP Client Instructions showing file paths and Copy JSON button
  4. Click Copy JSON and paste the configuration into your mcp.json file
  5. Restart Cursor to load the new MCP configuration

Verify the MCP Connection

  1. In Cursor, press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette
  2. Type View: Open MCP Settings and select it
  3. Navigate to Tools & MCP in the settings Cursor Settings showing Tools & MCP in the sidebar
  4. Confirm your Code Assist MCP connection (e.g., "cdata-googlesheets") appears as Running under Installed MCP Servers Cursor MCP settings showing cdata-googlesheets connection as Running

Step 4: Install the CData JDBC Driver

The JDBC Driver will be used at runtime by your generated application.

  1. Download and install the CData JDBC Driver for Google Sheets
  2. During installation, enter your license key (or use TRIAL for a 30-day evaluation)
  3. Note the installation path - you'll need to add the JAR file to your project's classpath

Step 5: Build the Application with Cursor

  1. Create a new folder for your project and open it in Cursor
  2. Open Cursor's AI chat pane (click the chat icon or use the Toggle AI Pane command)
  3. First, ask Cursor to review the MCP connection instructions:
    Review the instructions for my cdata-googlesheets connection
    Cursor AI chat showing review of MCP connection instructions
  4. Once Cursor confirms it has the context, prompt it to build the application:
    Build a Java console application that connects to Google Sheets using the CData JDBC Driver. Query the "account" sheet and display all accounts with their Name, Industry, and AnnualRevenue in a formatted table. Use the schema from my cdata-googlesheets MCP connection. Store the connection string in an environment variable for security.
  5. Cursor will generate:
    • Java source code using proper JDBC patterns (Connection, Statement, ResultSet)
    • Correct table and column names based on the actual Google Sheets schema
    • A build configuration or instructions for compiling
    Cursor generating Java code with CData JDBC Driver

Step 6: Configure and Run the Application

  1. Set your connection string as an environment variable: set GOOGLESHEETS_CONN="jdbc:googlesheets:Spreadsheet=demo_organization;InitiateOAuth=GETANDREFRESH;"

    On macOS/Linux, use export instead of set

  2. Add the CData JDBC Driver JAR to your classpath. The JAR is typically located at: C:\Program Files\CData\CData JDBC Driver for Google Sheets\lib\cdata.jdbc.googlesheets.jar

    On macOS/Linux, the JAR is typically in /Applications/CData/ or /opt/cdata/.

  3. Compile and run the application: javac -cp ".;C:\Program Files\CData\CData JDBC Driver for Google Sheets\lib\cdata.jdbc.googlesheets.jar" GoogleSheetsApp.java java -cp ".;C:\Program Files\CData\CData JDBC Driver for Google Sheets\lib\cdata.jdbc.googlesheets.jar" GoogleSheetsApp

    On macOS/Linux, use : instead of ; as the classpath separator.

  4. The application will authenticate with Google (if needed) and display your account data

Example Output

Name                        Industry            AnnualRevenue
------------------------------------------------------------
Acme Corporation            Technology          2500000
Global Industries           Manufacturing       15000000
StartupCo                   Software            500000
Enterprise Inc              Finance             50000000

What's Next?

You've built a working Java application using AI-assisted development. The same pattern works for any of the hundreds of data sources supported by CData JDBC Drivers.

Try these next steps:

  • Add CRUD operations (Create, Update, Delete) to your application
  • Query multiple sheets and join data
  • Build a Spring Boot REST API with live data
  • Connect to a different data source like Salesforce or Jira

Troubleshooting

If you encounter issues, try these common solutions:

  • MCP not showing as "Running" in Cursor - Verify the mcp.json file is in the correct location (.cursor folder in your project root). Restart Cursor after adding or modifying the configuration.
  • OAuth authentication fails - Ensure pop-ups are enabled in your browser. Try clearing your browser cache or using a private/incognito window for the OAuth flow.
  • ClassNotFoundException for JDBC Driver - Verify the CData JAR file is included in your classpath. Check that the path to the JAR is correct and the file exists.
  • Connection string errors - Verify the spreadsheet name in your connection string matches exactly (case-sensitive) and that you have access to the spreadsheet in Google Drive.
  • AI generates incorrect column names - Ask Cursor to review the MCP connection instructions again before generating code. This refreshes the schema context.

JDBC Development with CData

CData Code Assist MCP and CData JDBC Drivers share the same data model, so the SQL you validate during development works identically in production. This eliminates the disconnect between AI-generated code and real-world data access.

Code Assist MCP works with any AI model supported by your coding tool - it's model agnostic. Whether you're using GPT-4, Claude, or another model in Cursor, the MCP provides the same accurate schema context.

Ready to accelerate your Java development? Download Code Assist MCP for Google Sheets for free and get a free trial of the CData JDBC Driver for Google Sheets to get started.