Hi,
I am having a problem with an application I am involved in.
SCENARIO -
We have a client/server app. Client sends a database request to a
server and the server does the database access and sends the response
back. Syabse is used as database. Server uses CTLib api. Both server
and client are C apps.
Client uses C code and writes the data to a buffer as Sybase CTLib
api-types like CS_DATE, to pass it to server as stored proc parameters.
Server uses CTLib API to access database. It just typecasts data sent
by client and uses it to access Sybase database using CTLib API.
Similarly server writes back the results into a buffer as CTLib data.
Client then interprets the data and uses it. (Client having knowledge
of Syabase types is the root problem. But its legacy and we are not
supposed to change it.)
PROBLEM -
Now we want to move the server to Java which uses JDBC. Client should
not change (that is it will remain a C client with knowledge of Sybase
CTLib specific types). So now how can we interpret the raw bytes that
come in as CTLib C data into the server and convert it to Java types
and vice versa (for sending results).
For example, if client sends a date or Money type as raw bytes which
are originally supposed to be type caseted and used as CTLib CS_DATE or
CS_MONEY types in C, how can we convert them to equivalent Java types
like BigDecimal or Date?
More precisely, how to convert data in Sybase CT_Lib types to
corresponding Java types? Are there any Utility classes? I guess
anybody with client as C app and server as Java app or vice versa
should have faced this problem irrespective of type of database they
are using.
Eagerly waiting for a response :-)
-
Preetham
Joe Weinstein - 09 May 2005 16:29 GMT
> Hi,
>
[quoted text clipped - 39 lines]
> -
> Preetham
Hi. Practically no one besides Sybase will have done this because mostly
everyone who has a Java-based server will have Java clients too, and certainly
not sybase-API C clients. However, you have a few routes to investigate.
1 - The Sybase JDBC driver does this, obviously. You could reverse
engineer to copy what it does.
2 - There is some open-source work with the TDS protocol, so if you google
for jTDS, maybe you will find some code to help.
Joe Weinstein at BEA