VOOZH about

URL: https://www.cdata.com/kb/tech/csv-jdbc-intellij.rst

⇱ How to connect to CSV Data from IntelliJ


How to connect to CSV Data from IntelliJ

👁 Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Integrate connectivity to CSV data with wizards in IntelliJ.

The CData JDBC Driver for CSV enables you to access CSV as a JDBC data source, providing integration with rapid development tools in IDEs. This article shows how to use the data source configuration wizard to connect to CSV data in IntelliJ.

Create a JBDC Data Source for CSV

Follow the steps below to add the driver JAR and define connection properties required to connect to CSV data.

  1. In the Data Sources window, right-click and then click Add Data Source -> DB Data Source.
  2. In the Data Source Properties dialog that appears, the following properties are required:

    • JDBC Driver Files: Click the button next to this menu to add the JDBC Driver file cdata.jdbc.csv.jar, located in the installation directory.
    • JDBC Driver Class: In this menu, select cdata.jdbc.csv.CSVDriver from the list.
    • Database URL: Enter the connection URL in the JDBC URL property. The URL must start with jdbc:csv: and includes connection properties separated with semicolons.

      Connecting to Local or Cloud-Stored (Box, Google Drive, Amazon S3, SharePoint) CSV Files

      CData Drivers let you work with CSV files stored locally and stored in cloud storage services like Box, Amazon S3, Google Drive, or SharePoint, right where they are.

      Setting connection properties for local files

      Set the URI property to local folder path.

      Setting connection properties for files stored in Amazon S3

      To connect to CSV file(s) within Amazon S3, set the URI property to the URI of the Bucket and Folder where the intended CSV files exist. In addition, at least set these properties:

      • AWSAccessKey: AWS Access Key (username)
      • AWSSecretKey: AWS Secret Key

      Setting connection properties for files stored in Box

      To connect to CSV file(s) within Box, set the URI property to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect to Box.

      Dropbox

      To connect to CSV file(s) within Dropbox, set the URI proprerty to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect to Dropbox. Either User Account or Service Account can be used to authenticate.

      SharePoint Online (SOAP)

      To connect to CSV file(s) within SharePoint with SOAP Schema, set the URI proprerty to the URI of the document library that includes the intended CSV file. Set User, Password, and StorageBaseURL.

      SharePoint Online REST

      To connect to CSV file(s) within SharePoint with REST Schema, set the URI proprerty to the URI of the document library that includes the intended CSV file. StorageBaseURL is optional. If not set, the driver will use the root drive. OAuth is used to authenticate.

      Google Drive

      To connect to CSV file(s) within Google Drive, set the URI property to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect and set InitiateOAuth to GETANDREFRESH.

      Built-in Connection String Designer

      For assistance in constructing the JDBC URL, use the connection string designer built into the CSV JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

      java -jar cdata.jdbc.csv.jar
      

      Fill in the connection properties and copy the connection string to the clipboard.

      👁 Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)

      A typical JDBC URL is the following:

      jdbc:csv:URI=/PATH/TO/MyCSVFilesFolder;
👁 The JDBC data source. (Salesforce is shown.)

Edit and Save CSV Data

To discover schema information, right-click the data source you just created and click Refresh Tables. To query a table, right-click it and then click Open Tables Editor.

👁 The results of a query in IntelliJ. (Salesforce is shown.)

Ready to get started?

Download a free trial of the CSV Driver to get started:

 Download Now

Learn more:

👁 CSV/TSV Files Icon
CSV JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with delimited flat-file (CSV/TSV) data.