#2828 is now implemented for jOOQ 3.3. The "Database" name can thus be omitted, as the default jOOQ-Meta Database implementation will be inferred from the JDBC URL through JDBCUtils.dialect(url). Obviously, this may not always work, depending on your URL, which may not be unambiguous.
Cheers Lukas 2013/11/3 Lukas Eder <[email protected]> > Hello, > > 2013/11/3 <[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(java.lang.String) > > 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 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.
