-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Oracle connection: get tables
PostPosted: Thu Jun 19, 2008 12:02 pm 
Newbie

Joined: Fri Jun 13, 2008 10:17 am
Posts: 18
Oracle 8.1.7
Hibernate tools 3.2.2GA

I sadly test every drivers:
Oracle Database 11g Release 1
Oracle Database 10g Release 2
Oracle Database 10g
Oracle9i Release 2
Oracle9i Release 1
Oracle8i Release 2

cfg.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.1.123:1521:CETIUM</property>
        <property name="hibernate.default_schema">VARIETE</property>
        <property name="hibernate.connection.username">VARIETE</property>
        <property name="hibernate.connection.password">VARIETE</property>
        <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    </session-factory>
</hibernate-configuration>



Sorry for posting about a problem ever discussed, but i rode all posts without a solution.

In hibernate configuration, when i expand the database menu, the following error is launched:



Code:
org.hibernate.exception.SQLGrammarException: Could not get list of tables from database. Probably a JDBC driver problem.
Configured schema:VARIETE
Configured catalog:null
Available schemas:
  ADAMS
  AURORA$JIS$UTILITY$
  AURORA$ORB$UNAUTHENTICATED
  BLAKE
  CLARK
  CTXSYS
  DBSNMP
  JONES
  MDSYS
  MTSSYS
  ORDPLUGINS
  ORDSYS
  OSE$HTTP$ADMIN
  OUTLN
  SCOTT
  SYS
  SYSTEM
  VARIETE
Available catalogs:

   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
   at org.hibernate.cfg.reveng.dialect.OracleMetaDataDialect.getTables(OracleMetaDataDialect.java:257)
   at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:476)
   at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:74)
   at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:111)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
   at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:102)
   at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:59)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.sql.SQLException: ORA-00933: La commande SQL ne se termine pas correctement

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
   at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
   at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:813)
   at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
   at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
   at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415)
   at org.hibernate.cfg.reveng.dialect.OracleMetaDataDialect.getTableResultSet(OracleMetaDataDialect.java:672)
   at org.hibernate.cfg.reveng.dialect.OracleMetaDataDialect.getTables(OracleMetaDataDialect.java:221)
   ... 9 more


Any ideas?
Thanks by advance

Regards,
Slimane.


Top
 Profile  
 
 Post subject: OracleMetaDataDialect is NOT 8i compliant...
PostPosted: Mon Jul 07, 2008 10:14 am 
Newbie

Joined: Mon Jul 07, 2008 10:04 am
Posts: 4
I am experiencing the same issue. An example of the OraclePreparedStatement SQL that is executed is as follows:

select a.table_name, a.owner, b.comments, 'TABLE' from all_tables
[b]a left join[/b] all_tab_comments
b on (a.owner=b.owner and a.table_name=b.table_name)
where a.owner = FAIR
union all select view_name, owner, NULL, 'VIEW' from all_views
where owner = FAIR


The "a left join" is valid for Oracle 9 and above but is INVALID for 8i where it uses the ridiculous "(+)" syntax...therefore the OracleMetaDataDialect is NOT 8i compatible nor is it truly extensible (i.e. private methods and constants). Either open a defect against the class or extend AbstractMetaDataDialect with a copy of OracleMetaDataDialect replaceing the existing SQL constants w/ 8i compatible equivalents. I am not familiar w/ 8i syntax since is has been 10 years since I used it. However, I do know that a simple substitution of the [i]join[/i] phrase with the [i]parenthetically enclosed plus sign[/i] is invalid.

It you find a solution...please post.


Top
 Profile  
 
 Post subject: JDBCMetaDataDialect is failing also...
PostPosted: Mon Jul 07, 2008 10:22 am 
Newbie

Joined: Mon Jul 07, 2008 10:04 am
Posts: 4
btw...You can explicitly replace the auto used OracleMetaDataDialect with the generic JDBCMetaDataDialect detailed as follows:

Quote:
The OracleMetaDataDialect is now enabled by default for Oracle related dialects. The Oracle specific handling have also been improved greatly so now it is much faster than normal JDBC MetaData API.

If you experience issues with the OracleMetaDataDialect you can fall back to using the JDBC MetaData API by adding the following property to your hibernate.properties or hibernate.cfg.xml:

hibernatetool.metadatadialect=org.hibernate.cfg.rveng.dialect.JDBCMetaDataDialect


However, I encountered the following exception:

at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:186)
... 16 more
Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.j
ava:4541)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl
.java:666)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:137
4)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDB
CMetaDataDialect.java:37)
at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIter
ator.java:59)
... 30 more


Top
 Profile  
 
 Post subject: MetaDataDialect override quote is has typo...
PostPosted: Mon Jul 07, 2008 10:34 am 
Newbie

Joined: Mon Jul 07, 2008 10:04 am
Posts: 4
The quote in the previous post contains a typo (i.e. missing the first "e" in reveng portion of the JDBCMetaDataDialect class path):


Code:
hibernatetool.metadatadialect=org.hibernate.cfg.r[size=18]e[/size]veng.dialect.JDBCMetaDataDialect


Therefore, in addition to fixing thle OracleMetaDataDialect class...the following notes should be corrected:

http://www.hibernate.org/hib_docs/tools/eclipse/newandnoteworthy/hibernate-eclipse-news-3.2.0.beta9.html


Top
 Profile  
 
 Post subject: Oracle 8ized OracleMetaDataDialect
PostPosted: Tue Jul 08, 2008 2:42 pm 
Newbie

Joined: Mon Jul 07, 2008 10:04 am
Posts: 4
I replaced the ANSI "join" clauses w/ what I believe to be the appropriate Oracle 8i "(+)" syntax. Subsequently JBoss Seam 2.0.2.SP1 that uses Hibernate reverse generation completed successfully (i.e. no SQL exceptions).

View HBX-1071 for java class:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1071


Top
 Profile  
 
 Post subject: Re: MetaDataDialect override quote is has typo...
PostPosted: Fri Mar 27, 2009 8:03 am 
Newbie

Joined: Fri Mar 27, 2009 8:00 am
Posts: 1
[quote="openbar247"]The quote in the previous post contains a typo (i.e. missing the first "e" in reveng portion of the JDBCMetaDataDialect class path):


Code:
hibernatetool.metadatadialect=org.hibernate.cfg.r[size=18]e[/size]veng.dialect.JDBCMetaDataDialect



Hello, usually I don't like to register to forum, but your suggestion was too much usefull to me to go away without saying to you at least a thank you.

The Oracle 8i Meta dialect has very big problem. With you suggestion I was able to use Hibernate with Netbeans.

Thank you really a lot!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.