1

I've created a little test app as a console program in java that tries to work with hibernate, and I'm trying to connect to an instance of SQL-Server-2008. But when I run my app I'm getting an error stating that it can't find the JDBC driver.

Now I've created the project as a maven project so if the driver is available as a maven dependency that would be great, although I couldn't find it. I do however have the actual .jar file, but I have no idea where to put this in my project structure. Which look like this:

enter image description here

So.. any help would greatly be appreciated! Thanks :)

  • If you have jar file then Right Click on project, Go to Build Path, Go to Configure Build Path, Go to Libraries, Click on "Add External Jars" and select your jar. It will add jar to your project and test it again – Neeraj Jul 11 '14 at 10:33

1 Answers1

0

Download it from http://msdn.microsoft.com/en-us/sqlserver/aa937724 and then install

mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=3.0 -Dpackaging=jar

Once you include it using maven, it is referenced from maven directory.

Ninad Pingale
  • 6,801
  • 5
  • 32
  • 55
  • That's very much not portable to have to manually install a dependency into your local repository first. This thread shows how to setup a system dependency instead so you can just put the jar in your project and reference it from there: http://stackoverflow.com/questions/6942407/setting-up-maven-dependency-for-sql-server . – Gimby Jul 10 '14 at 13:26