Table not found Exception

20 views
Skip to first unread message

santlal gupta

unread,
Apr 1, 2016, 8:12:37 AM4/1/16
to Lingual User
Hi,

i am creating simple jdbc example to read data from file. I have read cascading lingual tutorial http://docs.cascading.org/lingual/1.2/#getting-started to read data. But getting Table not Found exception.

Code : 

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SimpleJdbc {

public static void main(String[] args) throws ClassNotFoundException, SQLException {

Class.forName("cascading.lingual.jdbc.Driver");
Connection connection = DriverManager
.getConnection("jdbc:lingual:local;schema=Input/data.csv");
Statement statement = connection.createStatement();
String query="select * from \"Input\".\"data\"" ;
ResultSet resultSet = statement.executeQuery(query);

while (resultSet.next()) {
int n = resultSet.getMetaData().getColumnCount();
StringBuilder builder = new StringBuilder();

for (int i = 1; i <= n; i++) {
builder.append(
(i > 1 ? "; " : "") + resultSet.getMetaData().getColumnLabel(i) + "=" + resultSet.getObject(i));
}
System.out.println(builder);
}
resultSet.close();
statement.close();
connection.close();
}
}

i am using eclipse for this.
I have created one folder named Input and kept data.csv into it.

data.csv contains :
city,name,id
mumbai,AAA,1
Pune,BBB,2

after executing this i am getting exception as :

SEVERE: org.eigenbase.sql.validate.SqlValidatorException: Table 'Input.data' not found
SEVERE: org.eigenbase.util.EigenbaseContextException: From line 1, column 15 to line 1, column 28
Exception in thread "main" java.sql.SQLException: From line 1, column 15 to line 1, column 28: "Table 'Input.data' not found"
Caused by: org.eigenbase.util.EigenbaseContextException: From line 1, column 15 to line 1, column 28
Caused by: org.eigenbase.sql.validate.SqlValidatorException: Table 'Input.data' not found

can you suggest me where i am doing wrong here. I have executed same using cascading it works fine.

I have one more question : 
** I want to read Avro file. but default data provider is text, and it provide format as csv and tsv. Can you suggest me which data provider should i use to read  Avro file data, on cluster i.e. on lingual cli and with  simple cascading job.

Hadoop version : Hadoop 2.6.0-cdh5.4.2

Thanks
Santlal Gupta
Reply all
Reply to author
Forward
0 new messages