spring - could not establish connection with postgresql database -



spring - could not establish connection with postgresql database -

i'm developing web application using spring 4.0.5 , hibernate 4.3.5.

when run xhtml page error :

java.sql.sqlexception: no suitable driver

and

java.sql.sqlexception: connections not acquired underlying database!

how can solve these problems ?

here application context file spring :

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <bean id="datasource" class="com.mchange.v2.c3p0.combopooleddatasource"> <property name="user" value="postgres" /> <property name="driverclass" value="org.postgresql.driver"/> <property name="jdbcurl" value="jdbc:postgresql://localhost:5432/test" /> <property name="password" value="toor"/> </bean> <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="datasource" ref="datasource"/> <property name="packagestoscan" value="com.model" /> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.postgresqldialect</prop> <prop key= "hibernate.connection.provider_class">org.hibernate.connection.c3p0connectionprovider</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.c3p0.acquire_increment">1</prop> <prop key="hibernate.c3p0.minpoolsize">10</prop> <prop key="hibernate.c3p0.maxpoolsize">200</prop> <prop key="hibernate.c3p0.timeout">9999999</prop> <prop key="hibernate.c3p0.max_statement">0</prop> </props> </property> </bean> <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory"/> </bean> <tx:annotation-driven transaction-manager="transactionmanager"/> <context:annotation-config /> <context:component-scan base-package="com"/> </beans>

for postgresql driver i'm working postgresql-9.3-1101.jdbc4.jar

make sure postgresql-9.3-1101.jdbc4.jar within web-inf/lib directory if application j2ee application or within classpath if standalone application.

spring hibernate postgresql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -