reset password
Author Message
aphopha
Posts: 13
Posted 23:36 Jan 20, 2016 |

Hello Dr. Sun,

When i am trying to connect postgresql,  i am getting following error:

 org.hibernate.exception.JDBCConnectionException: Could not open connection

How to solve this error?

pchavda
Posts: 12
Posted 23:52 Jan 20, 2016 |

First Check for version of postgresql in pom.xml, i used 9.4-1206-jdbc4 version it worked for me.

and modify applicationContext.xml as following

<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"

        destroy-method="close">

        <property name="driverClassName" value="org.postgresql.Driver" />

        <property name="url" value="jdbc:postgresql://localhost:5432/gapp" />// name of data base in pgadmin

        <property name="username" value="gapp" /> 

        <property name="password" value="abcd" />

        <property name="initialSize" value="1" />

</bean>

 

thanks

aphopha
Posts: 13
Posted 01:37 Jan 21, 2016 |

Hi Parth,

I have used the same version of postgresql and applicationContext file is also the same but still its not working.

 

 

cysun
Posts: 2935
Posted 09:23 Jan 21, 2016 |

Check if the PostgreSQL service is running.

Check if the service is running at the port specified in applicationContext.xml.

Check if you have some anti-virus/firewall software blocking the port.

aphopha
Posts: 13
Posted 22:22 Jan 22, 2016 |

Hello Dr. Sun,

I have changed jdk 1.7 to jdk 1.8 and also i have changed my postgresql version from 9.5 to 9.4 but still it show me the same error.

How should i solve this problem?

 

Thanks

cysun
Posts: 2935
Posted 17:33 Jan 24, 2016 |
aphopha wrote:

Hello Dr. Sun,

I have changed jdk 1.7 to jdk 1.8 and also i have changed my postgresql version from 9.5 to 9.4 but still it show me the same error.

How should i solve this problem?

 

Thanks

I don't know. If you haven't fixed it yet, please bring your laptop to my office hours on Monday.

aphopha
Posts: 13
Posted 21:00 Jan 24, 2016 |

Hello Dr. Sun,

Ok. I will be there during your office hours.

 

Thanks