issue with DB connect

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

issue with DB connect

Ekram Ali

Hi Team ,



i am getting below error


java.lang.IllegalArgumentException: JDBC-Class not found. - jdbc:mysql://localhost
    at org.apache.flink.api.java.io.jdbc.JDBCInputFormat.openInputFormat(JDBCInputFormat.java:146)
    at org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:110)
    at org.apache.flink.runtime.taskmanager.Task.run(Task.java:584)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: jdbc:mysql://localhost
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.flink.api.java.io.jdbc.JDBCInputFormat.openInputFormat(JDBCInputFormat.java:136)
    ... 3 more

01/27/2017 18:41:42    DataSource (at main(RDBNDFlink.java:25) (org.apache.flink.api.java.io.jdbc.JDBCInputFormat))(4/4) switched to FAILED


java.lang.IllegalArgumentException: JDBC-Class not found. - jdbc:mysql://localhost



code -


final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        
         final TypeInformation<?>[] fieldTypes = new TypeInformation<?>[]
                 { BasicTypeInfo.STRING_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO };
         final RowTypeInfo rowTypeInfo = new RowTypeInfo(fieldTypes);
        
         @SuppressWarnings("unchecked")
        DataSet<Tuple2<String, Integer> >dbData =
                    env.createInput(
                      // create and configure input format
                      JDBCInputFormat.buildJDBCInputFormat()
                                     .setDrivername("jdbc:mysql://localhost")
                                     .setDBUrl("org.apache.hive.jdbc.HiveDriver")
                                     .setUsername("hiveuser")
                                     .setPassword("impetus")
                                     .setQuery("select name, age from persons")
                                     .setRowTypeInfo(rowTypeInfo)
                                     .finish(),
                      // specify type information for DataSet
                      new TupleTypeInfo(Tuple2.class,  BasicTypeInfo.INT_TYPE_INFO ,BasicTypeInfo.STRING_TYPE_INFO)
                    );


i have add entry of sql connector as well


    </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.15</version>
            <type>jar</type>
            <scope>compile</scope>









NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.