- This topic has 2 replies, 2 voices, and was last updated 17 years, 6 months ago by Matt Bucknam.
-
AuthorPosts
-
Matt BucknamParticipantHave this in spring configuration file:
<!– testing –>
<bean id=”dataSource”
class=”org.springframework.jdbc.datasource.DriverManagerDataSource”>
<property name=”driverClassName”>
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name=”url”>
<value>jdbc:oracle:thin:@xxxxxx:1521:xxxxxx</value>
</property>
<property name=”username”>
<value>xxxxxxx</value>
</property>
<property name=”password”>
<value>xxxxxxxx</value>
</property>
</bean>Can autocomplete and dynamic translator works great. When select to run HQL get this error message in Hibernate Query Result window:
org.hibernate.exception.JDBCConnectionException: Cannot open connection
Get this in eclipse error log:
!SESSION 2007-06-11 16:38:11.796 ———————————————–
eclipse.buildId=M20070212-1330
java.version=1.6.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -showlocation
Command-line arguments: -os win32 -ws win32 -arch x86 -showlocation!ENTRY org.eclipse.wst.internet.cache 1 0 2007-06-11 16:38:19.856
!MESSAGE wtp.autotest.noninteractive is set. Licenses dialogs will not be displayed.!ENTRY com.genuitec.org.hibernate.eclipse.console 4 150 2007-06-11 16:38:42.445
!MESSAGE Exception while executing HQL Query
!SUBENTRY 1 com.genuitec.org.hibernate.eclipse.console 4 150 2007-06-11 16:38:42.445
!MESSAGE org.hibernate.exception.JDBCConnectionException: Cannot open connection
!STACK 0
org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.console.HQLQueryPage.getList(HQLQueryPage.java:48)
at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:320)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:309)
at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction$ExecuteHQLJob.run(MEExecuteHQLAction.java:91)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@xxxxxx:1521:xxxxxx
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:291)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:277)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:259)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:240)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
… 19 more
!SUBENTRY 2 com.genuitec.org.hibernate.eclipse.console 4 150 2007-06-11 16:38:42.447
!MESSAGE org.hibernate.exception.JDBCConnectionException: Cannot open connection
!STACK 0
org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.console.HQLQueryPage.getList(HQLQueryPage.java:48)
at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:320)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:309)
at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction$ExecuteHQLJob.run(MEExecuteHQLAction.java:91)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@xxxxxxx:1521:xxxxxx
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:291)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:277)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:259)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:240)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
… 19 more
!SUBENTRY 2 com.genuitec.org.hibernate.eclipse.console 4 150 2007-06-11 16:38:42.447
!MESSAGE java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@xxxxxxxx:1521:xxxxxxx
!STACK 0
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@xxxxxxx:1521:xxxxxxx
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:291)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:277)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:259)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:240)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.console.HQLQueryPage.getList(HQLQueryPage.java:48)
at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:320)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:309)
at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction$ExecuteHQLJob.run(MEExecuteHQLAction.java:91)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)change to this in spring config file and all is well:
<bean id=”dataSource” destroy-method=”close” class=”org.apache.commons.dbcp.BasicDataSource”>
<property name=”driverClassName” value=”oracle.jdbc.driver.OracleDriver”/>
<property name=”url” value=”jdbc:oracle:thin:@xxxxxxx:1521:xxxxxxx”/>
<property name=”username” value=”xxxxxxx”/>
<property name=”password” value=”xxxxxxx”/>
</bean>
–>Any ideas?
Brian FernandesModeratorHi,
MyEclipse must extract information from the spring configuration file itself – this particular module was is only capable of handling a BasicDataSource bean and not a DriverManagerDataSource bean which you used in the first snippet.
This seems to be the reason why the first snippet fails and the second works, I’m filing this as a bug and will ask our Spring dev to take a look at this.
Sorry for the inconvenience caused, please let me know if you require further assistance.
Matt BucknamParticipantThanks Brian. That isn’t really a problem as the HQL editor functionality is so amazing I can live with using a basic data source for now. I just wanted to be sure I wasn’t missing anything.
-
AuthorPosts