Re: Getting the last modified date of a table

From: Antti Karanta (firstname.lastname_at_napa.fi)
Date: 02/28/05


Date: Mon, 28 Feb 2005 14:42:46 +0200


On 17 Feb 2005 22:46:13 -0600, Wiseguy <noone@uber.usachoice.net> wrote:

> "Antti Karanta" <firstname.lastname@napa.fi> scribbled on the stall wall:
>> I was wondering whether there is a universal way to ask via jdbc
>> when a
>> db table was last modified. I am looking for a way that does not need
>> any
>> structural modifications the the table itself or the schema (e.g.
>> inserting a new col or creating a separate table to write this info to).
>
> I am not aware of any JDBC method that gets that metadata. Since JDBC
> aims
> to be transportable, and not all common databases support that function,
> I doubt it would be part of the JDBC API.

   I don't see this as a reason to exclude it. The JDBC api has quite a few
things that address features that may not be provided by the driver / db,
e.g. stored procedures, all transaction isolation levels etc. The key
point is being able to ask whether the feature you want to use is
supported, see e.g.
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#supportsTransactionIsolationLevel(int).

> Asking this is suspect though. Question why you even need that data. It
> is far preferable to put an update timestamp field in the table itself.

   Yes, I fully agree.

   The case (in short) is this: I am developing an extension to an old
application that stores some data as tables, in its own proprietary
format. It has become desirable to be able to import tables from an rdbms
and handle them just like the native tables of the app itself. Now, the
native app's own tables have a timestamp telling when the table itself was
last modified. In order for the handling of data from an rdbms to be as
simple as possible it would be nice if this info was available as it is
used in some of the app's internal logic.

   Since the tables the user wants to handle are given at runtime I can
have no information about them except for what I can find in the metadata.
I can not assume that I can modify the schema in any way - the user may
not have the rights for it and even if he did he might find it undesirable
that the tables' structures are tampered with.

> How does the (date table was last updated) fit into the relational model
> itself? I don't think it does if you use the model correctly.

   Yes, this would be the case if I got to design the schema myself for a
particular purpose.

       --Antti--



Relevant Pages

  • Re: metadata for Storedprocedure
    ... executing the stored procedure in JDBC? ... to get information about all procedures of schema ... to get information about named procedure. ...
    (comp.lang.java.databases)
  • Set default schema in code - possible?
    ... I know that, for a particular DB user, I can set the default schema ... statically in Mgmt Studio. ... in source code. ... I am using JDBC if that matters. ...
    (comp.databases.ms-sqlserver)
  • Re: Need help Regarding executing select query
    ... Observe that in the Result product_sys_ ids are getting in the sorted ... That tool in turn communicates with the RDBMS engine, as the JDBC driver must. ... We don't get to know, much less influence, how the RDBMS receives the SELECT or how it plans it, save that it must conform to SQL semantics. ...
    (comp.lang.java.programmer)
  • Re: java servlet accessing two different db at the same time
    ... > RDBMS, but only a subset. ... Yes, with JDBC ... > threading functionality). ... Prev by Date: ...
    (comp.databases.oracle.server)