title: How to setup a JDBC connection to MySQL in Spring3 MVC?
body: <p>I am working on a small web project in java and Spring3 MVC.  Although I have been studying java for the past 5 months, this is my first time making anything substantial with either of these technologies. </p>
  
  <p>The problem I am having is setting up a Mysql database connection using Dependency Injection in the Spring applicationContext.xml file.</p>
  
  <p>I build a new project in NetBeans and do the following:</p>
  
  <ol>
  <li>Include Spring3 with Dependency Injection</li>
  <li>Import mysql JDBC library</li>
  <li>Create a jdbc.properties file with associated name value pairs</li>
  <li>Run project (works fine)</li>
  <li>Configure Database connection in applicationContext.xml</li>
  <li>Re load Project </li>
  <li>Build Fails</li>
  </ol>
  
  <p>This is my applicationContext.xml and jdbc.properties</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:p="http://www.springframework.org/schema/p"
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;
  
  &lt;bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
        p:location="/WEB-INF/jdbc.properties" /&gt;
  
  &lt;bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        p:driverClassName="${jdbc.driverClassName}"
        p:url="${jdbc.url}"
        p:username="${jdbc.username}"
        p:password="${jdbc.password}" /&gt;
  
  &lt;!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) --&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>This is the jdbc.properties </p>
  
  <pre><code>driverClassName=com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/bcash
  username=root
  password=myPassword
  </code></pre>
  
  <p>I have spent the best part of a week trying to configure Spring3, I have also been reading through Spring in Action and Spring Recipes, but I can't seem to get past the first hurdle of just configuring the Spring Container.</p>
  
  <p>Am I overlooking something simple?  </p>
  
  <p>Any help is truly appreciated, thanks in advance</p>
  
  <p>UPDATE
  Buid error message</p>
  
  <pre><code>/home/bcash/NetBeansProjects/bcash.com/nbproject/build-impl.xml:726: The module has not been deployed.
  See the server log for details.
  BUILD FAILED (total time: 6 seconds)
  </code></pre>
  
  <p>Corresponding build-XML line message  </p>
  
  <pre><code>&lt;nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/&gt;
  </code></pre>