I am trying to cretae a JDBC connection through datasource object with DriverManagerDatasorce.each time i run my appllication am getting

Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver] exception i have added ojdbc6 jar to my classpath eventhough am getting this exception

...Any suggests what i have missed.

I also tried with basicDataSource and still got same...Is that i need to arrange any configuration in server in order to get connection.

Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]

Here Is My configuration :

<beanclass="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property> <property name="url" value="jdbc:oracle:thin:localhost:1521:orcl"></property> <property name="username" value="SCOTT"></property> <property name="password" value="34268"></property> </bean> 
13

2 Answers

You can check whether the driver class is found in project or not by adding below test code,

try { Class.forName("oracle.jdbc.driver.OracleDriver"); //on classpath } catch(ClassNotFoundException e) { // not on classpath } 
0

Finally found... By enabling connection pool in my server successfully connected with database. added below configuration in server context.xml and placed ojdbc jar in servers lib folder.

Thanks for effort and time....:))

<Resource name="DSJNDI" type="javax.sql.DataSource" authenticate="container" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:orcl" username="SCOTT" password="34268" maxActiver="20" maxIdle="10" validationQuery="SELECT SYSDATE FROM DUAL" /> 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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