5 Replies Latest reply on May 9, 2016 5:48 AM by Marco Ardito

    Connect to Teiid through SQOOP

    Ravindra Singh Newbie



      Need direction on using Teiid with SQOOP


      Below is the command i have used.


      sqoop import -libjars  /development/sr3/teiid-8.13.4-jdbc.jar --verbose --connect jdbc:teiid:Impu@mm://cdtssoa126d.rxcorp.com:31000 --driver org.teiid.jdbc.TeiidDriver --username soaxxx --password soaxxx   --target-dir /ravindra/ --query "SELECT * FROM METADATASOURCE_MSSQL_VIEW.IMPUTATIONMODULE WHERE 1=1" --split-by ImputationModuleID

        • 1. Re: Connect to Teiid through SQOOP
          Marco Ardito Master

          As said in the other post where this topic was born (Re: How to connect to Teiid VDB through Linux server ?), I have no sqoop experience,

          but there your last comment was


          > I tried with single dash also


          yes, but according to the docs, (Sqoop User Guide (v1.4.6))

          "$ sqoop help import

          usage: sqoop import [GENERIC-ARGS] [TOOL-ARGS]"


          and "-libjars" is defined as a "generic" arg, so double check it come first than "tool" args:


          again, citing the docs:

          "You must supply the generic arguments -conf, -D, and so on after the tool name but before any tool-specific arguments (such as --connect)."


          so double check.


          Otherwise, if nothing works, post here the errors you get, also, but it could be necessary to use sqoop logging capabilities to let sqoop support spot what is not working....



          • 2. Re: Connect to Teiid through SQOOP
            Ravindra Singh Newbie

            Hi Marco,


            I have used below sqoop command


            sqoop import --jar-file  /development/sr3/teiid-8.12.4-jdbc.jar --class-name org.teiid.jdbc.TeiidDriver  --verbose --connect jdbc:teiid:ImputationV1_DEV@mm://cdts888.rxcorp.com:31000/MetadataSource_MSSQL_Views  --username soaxxx --password SOAPyyy --driver org.teiid.jdbc.TeiidDriver --query 'SELECT * FROM IMPUTATIONMODULE WHERE $CONDITIONS' --split-by ImputationModuleID --target-dir ravindra/data1


            and i got below error


            16/05/09 02:26:56 DEBUG util.ClassLoaderStack: Restoring classloader: sun.misc.Launcher$AppClassLoader@6956de9

            16/05/09 02:26:56 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.teiid.jdbc.TeiidDriver

            java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.teiid.jdbc.TeiidDriver

            • 3. Re: Connect to Teiid through SQOOP
              Marco Ardito Master


              according to the docs, I think -libjars argument (as a "Generic" arg) must come first and single-dashed, something like this,

              and you could also need to specify Teiid driver class, it should be org.teiid.jdbc.TeiidDriver

              I would also omit the --direct arg, since in this case no "direct" method should exist for the Teiid database...


              so, here is what I would try:


              sqoop import \

              -libjars /development/sr3/teiid-8.13.4-jdbc.jar \

              --driver org.teiid.jdbc.TeiidDriver \

              --verbose \

              --connect jdbc:teiid:ImputationV1_DEV@mm://cdtssoa126d.rxcorp.com:31000 \

              --username soamgr \

              --table MetadataSource_MSSQL_View.ImputationModules



              • 4. Re: Connect to Teiid through SQOOP
                Ravindra Singh Newbie

                Hi Marco,


                Thanks for reply.

                I tried below and it is still giving error


                sqoop import \

                -libjars /development/sr3/teiid-8.12.4-jdbc.jar \

                --driver org.teiid.jdbc.TeiidDriver \

                --verbose \

                --connect jdbc:teiid:ImputationV1_DEV@mm://cdtssoa126d.rxcorp.com:31000/MetadataSource_MSSQL_Views \

                --username soamgr \

                --table ImputationModules \

                --target-dir ravindra/data1


                16/05/09 04:20:02 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: org.teiid.jdbc.TeiidDriver


                I have checked the jar file we are providing and the driver is present. Still i don't understand why there is problem in loading.

                I downloaded it again and tried, suspected of corrupted jar file also, but still it doesn't work.



                • 5. Re: Connect to Teiid through SQOOP
                  Marco Ardito Master

                  looking on search engines, that error could be just that sqoop expects the .jar to be in its /lib folder


                  always citing the guide

                  "You can use Sqoop with any other JDBC-compliant database. First, download the appropriate JDBC driver for the type of database you want to import, and install the .jar file in the $SQOOP_HOME/lib directory on your client machine. (This will be /usr/lib/sqoop/lib if you installed from an RPM or Debian package.) Each driver .jar file also has a specific driver class which defines the entry-point to the driver. For example, MySQL’s Connector/J library has a driver class of com.mysql.jdbc.Driver. Refer to your database vendor-specific documentation to determine the main driver class. This class must be provided as an argument to Sqoop with --driver."


                  On other search results, someone suggest to create a symbolic link, something  like

                  "ln /development/sr3/teiid-8.12.4-jdbc.jar /usr/lib/sqoop/lib/teiid-8.12.4-jdbc.jar"