Friday, July 27, 2007
Oracle SQLPlus number of digits to show
Do you ever want to see a really long number in an Oracle column, but SQLPlus prints out something like 2.8151+14 instead of 281510522718928?
Simple fix for this one.
Once per connection, just type:
set num 20
That will allow up to 20 digits to be displayed. Change 20 to whatever you like, but 20 is usually larger than the number of digits I need to see.
Thursday, July 12, 2007
HP Open View Service Desk web-api maybe long, but isn't Long
If the title of this blog is confusing, you may also find this blog confusing not because the content is confusing, but because you won't be able to understand what the developers that designed web-api were thinking.
HP Open View Service Desk (OVSD) web-api is a set of java api's that have little to do with the web as far as I can tell. It is an api for OVSD that is implemented in Java and jarred. No big deal there, just a strange name. OVSD has a concept of OID and ID for some records like Service Calls. ID is what the unique id that is shown in the UI that end users use. OID is the unique ID that is used in Oracle for relationships. My big conundrum is what were the developers thinking when they created two methods to open (find and load) and service call. The two methods are called openServicecall(). It is overloaded to accept a Long or a long. Long is an object in Java, and long is a primitive in Java. Very different things. One might think that the developers were nice and just provided the ability to pass either an object or primitive. This would make sense, but is not what they did. They made long mean ID and Long mean OID. Only place to get that is in the documentation.
Below is the correct snippet for opening a service call by ID (the end user value).
ApiSDSession session = null;
try
{
session = ApiSDSession.openSession(server, username, password);
IServicecallHome scHome = session.getServicecallHome();
long id = 123456; // NOTE: long MUST be used, NOT Long
IServicecall serviceCall = scHome.openServicecall(id);
}
catch (Exception ex)
{
// handle exception here
}
finally
{
session.closeConnection();
}
I hope this saves someone hours of frustration.
Subscribe to:
Posts (Atom)