I'm trying to install the MS SQL JDBC driver on ubuntu to be used with sqoop for Hadoop. I'm totally new to java and linux, so I'm not sure where to extract everything to.
Just put it in the runtime classpath or add its path to the runtime classpath.
How to do it depends on how you're executing the program. If you're using java
command in command console to execute a .class
file, then use the -cp
argument to specify the paths to classes and/or JAR files which are to be taken in the classpath. The classpath is basically a collection of absolute/relative disk file system paths where Java has to look for JAR files and classes.
Assuming that you've downloaded a .zip
, you need to extract it and then look for a .jar
file (usually in a /lib
folder). For starters, it's the easiest to put the .jar
in the current working directory and then execute your program (with the Class.forName("com.mysql.jdbc.Driver");
line) as follows:
java -cp .:mysql.jar com.example.YourClass
The .
signifies the current path and the :
is the separator (which I believe is correct for Ubuntu, on Windows it's ;
).