Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8839263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:12:02+00:00 2026-06-14T10:12:02+00:00

I am new to Java, Spring, and Eclipse. I am working on a simple

  • 0

I am new to Java, Spring, and Eclipse. I am working on a simple Spring program that is using Spring Framework JDBC to connect to Microsoft SQL Server 2012. With the correct configuration I have succeeded in using the traditional JDBC to talk to the database. The problem I am running into is the application is not able to find the Microsoft JDBC driver. I am assuming it is simply a matter of referencing the JAR file differently. Here is what I currently have for my classpath file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
    <classpathentry kind="lib" path="C:/Program Files/Microsoft JDBC Driver 4.0 for SQL Server/sqljdbc_4.0/enu/sqljdbc4.jar"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

And here is the app-context.xml file:

<?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:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
      http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.Driver"/>
        <property name="url" value="jdbc:sqlserver://localhost;databaseName=ProSpringCh8"/>
        <property name="username" value="****"/>
        <property name="password" value="****"/>
    </bean>

    <context:property-placeholder location="jdbc.properties" />

    <bean id="contactDao" class="com.accumed.DatabaseTest.dao.jdbc.xml.JdbcContactDao">
        <property name="dataSource">
            <ref local="dataSource"/>
        </property>
    </bean>

</beans>

I am running it from within Eclipse’s debugger. The errors I am getting are:

09:28:19,711 DEBUG g.springframework.jdbc.core.JdbcTemplate: 635 - Executing prepared SQL query
09:28:19,726 DEBUG g.springframework.jdbc.core.JdbcTemplate: 570 - Executing prepared SQL statement [select first_name from contact where id = ?]
09:28:19,774 DEBUG ramework.jdbc.datasource.DataSourceUtils: 110 - Fetching JDBC Connection from DataSource
Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.Driver'
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
    at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:729)
    at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:745)
    at com.accumed.DatabaseTest.dao.jdbc.xml.JdbcContactDao.findFirstNameById(JdbcContactDao.java:55)
    at com.accumed.DatabaseTest.JdbcContactDaoSample.main(JdbcContactDaoSample.java:21)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.Driver'
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
    ... 12 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:12:04+00:00Added an answer on June 14, 2026 at 10:12 am

    The SQL Server JDBC driver class is com.microsoft.sqlserver.jdbc.SQLServerDriver, not com.microsoft.sqlserver.jdbc.Driver

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

new to Laravel (coming from Java spring), while using Route::get('/', function() { return Hello
I have been using the new feature of Spring 3.1.1 the java based configuration.
I've created this simple program in Eclipse: import java.util.*; import java.io.*; public class prob1
I am working in Eclipse and am using 2 Java Files: Admin.java and SemanticSearch.java.
I am working on some application that must start another app using Java web
I am working on eclipse plugin that will allow a java bean to be
I'm new to Spring and AOP in Java (though I've done some related stuff
I know this might be a simple question but Im new to Java, my
I am using a simple app to aid learning database with Apache.Derby and working
Okay, so I'm working on a project where I use a Java program to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.