Hello:
I have a problem with java client connection, this is my code:
Code:
Connection connection;
Properties props;
int i;
Statement statement;
String queryString = "SELECT IDnumber,Week1,Week16 " +
"FROM mySasLib.mydata ORDER BY IDnumber";
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","sasadm");
props.setProperty("password", "password");
props.setProperty("librefs", "mySasLib '/home/sas/pruebaint';");
connection = DriverManager.getConnection("jdbc:sasiom://server: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);
}
The error is:
log4j:WARN No appenders could be found for logger (com.sas.services.connection).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: com/sas/sql/RIOStatement
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sas.rio.MVAConnection.createStatement(MVAConnection.java:466)
at com.sc.di.SCSASMetadataConnect.crear_dataset(SCSASMetadataConnect.java:70)
at com.sc.di.SCSASMetadataConnect.getRepositories(SCSASMetadataConnect.java:46)
at com.sc.di.MainWindow.createContents(MainWindow.java:184)
at com.sc.di.MainWindow.open(MainWindow.java:53)
at com.sc.di.MainWindow.main(MainWindow.java:42)
Caused by: java.lang.ClassNotFoundException: com.sas.sql.RIOStatement
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 30 more
I can´t find the jar file for com.sas.sql, any idea?
Thank you in advance.
You should be able to find it in sas.core.jar in the SASVersionedJarRepository in your SAS installation.
You should be able to find it in sas.core.jar in the SASVersionedJarRepository in your SAS installation.
Thanks very much, the problem was the jar versions.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!