问题
I am trying to install Snowflake JDBC driver according to instructions.
I have downloaded and installed Java from here, then downloaded snowflake-jdbc-3.6.9.jar file from here. When I double-click the file, nothing happens. So I opened CMD and tried this:
java -jar snowflake-jdbc-3.6.9.jar
I received *no main manifest attribute, in snowflake-jdbc-3.6.9.jar*
.
When I open META-INF\MANIFEST.MF file, I do see:
*Manifest-Version: 1.0*
*Main-Class: net.snowflake.client.jdbc.SnowflakeDriver*
I have gotten this far using suggestions from other StackOverflow topics, and don't know what else to try. I don't know much about Java, I just need to install this driver, so I could connect to Snowflake from a BI tool. I would really appreciate your help.
回答1:
Have you tried adding the jar to classpath and then running the following command, Class.forName("provided driver name")
in the calling class? Doing this with an IDE like Eclipse or Netbeans should make this process much simpler (particularly adding the jar to your project classpath)
回答2:
Those clients are great, others that you might find these guides useful from the Snowflake blogs include:
- MySQL Workbench https://community.snowflake.com/s/article/configuring-sql-workbenchj-to-use-snowflake
- Using R https://community.snowflake.com/s/article/connecting-r-to-snowflake-using-the-jdbc-driver-mac-os-x
- Pentacho https://community.snowflake.com/s/article/configuring-a-jdbc-connection-to-snowflake-using-
- Jupyter Notebooks https://community.snowflake.com/s/article/Connecting-a-Jupyter-Notebook-Part-4
Hope that helps!
回答3:
Couple of solutions to the above:
1) Using CLASSPATH:
MacOS/Linux:
EXPORT CLASSPATH="Path/to/JDBCjarfile:$CLASSPATH"
Windows: There are a couple of way of setting the CLASSPATH
a) Run the following in CMD:
set CLASSPATH=path1;path2
b) In Search, search for and then select: System (Control Panel)
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the CLASSPATH environment variable and select it. Click Edit. If the CLASSPATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the CLASSPATH environment variable. Click OK. Close all remaining windows by clicking OK.
Reopen Command prompt window, and run your java code.
Document reference: https://www.java.com/en/download/help/path.xml
To confirm if the CLASSPATH variable is EXPORTED or SET:
1) MacOS/Linux:
$ echo $CLASSPATH
2) Windows:
$ echo %CLASSPATH%
来源:https://stackoverflow.com/questions/54504404/installing-snowflake-jdbc-driver