-->
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.  [ 2 posts ] 
Author Message
 Post subject: problem with connecting oracle
PostPosted: Fri Apr 20, 2007 6:05 am 
Beginner
Beginner

Joined: Mon Feb 05, 2007 2:33 am
Posts: 32
am getting the following error while connecting with the oracel stuff. but the hibernateplugin have been initiated. after that while connecting to a particular table its showing me the following error .

Hibernate version:hibernate3.0

[b]Mapping documents:

<?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 name="SessionFactory">
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hibernate.cache.region_prefix">hibernate.test</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">gnayagam</property>
<property name="hibernate.connection.pool_size">1</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@192.163.1.51:1521:sotdb</property>
<property name="hibernate.connection.username">gnayagam</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.jdbc.batch_versioned_data">true</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.max_fetch_depth">1</property>
<property name="hibernate.proxool.pool_alias">pool</property>
<property name="hibernate.query.substitutions">yes 'Y', no 'N'</property>
<mapping resource="hibernate/tables.hbm.xml" />
</session-factory>
</hibernate-configuration>



Tables.hbm.xml



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Feb 16, 2007 10:30:05 AM by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
<class name="com.DAO.userLogin" table="userLogin" catalog="challenge">
<comment></comment>
<id name="id" type="string">
<column name="id" />
<generator class="assigned" />
</id>
<property name="username" type="string">
<column name="username">
<comment></comment>
</column>
</property>
<property name="password" type="string">
<column name="password">
<comment></comment>
</column>
</property>
</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

ServletContext context = req.getSession().getServletContext();
SessionFactory _factory = (SessionFactory) context.getAttribute(ChallengePlugIn.SESSION_FACTORY_KEY);
Session session = _factory.openSession();
System.out.println("came to dao");
return session.createSQLQuery("select username,password from userLogin where username ='" + userName + "' and password ='" + password+"'").list();



Full stack trace of any exception that occurs:

org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException
(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager
.java:327)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.
java:118)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatc
her.java:105)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1672)

at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:
147)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
at com.DAO.userLogin.check(userLogin.java:58)
at com.BO.userLoginActionBo.checkLogin(userLoginActionBo.java:24)
at com.action.sample.UserLoginAction.checkLogin(UserLoginAction.java:43)

at com.action.sample.UserLoginAction.handleAction(UserLoginAction.java:3
0)
at com.action.ChallengeAction.execute(ChallengeAction.java:39)
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:119
6)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Listener refused the connection with the follo
wing error:
ORA-12505, TNS:listener does not currently know of SID given in connect descript
or
The Connection descriptor used by the client was:
192.168.1.51:1521:sotdb

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:261)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
439)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
n.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnectio
n(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager
.java:324)
... 37 more

Name and version of the database you are using:oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 20, 2007 8:28 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Says right in your log ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

Use the right SID, eh?


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