determining the SQLDialect

19 views
Skip to first unread message

Manuel Rossetti

unread,
Oct 17, 2018, 6:44:23 PM10/17/18
to jOOQ User Group
I have a use case where I don't know the SQLDialect prior to getting a DLSContext.  Is there a way in jooq to determine the SQLDialect, say from a Connection object?

The DLS.using(connection, dialect) requires the dialect.  Is there a way to determine the dialect prior to this, say from the meta data of the connection.  Is there jooq support for doing this?

Lukas Eder

unread,
Oct 18, 2018, 9:19:59 AM10/18/18
to jooq...@googlegroups.com
Hi Manuel,

Just don't pass the dialect to DSL.using(connection). jOOQ will auto-detect from the JDBC connection URL (there are some ambiguities for some databases)

Thanks,
Lukas

On Thu, Oct 18, 2018 at 12:44 AM Manuel Rossetti <mdrfo...@gmail.com> wrote:
I have a use case where I don't know the SQLDialect prior to getting a DLSContext.  Is there a way in jooq to determine the SQLDialect, say from a Connection object?

The DLS.using(connection, dialect) requires the dialect.  Is there a way to determine the dialect prior to this, say from the meta data of the connection.  Is there jooq support for doing this?

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manuel Rossetti

unread,
Oct 18, 2018, 2:55:39 PM10/18/18
to jooq...@googlegroups.com
Okay.  Is there a way to get the dialect that jOOQ detects?  I don't see a method for this, but it might be somewhere that I don't know about.

You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/VdfZt5rZHJQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.

Lukas Eder

unread,
Oct 18, 2018, 5:20:32 PM10/18/18
to jooq...@googlegroups.com

Manuel Rossetti

unread,
Oct 19, 2018, 9:53:59 AM10/19/18
to jooq...@googlegroups.com
That is good to know.  Since it is a guess, can the returned value from

public static final SQLDialect dialect(Connection connection)
be null?

Lukas Eder

unread,
Oct 19, 2018, 10:41:13 AM10/19/18
to jooq...@googlegroups.com
No, they will return SQLDialect.DEFAULT, not null. I will fix the Javadoc:
Reply all
Reply to author
Forward
0 new messages