As always, you're very fast to reply, thanks!
So I'll implement my own switch structure for now.
Regards,
electrotype
On 11/3/2013 5:17 PM, Lukas Eder wrote:
Hello,
2013/11/3 <[email protected] <mailto:[email protected]>>
I have another question :
For my framework, let's say the application developer needs to specify the
type of database he
uses. For example with the string "h2" or "postgres".
What is the easiest way to get the associated "Database" (a class extending
/org.jooq.util.AbstractDatabase/) from this string? I need to get
"/org.jooq.util.h2.H2Database/" or
"/org.jooq.util.postgres.PostgresDatabase/" for example. Is
there an utility method for that?
I already get the associated /org.jooq.SQLDialect/ from the "h2" or
"postgres" string (by
checking the enum names), but I also need the associated Database class. Do
I have to
implement my own switch structure or is there already an utility method for
that?
Thanks in advance!
There is JDBCUtils.dialect(...), which helps you guess a SQLDialect given a Connection, or a
connection URL:
-
http://www.jooq.org/javadoc/latest/org/jooq/tools/jdbc/JDBCUtils.html#dialect(java.sql.Connection)
<http://www.jooq.org/javadoc/latest/org/jooq/tools/jdbc/JDBCUtils.html#dialect%28java.sql.Connection%29>
- http://www.jooq.org/javadoc/latest/org/jooq/tools/jdbc/JDBCUtils.html#dialect(java.lang.String)
<http://www.jooq.org/javadoc/latest/org/jooq/tools/jdbc/JDBCUtils.html#dialect%28java.lang.String%29>
jOOQ currently does not help you go from the SQLDialect to the relevant org.jooq.util.Database. I
have registered #2828 to add support for this in jOOQ 3.3:
https://github.com/jOOQ/jOOQ/issues/2828
Cheers
Lukas
--
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/wxNnSm5GGW0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.