Representing Java instances

Non-Java clients such as isql cannot receive serialized Java objects from the server. To allow you to view and use the object, Adaptive Server must convert the object to a viewable representation.

To use an actual string value, Adaptive Server must invoke a method that translates the object into a char or varchar value. The toString() method in the Address class is an example of such a method. You must create your own version of the toString() method so that you can work with the viewable representation of the object.

NoteThe toString() method in the Java API does not convert the object to a viewable representation. The toString() method you create overrides the toString() method in the Java API.

When you use a toString( ) method, Adaptive Server imposes a limit on the number of bytes returned. Adaptive Server truncates the printable representation of the object to the value of the @@stringsize global variable. The default value of @@stringsize is 50; you can change this value using the set stringsize command. For example:

set stringsize 300

The display software on your computer may truncate the data item further so that it fits on the screen without wrapping.

If you include a toString( ) or similar method in each class, you can return the value of the object’s toString( ) method in either of two ways: