Announcement Announcement Module
No announcement yet.
Failing to load Microsoft JDBC Driver Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Failing to load Microsoft JDBC Driver

    I am new to both the Java world and the Spring world, so there is a lot to learn. I am working on getting the Spring Framework JDBC working. I am finally to the point where the application is not able to find Microsoft's JDBC Driver. I am 99.9% sure the reason is that I don't have it referenced correctly within STS. Ideally I would prefer NOT to have to copy the jar file, but at this point, I am willing to do anything it takes to get it to work.

    This Spring Application Context File seems to load correctly. In the same project, I was able to use Class.forName(" ") to set and load the jdbc driver with the old fashion JDBC framework. At the current time, I am simply including the Microsoft JDBC jar (sqljdbc4.jar) as a lib in the .classpath file:

    <?xml version="1.0" encoding="UTF-8"?>
    	<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"/>
    Here is the app-context.xml file:

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

        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        	<property name="driverClassName" value=""/>
        	<property name="url" value="jdbc:sqlserver://localhost;databaseName=ProSpringCh8"/>
        	<property name="username" value="****"/>
        	<property name="password" value="****"/>
        <context:property-placeholder location="" />
        <bean id="contactDao" class="com.accumed.DatabaseTest.dao.jdbc.xml.JdbcContactDao">
            <property name="dataSource">
                <ref local="dataSource"/>

  • #2
    Someone on another forum found the solution:

    The SQL Server JDBC driver class is, not