Package com.sas.iom.SAS

Examples of com.sas.iom.SAS.IWorkspace


        ConnectionFactoryManager cxfManager =
                new ConnectionFactoryManager();

        ConnectionFactoryInterface cxf = cxfManager.getFactory(cxfConfig);
        ConnectionInterface cx = cxf.getConnection(userName, password);
        IWorkspace iWorkspace = IWorkspaceHelper.narrow(cx.getObject());
        ILanguageService sasLanguage = iWorkspace.LanguageService();

        sasLanguage.Submit(procedure);

        CarriageControlSeqHolder logCarriageControlHldr = new CarriageControlSeqHolder();
        LineTypeSeqHolder logLineTypeHldr = new LineTypeSeqHolder();
        StringSeqHolder logHldr = new StringSeqHolder();
        sasLanguage.FlushLogLines(Integer.MAX_VALUE, logCarriageControlHldr, logLineTypeHldr, logHldr);
        System.out.println("==> Log <==");
        for (String line: logHldr.value) {
            System.out.println(line);
        }

        CarriageControlSeqHolder holder = new CarriageControlSeqHolder();
        LineTypeSeqHolder listLineTypeHldr = new LineTypeSeqHolder();
        StringSeqHolder listHldr = new StringSeqHolder();
        sasLanguage.FlushListLines(Integer.MAX_VALUE, holder, listLineTypeHldr, listHldr);
       
        System.out.println("==> OUT <==");
        /*
        for (CarriageControl control: holder.value) {
            System.out.println("control -> [" + control.getClass() + ":" + control.value() + "] " + control.toString());
        }
        for (LineType type: listLineTypeHldr.value) {
            System.out.println("type -> [" + type.getClass() + ":" + type.value() + "]" + type.toString());
        }
        */
        for (String line: listHldr.value) {
            System.out.println(line);
        }

        iWorkspace.Close();
        cx.close();
    }
View Full Code Here


        int port = 8591;
        String userName = "twncwc";
        String password = "kKk123";
        //
        ConnectionInterface cx = null;
        IWorkspace sasWorkspace = null;
        Connection conn = null;
        Statement state = null;
        ResultSet res = null;
        ResultSetMetaData meta = null;
        try {
            Server server = new BridgeServer(classID, host, port);
            ConnectionFactoryConfiguration cxfConfig = new ManualConnectionFactoryConfiguration(server);
            ConnectionFactoryManager cxfManager = new ConnectionFactoryManager();
            ConnectionFactoryInterface cxf = cxfManager.getFactory(cxfConfig);
            cx = cxf.getConnection(userName, password);
            sasWorkspace = IWorkspaceHelper.narrow(cx.getObject());

            ILanguageService sasLanguage = sasWorkspace.LanguageService();

            sasLanguage.Submit(procedure);
            sasLanguage.FlushList(Integer.MAX_VALUE);

            //result = new JDBCToTableModelAdapter(conn, "Select * From WORK.WAT");

            conn = new MVAConnection(sasWorkspace, new Properties());
            state = conn.createStatement();
            res = state.executeQuery("Select * From WORK.WAT");
            meta = res.getMetaData();

            String[] columns = new String[meta.getColumnCount()];
            for (int i = 1; i <= columns.length; i++) {
                columns[i - 1] = meta.getColumnName(i);
            }

            ArrayList<Object[]> rows = new ArrayList<Object[]>();
            while (res.next()) {
                Object[] row = new Object[columns.length];
                for (int i = 1; i <= columns.length; i++) {
                    row[i - 1] = res.getObject(i);
                }
                rows.add(row);
            }
            result = new DefaultTableModel(rows.toArray(new Object[rows.size()][]), columns);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (res != null) {
                    res.close();
                }
                if (state != null) {
                    state.close();
                }
                if (conn != null) {
                    conn.close();
                }
                if (sasWorkspace != null) {
                    sasWorkspace.Close();
                }
                if (cx != null) {
                    cx.close();
                }
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.sas.iom.SAS.IWorkspace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.