Ah, I think I understand, thanks again Lukas!

Ian.

On Tue, Apr 24, 2012 at 8:20 AM, Lukas Eder <[email protected]> wrote:

> >> The above Factory will avoid rendering "MySchema". With jOOQ 2.3.0,
> >> there will also be a way to specify Settings.setRenderSchema(false),
> >> to avoid rendering schema names all together. Right now, the default
> >> schema will be your only option.
> >
> >
> > Ok, so the string "MySchema" is unimportant here?  It could be "blahblah"
> > and would still work?
>
> Au contraire. Look at it this way:
>
> - jOOQ by default fully qualifies schemata
> - jOOQ is thus capable of running queries against multiple schemata
> - Most users probably have only one schema. They want to use that as
> the "default schema"
> - The default schema can be set in the JDBC string in many databases
> - The default schema can be overridden using SQL statements in many
> databases. Examples
>
>    -- Oracle syntax
>    ALTER SESSION SET current_schema = my_other_schema;
>
>    -- MySQL, Sybase ASE, Sybase SQL Anywhere
>    USE my_other_schema;
>
>    -- DB2, Derby, H2, HSQLDB
>    SET SCHEMA my_other_schema
>
> - hence, jOOQ can't make any assumption regarding a default schema,
> you need to tell jOOQ
>
> So in other words, write this:
>
> new Factory(connection, dialect,
>   new Settings().withRenderMapping(
>    new
> RenderMapping().withDefaultSchema("[the-schema-name-that-you-consider-the-default-schema]")));
>
> As I said, jOOQ 2.3.0 will include a more user-friendly feature for
> the simple use-case of not fully qualifying table names...
>
> Hope this helps
> Lukas
>



-- 
Ian Clarke
Blog: http://blog.locut.us/

Reply via email to