Announcement Announcement Module
No announcement yet.
"Could not get JDBC Connection" Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Could not get JDBC Connection"

    I've been tryin for 2 days now to figure this out, and all for nothing...
    I have a Sql Server 2005 database which i use in my java app. I work in eclipse and i have no problem connecting to my DB using SqlExplorer plugin, queries work just fine, but when i run my app i get this :

    Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The TCP/IP connection to the host JOANNA-PCSQLEXPRESS, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".)
    I checked and SqlServer accepts TCP/IP connections, port is 1433, i even added exceptions in my win firewall for sqlserver.

    My appContext.xml looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=""

    <bean id="adminDep" class="depozit.DepozitAdministratorJDBC">
    <property name="dataSource" ref="dataSource" />

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${db.driver}" />
    <property name="url" value="${db.url}" />
    <property name="username" value="${db.user}" />
    <property name="password" value="${}" />

    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">


    And iver

    What's wrong?
    Last edited by ioanamincic; Mar 7th, 2010, 01:16 PM.

  • #2
    There is clearly a problem with the URL that you are using because it thinks that the host name is: "JOANNA-PCSQLEXPRESS".

    Try adding a second backslash in the url since it is being read from a properties file and it is probably trying to escape the 'S' in SQLEXPRESS when the properties are loaded:



    • #3
      Thanks very much problem solved