0

I am running Eclipse Luna 1a(4.4.1) on a Mac. This source line:

com.microsoft.sqlserver.jdbc.SQLServerDataSource;

gives this error: com.microsoft cannot be resolved to a type.

I have the path to sqlserverjdbc.jar defined in class path variables:

Classpath preferences

So I'm missing something. I'd appreciate knowing what.

Andreas
  • 154,647
  • 11
  • 152
  • 247
Bob
  • 1
  • 1
  • Why did you post a screenshot of the global `Classpath Variables`? They have no meaning unless *used* in a project to add an entry to the build path. – Andreas Jan 21 '17 at 02:49
  • Because other posts regarding this question say that the class path variable needs to be set. I defined the variable SQL there, showing the path to the sql library. I want to verify that I'm doing it right. New question: is it? BTW, it would be helpful to know what posting this is supposed to be a copy of. – Bob Jan 21 '17 at 05:05
  • Well, if you look above the question text, below the title, there is a yellow box with the text "**This question already has an answer here:**" and a link below it with the text "[How to import a jar in Eclipse](http://stackoverflow.com/questions/3280353/how-to-import-a-jar-in-eclipse)". *That* is what your question is a duplicate of, i.e. how to *correctly* configure the class path in Eclipse. – Andreas Jan 21 '17 at 10:07
  • I don't know where you read that you should configure `Classpath Variables` in Eclipse, but I suspect you're confusing the `CLASSPATH` *environment variable*, used when compiling/running from the command-line, with the `Java Build Path` used in Eclipse for the same thing. – Andreas Jan 21 '17 at 10:11
  • I've imported the sqlserverjdbc.jar, but that does not affect the error message (com.microsoft…) Is there some other jar file I need? – Bob Jan 25 '17 at 12:11
  • Don't know where you got that .jar file, but MS SQL JDBC files [downloaded from Microsoft](http://go.microsoft.com/fwlink/?LinkId=245496) are named `sqljdbc.jar` (Java 5), `sqljdbc4.jar` (Java 6), `sqljdbc41.jar` (Java 7), or `sqljdbc42.jar` (Java 8). – Andreas Jan 25 '17 at 18:32
  • Also, I don't understand how this is a duplicate of the other post when I never asked about importing a jar file. It would make sense of that solved the problem, but it doesn't. – Bob Jan 25 '17 at 19:47
  • It's a duplicate, not because the question is the same, but because the answer is, i.e. how to correctly add a jar file to the build path so the classes in the jar file can be used by your code, and what you were doing was entirely wrong for that. Now, it seems you might also be trying to use the wrong jar file, but that's really a different issue. The duplicate is appropriate. – Andreas Jan 25 '17 at 20:56

0 Answers0