Access a SAS Dataset using JDBC
import java.sql.*; import java.util.Properties; public class accessSASData { public static void main(String argv[]) { Connection connection; Properties props; int i; Statement statement; /* SAS datasets can be queried with a SQL statement itself */ String queryString = "SELECT sup_id, sup_name " + "FROM mySasLib.suppliers ORDER BY sup_name"; ResultSet result; double id; String name; try { // CONNECT TO THE SERVER BY USING A CONNECTION PROPERTY LIST Class.forName("com.sas.rio.MVADriver"); props = new Properties(); props.setProperty("user", "jdoe"); props.setProperty("password", "4ht8d"); /* SAS libref and library name */ props.setProperty("librefs", "mySasLib c:\\sasdata';"); connection = DriverManager.getConnection( "jdbc:sasiom://c123.na.abc.com:8591", props); // ACCESS DATA statement = connection.createStatement(); result = statement.executeQuery(queryString); while (result.next()) { id = result.getDouble(1); name = result.getString(2); System.out.println(id + " " + name); } statement.close(); connection.close(); } catch (Exception e) { System.out.println("error " + e); } } }