Hi Jon,

Thanks for the clarification. jOOQ iteself doesn't provide any
additional database meta-information other than what is known at
code-generation time. jOOQ-meta could be a slightly better match for
your needs, although it is designed only to serve jOOQ-codegen, so it
probably wouldn't be a very reliable database meta-information source
for you...

Nevertheless, jOOQ should probably wrap JDBC's DatabaseMetaData in a
"jOOQ way", i.e. a MetaData type with signatures as these:

- `List<org.jooq.Schema> schemas()`
- `List<org.jooq.Schema> schemas(... search criteria)`
- `List<org.jooq.Table> tables()`
- `List<org.jooq.Table> tables(... search criteria)`

This might even prove to be useful for jOOQ internally, when dealing
with plain SQL.

I have registered feature request #1968 for this
https://github.com/jOOQ/jOOQ/issues/1968

Cheers
Lukas

2012/11/13 Jon Inloes <[email protected]>:
> Thanks a lot for the response Lukas.
>
>  I've looked over that documentation already.
>
> I don't think I explained what I'm trying to do clearly. I'm trying to use
> JOOQ to dynamically write to a databases. That is, I don't know what
> database I'm using beforehand nor do I know the structure of the tables.
> Which is why I asked if was possible to use JOOQ to pull back database
> metadata easier than querying it through JDBC. I know schemaCrawler does
> this by supplying it with a connection. Pulling this data back will help me
> determine which type of converter to use. For example, if I have a jodatime
> object while writing to an oracle database, I want to see if I'm writing to
> a standard sql timestamp or an oracle specific TIMESTAMPTZ column. Code
> generation is not an option because the database being used is determined at
> run-time.
>
> Thanks a lot again and you've created a great tool,
> Jon
>
>
> On Saturday, November 10, 2012 1:29:00 AM UTC-8, Lukas Eder wrote:
>>
>> Hello Jon
>>
>> > What I'm confused on is how JOOQ handles writing to vendor specific data
>> > types like oracle's TIMESTAMPTZ.
>>
>> jOOQ generally uses those data types that are available through JDBC.
>> In this case, the best matching data type is probably
>> java.sql.Timestamp.
>>
>> > Also, if JOOQ does not handle a case where a column is a custom data
>> > type
>> > like oracle's TIMESTAMPTZ, how do I use JOOQ to query and oracle table
>> > to
>> > pull back the table's schema/metadata.
>>
>> The general approach would be to use jOOQ's code generator as
>> described in the tutorial:
>>
>> http://www.jooq.org/doc/2.6/manual/getting-started/tutorials/jooq-in-7-steps/
>>
>> It will then generate the necessary meta data for type-safe data type
>> handling. Since you ultimately want to convert from / to jodatime
>> DateTime objects, you may want to consider the manual's sections about
>> custom data type conversion. This section explains what a converter
>> is:
>>
>> http://www.jooq.org/doc/2.6/manual/sql-execution/fetching/data-type-conversion/
>>
>> And this section explains how to let jOOQ's code generator apply
>> converters to generated meta data:
>> http://www.jooq.org/doc/2.6/manual/code-generation/custom-data-types/
>>
>> Hope this helps,
>> Lukas

Reply via email to