This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes JDBC conncetion through context.xml SID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC conncetion through context.xml SID" Watch "JDBC conncetion through context.xml SID" New topic
Author

JDBC conncetion through context.xml SID

S Guru
Greenhorn

Joined: Jan 19, 2011
Posts: 8
Hi ,

In our application we are creating connection pool using context.xml. Everything works good if I give SID . If I change SID to service name..application raises exception. IS there any alternative to use Service name instead of SID in url?

Context.xml,

<Resource name="jdbc/Oracle-dev"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="abc"
password="abc"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc: oracle:thin:@10.112.200.29:1521:STT41"
maxWait="2000"
removeAbandoned="true"
maxActive="20"
maxIdle="10"
initialSize="5"
testOnBorrow="true"
validationQuery="select 1 from dual"
removeAbandonedTimeout="60"
logAbandoned="true"/>


Exception , when I change SID(STT41) to servicename(devstt),

SQLException when creating connection. error msg:Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
10.112.200.29:1521:devstt), error info:Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
10.112.200.29:1521:devstt
)
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Did you try this syntax? And what is wrong with SID?
S Guru
Greenhorn

Joined: Jan 19, 2011
Posts: 8
Thanks for the reply. Actually I resolved the issue earlier by giving the service name as host:port/servicename in the URL. It started working good. Anyway thanks for the link. In our side we are advised to use servicename instead of sid. Our production support team are planning not to support sid for some reason.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC conncetion through context.xml SID