Hi,
We have been struggling with this for some time: OPENJPA-580 and OPENJPA-760.
If you know up-front what database your application will connect to, it's safer
to specify DBDictionary explicitly instead of relying on DBDictionary
auto-detection.
Cheers,
Milosz
> Seems like a bug related to the following code in
> DBDictionaryFactory.java, where the connection URL is being inspected
> before the driver name -
>
>
> public static DBDictionary calculateDBDictionary(JDBCConfiguration
> conf, String url, String driver, String props) {
> String dclass = dictionaryClassForString(getProtocol(url),conf);
> if (dclass == null)
> dclass = dictionaryClassForString(driver, conf);
> if (dclass == null)
> return null;
> return newDBDictionary(conf, dclass, props);
> }
>
>
> The above calls the below method, which performs simple substring
> compares for the supported databases -
>
> private static String dictionaryClassForString(String prod
> , JDBCConfiguration conf) {
> if (StringUtils.isEmpty(prod))
> return null;
> prod = prod.toLowerCase();
>
> PluginValue dbdictionaryPlugin = ((JDBCConfigurationImpl) conf)
> .dbdictionaryPlugin;
>
> if (prod.indexOf("oracle") != -1)
> return dbdictionaryPlugin.unalias("oracle");
> if (prod.indexOf("sqlserver") != -1)
> return dbdictionaryPlugin.unalias("sqlserver");
> if (prod.indexOf("jsqlconnect") != -1)
> return dbdictionaryPlugin.unalias("sqlserver");
> if (prod.indexOf("mysql") != -1)
> return dbdictionaryPlugin.unalias("mysql");
> if (prod.indexOf("postgres") != -1)
> return dbdictionaryPlugin.unalias("postgres");
> . . .
>
>
> -Donald
>
>
>
> Milinda Pathirage wrote:
> > Hi Devs,
> >
> > There is a strange bug which caused JDBC exceptions when my embdded derby
> > path contains directory called 'mysql' or 'oracle'. I am using OpenJPA 1.1.
> > Is this a known bug. When this happens embedded derby URL is look like
> > following:
> >
> > jdbc:derby:/home/milinda/mysql/bps/database/daojpa
> >
> > Do anyone have any idea about the reason for incorrect generation of
> > prepared statement.
> >
> > Thanks
> > Milinda
> >
> >
> >