0
<bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName"
                  value="????????????????????" />        
     <property name="url"
                  value="???????????????????????"/>
        <property name="username" value="root" />
        <property name="password" value="" />
    </bean>

I am not able to figure out what should go in driver class name value and url vale. I have downloaded Oracle sql developer and oracle 11 g.But i am not sure how to configure it to my java application

1
  • driverClassName should be "oracle.jdbc.driver.OracleDriver" and the url should be "jdbc:oracle:thin:@<HOST>:1521:<SID>" Commented Jan 21, 2015 at 5:15

2 Answers 2

1

Driver class name:- oracle.jdbc.driver.OracleDriver
URL :- jdbc:oracle:thin:@(hostname):(port number):(database name)

<bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName"
                  value="oracle.jdbc.driver.OracleDriver" />        
     <property name="url"
                  value="jdbc:oracle:thin:@(hostname):(port number):(database name)"/>
        <property name="username" value="root" />
        <property name="password" value="" />
</bean>
Sign up to request clarification or add additional context in comments.

1 Comment

As i am new to this,can u pls tel me which jars i need to install and if oracle sql developer is enough..and if we need oracle 11g
1

Your qustion is not clear if you are using Spring framework there are two type of Data source handling technique

Method 1 you need to configure data source in your application server

 <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName" value="java:jboss/datasources/OracleDS" />
		<property name="cache" value="false"/>
    	<property name="lookupOnStartup" value="false"/>
        <property name="proxyInterface" value="javax.sql.DataSource"/>
	</bean>

Method 2

 <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
 		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
		<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:OMQA" />
		<property name="username" value="root" />
		<property name="password" value="password" />
	</bean> 

3 Comments

Hi. I am using Spring framework, So i want to know how can i configure oracle database . what jars and database i shd use
go to this link and dowload realated jar link
this online tutorial might be help to you [link]mkyong.com/spring/maven-spring-jdbc-example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.