title: SPRING 3 MVC - MySQL JDBC DataBase Connection Configuration
body: <p>Lost in the multitude of  Java API's and XML configuration.</p>
  
  <p>I am trying to create an app with the Spring MVC but struggling with the XML configuration.</p>
  
  <p>I want to be able to connect to a mysql database... but I am struggling to find any concise way of how to do it.  I do not want to use  Hibernate or any additional frameworks, the JDBC will be adequate on it's own.</p>
  
  <p>I would just like to be able to create a database connection and access to a String variable that can change the query as necessary.  I think the problem lies within the xml configuration, but I may be wrong.</p>
  
  <p>I have pasted the details shown below in the application-context.xml file, but the server cannot be built unless I remove them.  I am not sure if I am missing something simple! </p>
  
  <pre><code>&lt;bean id="JdbcDao" class="com.bcash.DbAccess.JdbcDao"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;      
  
  &lt;bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        p:driverClassName="com.mysql.jdbc.Driver"
        p:url="jdbc:mysql://localhost:3306/db_name"
        p:username="root"
        p:password=""
        destroy-method="close" /&gt;
  </code></pre>
  
  <p>This is the associated class that I wrote for the xml declaration</p>
  
  <pre><code>package com.bcash.DbAccess;
  
  import javax.sql.DataSource;
  import org.springframework.dao.DataAccessException;
  import org.springframework.jdbc.core.JdbcTemplate;
  
  public class JdbcDao {
  
  private JdbcTemplate jdbcTemplate;
  protected String query = "INSERT INTO    user('username','email','password','access_level') VALUES ('admin','test@test.com','testPassWord','admin')";
  
  
  public void insertUser(){
  
      try{
          jdbcTemplate.update(query);
  
      } catch(DataAccessException e){
  
         String error =  e.getMessage();
         System.out.println(error);
  
      }
  
  }
  
  }
  </code></pre>
  
  <p>The only error that I get is that the server could not be deployed on line 726 of the ant build script</p>
  
  <pre><code>&lt;target if="netbeans.home" name="-run-deploy-nb"&gt;
      &lt;nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>Although, I am okay with PHP, I am a little confused as I am fairly new to Java.  </p>
  
  <p>Thanks in advance </p>