cancel
Showing results for 
Search instead for 
Did you mean: 

How can I using Java Socket in Sybase ASE?

Former Member
0 Kudos

I am a engineer for develop network with real-time service, wihch can sending message to another remote applications.

First, I know Sybase have TIBCO-EMS System to achieving my requirement but TIBCO was not free software, thus I want it to do myself.

Ok, In my requirement, I find the Java Service in Sybase ASE and I followings with user guide:

  1. enable pci 1
  2. enable java 1
  3. install java class that include socket client.
  4. I use setp 3 of java socket connect to remote server(java Server Socket) and sending message.

My question is: Seem's Sybase ASE can't using socket directly ?

While I used socket, Sybase throws the exception:

There was an error reading the results of the SQL statement.

The displayed results may be incorrect or incomplete.

Unhandled Java Exception:

java.lang.ExceptionInInitializerError

  at

java.net.Socket.setImpl(Socket.java:493)

  at java.net.Socket.<init>

(Socket.java:414)

  at java.net.Socket.<init>(Socket.java:208)

  at org.

gms.client.ClientTest.send(ClientTest.java:13)

Caused by: java.lang.

SecurityException: Properties can not be inspected

  at sybase.aseutils.

PCAJvmSecurityManager.checkPropertiesAccess(PCAJvmSecurityManager.java:

173)

  at java.lang.System.getProperties(System.java:622)

  at.

Sybase error code=10707

There was an error reading the results of the SQL statement.

The displayed results may be incorrect or incomplete.

Unhandled Java Exception:

java.lang.ExceptionInInitializerError

  at

java.net.Socket.setImpl(Socket.java:493)

  at java.net.Socket.<init>

(Socket.java:85)

Caused by: java.lang.SecurityException: Properties can

not be inspected

  at sybase.aseutils.PCAJvmSecurityManager.

checkPropertiesAccess(PCAJvmSecurityManager.java:173)

  at java.lang.

System.getProperties(System.java:622)

  at java.net.PlainSocketImpl$1.

run(PlainSocketImpl.java:62)

  at java.security.AccessController.

doPrivile.

Sybase error code=10707

Can anyone help me? Thank so much~!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Is anyone has solution ? Thanks!

former_member188958
Active Contributor
0 Kudos

I don't have any direct experience yet using Java sockets in ASE, but as the manuals explicitly mention the class, I suspect they can be used.  Using socket classes

As an initial guess, have you adjusted the sp_configure parameter "number of java sockets" up from its default value of 0?  number of java sockets

-bret

Former Member
0 Kudos

Hello ! Bret.

Thank for your reply.

Yes. I already set 10 value of 'number of java sockets'  attribute in configure.

In addition , I also enable the "pca_jvm_netio" and "-Dsybase.allow.native.lib=true" in pca/jvm options.

" I suspect they can be used.  Using socket classes"

You are right , but it just can't use.

I have confused to one thing when watch the SecurityException of describtion :

'java.lang.SecurityException:Properties can not be inspected'


So I think, This is a point to using socket.


In this case , Why cause  system to get properties for use socket?

former_member188958
Active Contributor
0 Kudos

Could you provide code for a class (as minimal as possible) that reproduces the error and an example of how you are calling it?

Former Member
0 Kudos

Ok!

Here is my example of calling:

My class name is ClientTest that installed in sybase.

It can made sybase call by static method.

public static void send() {

    Socket socket = null;

    try {

      socket = new Socket("192.168.100.169", 5056);

      OutputStream op = socket.getOutputStream();

      op.write("Hello Server".getBytes());

      op.flush();

      op.close();

      socket.close();

    } catch (UnknownHostException e) {

      e.printStackTrace();

    } catch (IOException e) {

      e.printStackTrace();

    }

  }

In the InteractiveSQL , I used syntax as following:

select org.gms.client.ClientTest.send();

Than execute this column : socket = new Socket("192.168.100.169", 5056);

The SecurityException has been raised and made ExceptionInInitializerError occur, thus JVM can't load java.net.Socket class.

If the issue have no solution yet , will made me can't use Socket.