Skip to Content.
Sympa Menu

freetds - Re: Sql 7 date

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "mlontsman" <montsman AT longbow.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Sql 7 date
  • Date: Wed, 26 Sep 2001 16:14:12 -0400


Curt,

hehe, neah, mood is fine, typo :)

Anyways, the field is datetime, and yes, ordinarily I would just use
ResultSet.getDate or something like that to retrieve it.

The real problem is that I don't know what type of field I am dealing with
ahead of time. In this application I am working on, I am looping through all
of the fields in a given table and try to determine their data types. When I
call ResultSetMetaData.getColumnType on the datetime field, it throws
exception saying that it can't determine the type.

So then I started thinking of how to hack it and perhaps retrieve the date
as a string as and then cast it into a date, but none of the built in java
Date classes seem to recognize a date like: '2001-03-03 00:00:00.0' as a
valid date.

Hope I am more clear now :)

Mark

----- Original Message -----
From: "Curt Hagenlocher" <curt AT hagenlocher.org>
To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
Sent: Wednesday, September 26, 2001 3:50 PM
Subject: [freetds] Re: Sql 7 date


> "Mark Lontsman" <mark.lontsman AT longbow.com> wrote:
>
> > Hell everyone,
>
> In a bad mood, are we? ;)
>
> > Can someone give me pointers on how to deal with Sql Server 7 dates
> > in jdbc implementation of freetds?
>
> I have to confess that I don't understand your question.
> Is your field a datetime/smalldatetime? Or is it a char
> field that is being used to store date and time information?
>
> If it's a datetime, you should just be able to call
> ResultSet.getTimestamp to get its value. If that value
> is null, then the field is null.
>
> If it's a char field, then you might be able to use the
> java.util.DateFormat class to parse the date and determine
> its validity. (Naturally, you'd need ResultSet.getString
> to get the value.)
>
> If neither of these describes what you are trying to do,
> you'll have to be more explicit.
>
>
> --
> Curt Hagenlocher
> curt AT hagenlocher.org
>
> ---
> You are currently subscribed to freetds as: [mlontsman AT longbow.com]
> To unsubscribe, forward this message to
$subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page