User guide
//Retrieve two columns.
String catalog = rs.getString("table_catalog");
String name = rs.getString("table_name");
//Display values.
System.out.print("Catalog: " + catalog);
System.out.println(", Name: " + name);
}
rs.close();
stmt.close();
conn.close();
}catch(Exception ex){
//For convenience, handle all errors here.
ex.printStackTrace();
}finally{
//Finally block to close resources.
try{
if(stmt!=null)
stmt.close();
}catch(Exception ex){
}// nothing we can do
try{
if(conn!=null)
conn.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
System.out.println("Finished connectivity test.");
}
}
Connecting to a Cluster by Using .NET
When you use .NET (C#) to programmatically connect to your cluster, you can do so with or without server
authentication. If you plan to use server authentication, follow the instructions in Configure Security Options
for Connections (p. ?) to download the Amazon Redshift server certificate, and then put the certificate
in the correct form for your .NET code.
API Version 2012-12-01
171
Amazon Redshift Management Guide
Connecting to Clusters From Client Tools and Code