Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

[Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Solved Go to solution

[Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Contributor

Hello, 

I am on a CDH 5.4.4 cluster, with parcels.

I need to use sqoop, running it from the edgenode.

My problem is that I need to connect to Oracle 12, which works fine, but now I need to connect to Oracle 9, too.

It seems that Oracle12 ojdbc6.jar no more support Oracle9. I need to download Oracle11's ojdbc6.jar

My question is: how can I make them live toghether ?

- I can't place them on the same folder, because they have the same name.

- Maybe I can change the name of one of them, but the classes contained have the same name: how can I tell Sqoop to use one instead of another at runtime ?

 

I'm going nuts.

 

Thank you

 

Omar

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Master Guru
You can simply install the O12 jar as the default (under /var/lib/sqoop/) and do the below when you want to use O11 jar over O12 jar instead (don't install the O11 jar into /var/lib/sqoop, but keep it elsewhere):

export HADOOP_CLASSPATH=/path/to/ojdbc6-for-O11.jar
export HADOOP_USER_CLASSPATH_FIRST=true
sqoop …rest of args…

Does this help?
6 REPLIES 6

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Master Guru
You can simply install the O12 jar as the default (under /var/lib/sqoop/) and do the below when you want to use O11 jar over O12 jar instead (don't install the O11 jar into /var/lib/sqoop, but keep it elsewhere):

export HADOOP_CLASSPATH=/path/to/ojdbc6-for-O11.jar
export HADOOP_USER_CLASSPATH_FIRST=true
sqoop …rest of args…

Does this help?

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Contributor
Thank you Harsh, you keep this forum rolling !
I'll try this, a question: will I be missing something overwriting the default hadoop classpath ?

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Master Guru
No, the illustrated technique prepends to a default classpath, and does not
replace/overwrite it.

To be extra safe though, if you already are using HADOOP_CLASSPATH for
something else, you may also do it this way:

export HADOOP_CLASSPATH=/path/to/O-9.jar:$HADOOP_CLASSPATH
export HADOOP_USER_CLASSPATH_FIRST=true
sqoop …rest of args…

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Contributor
Yes I guessed it.
So just to be super-safe, according to the last example if it finds a ojdbc6.jar in both paths, it will load the first one and discard the latter, right ?

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Master Guru
Yes, that's been the usual JVM behaviour for class-loaders (pick classes
from the earliest classpath entry presenting it), so we are effectively
reordering our classpath to rely on that.

Re: [Sqoop] Using two versions of the same driver - Oracle ojdbc6.jar

Contributor
Thanks, will let you know.
Bye
Don't have an account?
Coming from Hortonworks? Activate your account here