BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nigromx
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PaulHomes
Rhodochrosite | Level 12

You should be able to find it in sas.core.jar in the SASVersionedJarRepository in your SAS installation.

View solution in original post

2 REPLIES 2
PaulHomes
Rhodochrosite | Level 12

You should be able to find it in sas.core.jar in the SASVersionedJarRepository in your SAS installation.

nigromx
Fluorite | Level 6

Thanks very much, the problem was the jar versions.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Discussion stats
  • 2 replies
  • 3326 views
  • 1 like
  • 2 in conversation