4949public class DatabricksDriverExamples {
5050
5151 private static final String JDBC_URL_WAREHOUSE =
52- "jdbc:databricks://sample-host. cloud.databricks.com:9999 /default;"
53- + "transportMode=https ;ssl=1;AuthMech=3;httpPath=/sql/1.0/warehouses/999999999999 ;" ;
52+ "jdbc:databricks://benchmarking-staging-aws-us-west-2.staging. cloud.databricks.com:443 /default;"
53+ + "transportMode=http ;ssl=1;AuthMech=3;httpPath=/sql/1.0/warehouses/0112a04cba39da27 ;" ;
5454 private static final String JDBC_URL_CLUSTER =
5555 "jdbc:databricks://sample-host.cloud.databricks.com:9999/default;"
5656 + "transportMode=http;ssl=1;httpPath=sql/protocolv1/o/9999999999999999/9999999999999999;AuthMech=3;" ;
@@ -107,16 +107,16 @@ public void printResultSet(ResultSet resultSet) throws SQLException {
107107 // Print row data
108108 while (resultSet .next ()) {
109109 rows ++;
110- for (int i = 1 ; i <= columnsNumber ; i ++) {
111- try {
112- Object columnValue = resultSet .getObject (i );
113- System .out .print (columnValue + "\t \t " );
114- } catch (Exception e ) {
115- // Certain columns might be absent or throw exceptions in edge cases
116- System .out .print ("NULL\t \t " );
117- }
118- }
119- System .out .println ();
110+ // for (int i = 1; i <= columnsNumber; i++) {
111+ // try {
112+ // Object columnValue = resultSet.getObject(i);
113+ // System.out.print(columnValue + "\t\t");
114+ // } catch (Exception e) {
115+ // // Certain columns might be absent or throw exceptions in edge cases
116+ // System.out.print("NULL\t\t");
117+ // }
118+ // }
119+ // System.out.println();
120120 }
121121 System .out .println ("Total rows: " + rows );
122122 }
@@ -143,11 +143,14 @@ void exampleDefaultStringColumnLength() throws Exception {
143143 void exampleRowsFetchedPerBlock () throws Exception {
144144 // Register the Databricks JDBC driver
145145 DriverManager .registerDriver (new Driver ());
146- String jdbcUrl =
147- JDBC_URL_WAREHOUSE + "EnableTelemetry=1" + ";enableArrow=0" + ";RowsFetchedPerBlock=3" ;
148- Connection con = DriverManager .getConnection (jdbcUrl , "token" , DATABRICKS_TOKEN );
146+ String jdbcUrl = JDBC_URL_WAREHOUSE + "EnableTelemetry=1" + ";enableArrow=0;RowsFetchedPerBlock=5000" ;
147+ Connection con =
148+ DriverManager .getConnection (jdbcUrl , "token" , "token" );
149149 Statement stmt = con .createStatement ();
150- ResultSet rs = stmt .executeQuery ("SELECT * FROM RANGE(12)" ); // 4 FetchResults calls made
150+ ResultSet rs =
151+ stmt .executeQuery (
152+ "SELECT * FROM main.tpch_sf10000_delta.customer LIMIT 1000000" ); // 4 FetchResults calls
153+ // made
151154 printResultSet (rs );
152155 stmt .close ();
153156 rs .close ();
0 commit comments