Prev: PAPER ON ZERO-INFLATED NEGATIVE bINOM
Next: Thanks: Filename FTP timeing-out on Z/OS tapemount?
From: rajesh.hagalwadi on 12 Apr 2007 06:54 Hi there, Well i am trying to establish a connection to SAS from Java using TelnetConnectClient with Spawner as my bridge , we are using SAS 9.1 version Not sure where i am goin wrong i am unable to establish a connection and getting an exception com.sas.net.connect.TelnetClientException Plz check the code below and suggest me in this regards. any help is appreciated Compile fine but when i run it i get exception Process for execution i follow is : 1)start spawner service using the script spawner -c tcp -nosecurity - service 2323 at command line Spawner console window reads Waiting for Connection. 2) Now i run my java file... Exception message is Exception inside connect of SASConnection.java due to com.sas.net.connect.ConnectException: Connect.C85.ex.txt: Exception while waiting for "2323" in the follow ing telnet session com.sas.net.connect.TelnetClientException java.io.EOFException. 3) Now my Spawner console reads-- read failed I use 3 java files 1)TestConn.java-- i call the other two classes (ConnectInfo,SASConnection) 2)ConnectInfo.java --i initialise my default settings 3)SASConnection.java ---here my connect code exists package example.sas.net.connect; import example.sas.net.connect.ConnectInfo; import example.sas.net.connect.*; class TestConn { public static void main(String[] args) { try { System.out.println("inside TestConn "); ConnectInfo conninf = new ConnectInfo(); example.sas.net.connect.SASConnection Connect= new example.sas.net.connect.SASConnection(); //conninf.host = "localhost"; conninf.host = "203.196.161.43"; conninf.port = 2323; conninf.setDefaults(); System.out.println("conn info is "+conninf.get("response2")); System.out.println("more conn info is "+conninf.get("response3")); Connect.setConnectInfo(conninf); Connect.connect(); //System.out.println("Connection Established"); } catch (Exception e) { System.out.println("Exception Caught in TestConn due to "+e); } } } package example.sas.net.connect; public class ConnectInfo extends java.util.Properties { String host; int port; static String sasdmr = "sas -dmr -comamid tcp -device grlink - noterminal -nosyntaxcheck"; public ConnectInfo() {} public void setDefaults() { System.out.println("starts here...."); put("prompt1", "Login:"); put("promptTimeout1", "15"); put("prompt2", "Password:"); put("promptTimeout2", "15"); put("prompt3", "Hostname"); put("promptTimeout3", "15"); put("response3", sasdmr); //put("sasPortTag","23"); put("sasPortTag","2323"); } } package example.sas.net.connect; import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; import java.util.Vector; import com.sas.net.connect.ConnectClient; import com.sas.net.connect.ConnectException; import com.sas.net.connect.TelnetConnectClient; import java.io.*; public class SASConnection { public SASConnection() {} public SASConnection(ConnectInfo connectinfo) { connectInfo = connectinfo; } public SASConnection setConnectInfo(ConnectInfo connectinfo) { System.out.println("inside setConnectInfo of SASConnection.java"); connectInfo = connectinfo; return this; } public synchronized void submitLines(String lines) { try { if ((lines!=null)&&(lines.length()>0)) { status.add("Submitting SAS statements ..."); connection.clearListLines(); connection.rsubmit(lines); connection.clearEditLines(); lines = connection.getListLines(); if (lines.length()>0) list.add(lines); } status.add("Execution complete."); } catch (ConnectException e) { //status.add(e.getMessage()); } } public synchronized void connect() { try { System.out.println("inside connect of SASConnection.java"); status.add("Logging onto " + host); System.out.println("11111111"); connection = (ConnectClient) new TelnetConnectClient(connectInfo); System.out.println("2222222 ,host,port are "+ connectInfo.host +","+connectInfo.port); //connection.connect(connectInfo.host, connectInfo.port); connection.connect(connectInfo.host, connectInfo.port); System.out.println("isConnected="+connection.isConnected()); System.out.println("DriverName="+connection.getDriverName()); System.out.println("MajorSasVersion="+connection.getMajorSasVersion()); System.out.println("MinorSasVersion="+connection.getMinorSasVersion()); System.out.println("LogLines="+connection.getLogLines()); System.out.println("3333333"); jdbcConnection = connection.getSharenet(); System.out.println("4444444"); System.out.println(jdbcConnection); connect = true; status.add("SAS init, connection complete"); System.out.println("status value is "+status); } catch (Exception e) { //status.add(e.getMessage()); System.out.println("connection log is "+ connection.getLogLines()); System.out.println("Exception inside connect of SASConnection.java due to "+e); } return; } public void disconnect() { if (connect == true) { try { connection.disconnect(); connect = false; } catch (ConnectException e) { connect = false; } connection = null; } } boolean connect = false; String host = null; ConnectInfo connectInfo; public int port = 23; public java.sql.Connection jdbcConnection= null; public ConnectClient connection = null; public Vector status = new Vector(); public Vector list = new Vector(); }
|
Pages: 1 Prev: PAPER ON ZERO-INFLATED NEGATIVE bINOM Next: Thanks: Filename FTP timeing-out on Z/OS tapemount? |