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.  [ 12 posts ] 
Author Message
 Post subject: OCI driver exception
PostPosted: Tue Jan 22, 2008 12:01 pm 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
Hi,

I am trying to connect to a database through the OCI driver of Oracle 9, I was connecting ok through the Thin driver, and I connect correctly with the OCI driver in the Database Explorer of MyEclipse, but when I run the application I get the following exception:

org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.eliop.sherpa.model.TAreaManagerImpl.getListaAreas(TAreaManagerImpl.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.metaparadigm.jsonrpc.JSONRPCBridge.call(JSONRPCBridge.java:1122)
at com.metaparadigm.jsonrpc.JSONRPCServlet.service(JSONRPCServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: ORA-24387: Controlador de conexión no válido

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2349)
at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:1225)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2599)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
... 25 more

This is the hibernate.cfg.xml I am using:

<?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">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">xxxxx</property>
<property name="connection.url">jdbc:oracle:oci:@SHERPA</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="myeclipse.connection.profile">Oracle OCI Sherpa Connection</property>
<property name="connection.password">xxxxx</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

</session-factory>

</hibernate-configuration>

And this is the query I am executing:

Session sessionHibernate = HibernateSessionFactory.getSession();
Transaction transaction = sessionHibernate.beginTransaction();
try
{
Query q = sessionHibernate.createQuery(
"select distinct descripcion, descripcion "+
"from Tarea order by descripcion asc");
listaAreas.addAll(((ArrayList)q.list()));
transaction.commit();
}
catch (HibernateException e)
{
transaction.rollback();
throw e;
}

Thank you very much by your help.
J.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 22, 2008 1:07 pm 
Newbie

Joined: Tue Jan 22, 2008 5:40 am
Posts: 10
Location: Hungary
I think, the "oci" is not the "thin" interface. When you want to use the thin interface, you must write something similar:

<property name="connection.url">jdbc:oracle:thin:@localhost:1521:SHERPA</property>

You must know the ip (replace the "localhost" with the ip), and the port (this is often 1521).

I hope this will help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 23, 2008 4:46 am 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
Thank you very much, but I need to do it with the OCI driver, so I keep on waiting for answers :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 23, 2008 5:03 am 
Newbie

Joined: Tue Jan 22, 2008 5:40 am
Posts: 10
Location: Hungary
Ok, no problem. For the oci, you must have an installed oracle 9 client on your machine (or on the machine, where the hibernate runs). Maybe more installed clients can find on a computer. When you have more clients, it is the reason of the the posted error. (By more clients, the order of the installation is very important.)

An another reason can be: when you use an oracle 8 client for the oracle 9 database.

I suggest you to check the clients on the machine (by windows operation system in the registry, in the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE path.)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 23, 2008 5:46 am 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
Thank you very much, but I know that all those are correctly because I do queries correctly without hibernate, I must be having a problem with the hibernate configuration, the hibernate queries are done correctly because they work with the thin driver, but I need to do it with the OCI one.

Thanks a lot again.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 28, 2008 10:49 am 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
Can anybody tell me anything about this?

Thank you very much!
J.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 28, 2008 10:52 am 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
Can anybody tell me anything about this?

Thank you very much!
J.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 28, 2008 10:55 am 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
Can anybody tell me anything about this?

Thank you very much!
J.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 4:50 am 
Newbie

Joined: Tue Jan 22, 2008 5:40 am
Posts: 10
Location: Hungary
joseiru wrote:
Thank you very much, but I know that all those are correctly because I do queries correctly without hibernate...


Ok, we know:

1) The queries works outside hibernate.
2) The queries work inside hibernate, with thin interface.
3) The queries doesn't work in hibernate, with oci interface.

I have some questions.

1) Which tool use you outside the hibernate?
2) Have you more than 1 installed oracle tool/application on the computer?

(I think, the use of the oci interface does not require any installation in hibernate, the windows registry define the method for the database access. So i suspect: the problem is in your registry/installed applications, not in the hibernate.)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 7:06 am 
Newbie

Joined: Wed Jan 23, 2008 6:15 am
Posts: 6
Post value of "java.library.path" system property while execution of your program (before performing any hibernate-related actions)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 29, 2008 7:07 am 
Newbie

Joined: Wed Jan 23, 2008 6:15 am
Posts: 6
Post here value of "java.library.path" and "class.path" system properties while execution of your program (before performing any hibernate-related actions). This will help to determine if you are using same version of ojdbc14.jar and oracle native runtime...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 4:14 am 
Newbie

Joined: Tue Jan 22, 2008 11:47 am
Posts: 10
I have solved it changing the ocjdb14.jar by the classes12.jar library!!! It is quite strange if I am using jdk 1.6.... But it is solved :)

Thanks a lot by your help to both of you!
J.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.