Skip to Content.
Sympa Menu

freetds - FreeTDS JDBC Strings>255 and Date

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "RGM FreeTDS mail" <freetds AT rgm.dk>
  • To: freetds
  • Subject: FreeTDS JDBC Strings>255 and Date
  • Date: Tue, 2 May 2000 12:18:45


Hi,

I just want to say that I think the Free JDBC driver is great.

I'm having a problem with putting strings which are bigger than
255 chars into a text field.

Also I have problems with other timezones (specifically the ECT timezone).
This problem occur when i try to insert/select dates via
prepared statements.


Big Strings:
------------
I have looked at the code and changed the following code:

comm.appendByte((byte)nativeType);

if (
actualParameterList[i].value!=null &&
((String)actualParameterList[i].value).length()
> formalParameterList[i].maxLength)
{
// XXX This can never happen if the driver is bug
// free. Perhaps when we are more sure of that
// we can remove this check.
throw new TdsException("Internal error. string is "
+
"longer than procedure can "
+
"handle");
}

sendSybChar(((String)actualParameterList[i].value),
formalParameterList[i].maxLength);


Too this:


if(actualParameterList[i].value != null &&
((String)actualParameterList[i].value).length()>255)
{
comm.appendByte(SYBTEXT);
sendSybImage((byte[])((String)actualParameterList[i].
value).getBytes());
} else {
comm.appendByte((byte)nativeType);
sendSybChar(((String)actualParameterList[i].value),
formalParameterList[i].maxLength);
}

break;


Which actually works with both varchars > 255 and text fields.


Also I have changed:
long ms =
((Timestamp)actualParameterList[i].value).getTime() +
(nanoseconds / nsPerMs);

Too:

long ms =
((Timestamp)actualParameterList[i].value).getTime() +
(nanoseconds / nsPerMs) -
(((Timestamp)actualParameterList[i].value).
getTimezoneOffset() * 60 * 1000);


Then it actually works allrigth.


crg AT rgm.dk




Archive powered by MHonArc 2.6.24.

Top of Page