Discussion:
determining the SQLDialect
Manuel Rossetti
6 years ago
Permalink
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.
Lukas Eder
6 years ago
Permalink
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
...
--
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
6 years ago
Permalink
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 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.
Lukas Eder
6 years ago
Permalink
Internally, jOOQ uses
https://www.jooq.org/javadoc/latest/org/jooq/tools/jdbc/JDBCUtils.html#dialect-java.sql.Connection-
...
--
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
6 years ago
Permalink
That is good to know. Since it is a guess, can the returned value from

public static final SQLDialect
<https://www.jooq.org/javadoc/latest/org/jooq/SQLDialect.html>
dialect(Connection
<http://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html?is-external=true>
connection)

be null?
...
--
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.
Lukas Eder
6 years ago
Permalink
No, they will return SQLDialect.DEFAULT, not null. I will fix the Javadoc:
https://github.com/jOOQ/jOOQ/issues/7954
...
--
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.
Loading...