• Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Snowflake JDBC Driver

Snowflake JDBC Driver

https://github.com/snowflakedb/snowflake-jdbc/workflows/Build%20and%20Test/badge.svg?branch=master https://maven-badges.herokuapp.com/maven-central/net.snowflake/snowflake-jdbc/badge.svg?style=plastic

Snowflake provides a JDBC type 4 driver that supports core functionality, allowing Java program to connect to Snowflake.

Prerequisites

The Snowflake JDBC driver requires Java 1.8 or higher. If the minimum required version of Java is not installed on the client machines where the JDBC driver is installed, you must install either Oracle Java or OpenJDK.

Installation

Maven

Add following code block as a dependency

<dependency>
  <groupId>net.snowflake</groupId>
  <artifactId>snowflake-jdbc</artifactId>
  <version>{version}</version>
</dependency>

Build from Source Code

  1. Checkout source code from Github by running:
git clone https://github.com/snowflakedb/snowflake-jdbc.git
  1. Build the driver by running:
mvn install

Usage

Load Driver Class

Class.forName("net.snowflake.client.jdbc.SnowflakeDriver")

Datasource

javax.sql.DataSource interface is implemented by class

net.snowflake.client.jdbc.SnowflakeBasicDataSource

Connection String

US(West) Region:

jdbc:snowflake://<account>.snowflakecomputing.com/?<connection_params>

EU(Frankfurt) Region:

jdbc:snowflake://<account>.eu-central-1.snowflakecomputing.com/?<connection_params>

Documentation

For detailed documentation, please refer to https://docs.snowflake.net/manuals/user-guide/jdbc.html

Development

Run the maven command to check the coding style.

mvn -P check-style verify

Follow the instruction if any error occurs or run this command to fix the formats.

mvn com.coveo:fmt-maven-plugin:format

You may import the coding style from IntelliJ so that the coding style can be applied on IDE:

  • In the File -> Settings/Plugins, and install google-java-format plugin.
  • Enable google-java-format for the JDBC project.
  • In the source code window, select Code -> Reformat to apply the coding style.

Tests

Run Tests

Set the environment variables to specify the target database.

export SNOWFLAKE_TEST_HOST=<your_host>
export SNOWFLAKE_TEST_ACCOUNT=<your_account>
export SNOWFLAKE_TEST_USER=<your_user>
export SNOWFLAKE_TEST_PASSWORD=<your_password>
export SNOWFLAKE_TEST_DATABASE=<your_database>
export SNOWFLAKE_TEST_SCHEMA=<your_schema>
export SNOWFLAKE_TEST_WAREHOUSE=<your_warehouse>
export SNOWFLAKE_TEST_ROLE=<your_role>

Run the maven verify goal.

mvn -DjenkinsIT -DtestCategory=net.snowflake.client.category.<category> verify

where category is the class name under the package net.snowflake.client.category.

Test Class Naming Convention

The test cases are fallen into a couple of criteria:

  • The unit test class names end with Test. They run part of the JDBC build jobs.
  • The integration test class names end with IT. They run part of the verify maven goal along with the test category specified by the parameter testCategory having net.snowflake.client.category classes.
  • The manual test class names end with Manual. They don't run in the CI but you can run them manually.

Aside from the general test criteria, the test case class names ending with LatestIT run only with the latest JDBC driver. The main motivation behind is to skip those tests for the old JDBC driver. See ./TestOnly directory for further information.

Support

Feel free to file an issue or submit a PR here for general cases. For official support, contact Snowflake support at: https://community.snowflake.com/s/article/How-To-Submit-a-Support-Case-in-Snowflake-Lodge

More Repositories

1

snowflake-connector-python

Snowflake Connector for Python
Python
574
star
2

gosnowflake

Go Snowflake Driver
Go
291
star
3

snowpark-python

Snowflake Snowpark Python API
Python
253
star
4

snowflake-sqlalchemy

Snowflake SQLAlchemy
Python
231
star
5

spark-snowflake

Snowflake Data Source for Apache Spark.
Scala
211
star
6

SnowAlert

Security Analytics Using The Snowflake Data Warehouse
Python
181
star
7

snowflake-connector-net

Snowflake Connector for .NET
C#
175
star
8

snowflake-cli

Snowflake CLI is an open-source command-line tool explicitly designed for developer-centric workloads in addition to SQL operations.
Python
168
star
9

snowflake-kafka-connector

Snowflake Kafka Connector (Sink Connector)
Java
135
star
10

snowflake-connector-nodejs

NodeJS driver
JavaScript
119
star
11

polaris-catalog

Polaris Catalog is an open source catalog for Apache Iceberg
90
star
12

snowflake-ingest-java

Java SDK for the Snowflake Ingest Service -
Java
66
star
13

dplyr-snowflakedb

SnowflakeDB backend for dplyr
R
65
star
14

snowflake-ingest-python

A Python API for Asynchronously Loading Data into Snowflake DB -
Python
59
star
15

pdo_snowflake

PHP PDO driver for snowflake
C
58
star
16

snowflake-ml-python

Python
38
star
17

libsnowflakeclient

Snowflake Connector for C/C++
C
25
star
18

connectors-native-sdk

Snowflake Native SDK for Connectors
Java
25
star
19

native-apps-examples

Public-facing example applications built using the Snowflake Native App Framework
Python
22
star
20

snowpark-java-scala

Snowflake Snowpark Java & Scala API
Scala
18
star
21

snowflake-hive-metastore-connector

Java
13
star
22

snowflake-s3compat-api-test-suite

S3Compat API Test Suite
Java
12
star
23

snowflake-telemetry-python

Python
7
star
24

snowflake-rest-api-specs

Public rest api specs for Snowflake
4
star
25

snowflake-common

3
star
26

native-apps-templates

Official Snowflake CLI templates released for the Snowflake Native App Framework
Python
3
star
27

homebrew-snowflake-cli

Ruby
1
star
28

reusable-workflows

A reusable workflow that will be used by repositories to run semgrep on each PR
1
star
29

snowflake-hibernate

Snowflake SQL dialect definition for Hibernate ORM
Java
1
star