这是我用来连接到雪花数据库的代码:
require 'java'
require 'rubygems'
require 'C:/Program Files/CData/CData JDBC Driver for Snowflake 2018/lib/cdata.jdbc.snowflake.jar'
url = "jdbc:snowflake:User=Admin;Password=test123;Server=localhost;Database=Northwind;Warehouse=TestWarehouse;Account=Tester1;"
conn = java.sql.DriverManager.getConnection(url)
stmt = conn.createStatement
rs = stmt.executeQuery("SELECT Id, ProductName FROM Products")
while (rs.next) do
puts rs.getString(1) + ' ' + rs.getString(2)
end
但是我还需要运行其他SQL查询:
Copy into table1 from table2
Truncate table student
如何使用我的代码运行这些查询?
答案 0 :(得分:0)
我认为您只会更新您的SQL
rs = stmt.executeQuery("SELECT Id, ProductName FROM Products")
将该SQL更改为您找到的示例以外的其他内容。