SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

SAS JDBC com.sas.sql

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

SAS JDBC com.sas.sql

[ Edited ]

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.


Accepted Solutions
Solution
‎11-30-2016 09:43 PM
PROC Star
Posts: 402

Re: SAS JDBC com.sas.sql

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

View solution in original post


All Replies
Solution
‎11-30-2016 09:43 PM
PROC Star
Posts: 402

Re: SAS JDBC com.sas.sql

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

Occasional Contributor
Posts: 13

Re: SAS JDBC com.sas.sql

Thanks very much, the problem was the jar versions.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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