-
Feb 4th, 2010, 10:50 PM
#1
Two different datasource
I have two different datasource as below one is from pool(jndiName) and the other one is from defaultObject
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>java:/myPool</value>
</property>
<property name="resourceRef">
<value>true</value>
</property>
<property name="defaultObject" ref="myDataSource"/>
</bean>
<bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
Advantage of using the two different datasource is, if connection pool get fail automatically defaultObject will be used...
Question:
In my case, if problem in connection pool, getting java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Then tehre is no use of JndiObjectFactoryBean...
what i have done mistake ?
-
Feb 5th, 2010, 12:27 AM
#2
Hi
"The Network Adapter could not establish the connection" is usually Oracle's way of telling that your code cannot connect to properly configured database.
So it probably isn't problem with Spring - it looks like your placeholders are properly configured. Just there is no database (or SID) at the specified location.
regards
Grzegorz Grzybek
-
Feb 5th, 2010, 12:50 AM
#3
I tried the connection as follows,
1) Commented the defaultObject and bean "myDataSource" tried with connection using jndi no issue
2) Commented the jndi property and connection was success
It shows clearly no issue in the placeholders.
-
Feb 5th, 2010, 12:53 AM
#4
By "no issue" you mean "no connection" or "no problems"?
what app server do you use (in the sense of JNDI provider)?
-
Feb 5th, 2010, 01:01 AM
#5
I can able to get the connection...only if i used any one( jndi or defaultObject )
app server is jboss-4.2.3
If i used both jndi and defaultObject
and defining the wrong configuration in jndi
Expected output:
If jndi fails the connection should get from defaultObject
Acutal output:
I am getting the exception as "The Network Adapter could not establish the connection"
what might be the issues...?
Last edited by springbeginners; Feb 5th, 2010 at 02:24 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules