[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3200) Dialect auto-detection provides misleading error message

Gino A Melone (JIRA) noreply at atlassian.com
Tue Mar 25 11:58:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29874 ] 

Gino A Melone commented on HHH-3200:
------------------------------------

Arg.  Somehow I submitted that while still typing.  The bit of code should look like:
			try {
				Connection conn = connections.getConnection();
				connectionMade = true;
				try {
<...>
	if (!useJdbcMetadata || connectionMade) {
		//SQL Dialect:
		Dialect dialect = determineDialect( props, databaseName, databaseMajorVersion );
		settings.setDialect(dialect);
	} else {
		throw new HibernateException( "Unable to connect to DB, dialect can not be determined.");
	}

> Dialect auto-detection provides misleading error message
> --------------------------------------------------------
>
>                 Key: HHH-3200
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3200
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.5, 3.2.6
>         Environment: I'm testing with 3.2.5.ga, Windows XP SP2, and SQL Server 2000.  However, I'm fairly certain this will affect any OS/DB combination.
>            Reporter: Gino A Melone
>
> If the DB connection is unable to be created in org.hibernate.cfg.SettingsFactory.buildSettings(Properties props), the error message that is returned indicates "Hibernate Dialect must be explicitly set".  This message is misleading.  The real problem is that auto-detection can not work because the DB connection failed and the metadata could not be retrieved.  A warning is issued that explains this, but production environments often disable log4j warnings for third-party packages to maintain reasonable-sized log files.
> The failure to create a connection should be used to generate a useful error message.  Something like:
> 		//SQL Dialect:
> 		Dialect dialect = determineDialect( props, databaseName, databaseMajorVersion );
> 		settings.setDialect(dialect);
> The relevant log entries are below.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list