user441978
user441978

Reputation: 851

How to get value from resultset column name in java?

I'm reading value from Excel using jdbc-odbc in java ? One of the column name start with . how to read the from that column ? Im getting error unknown column while reading..

//String filesend = resultset.getString(".file send");

Please help me..

Upvotes: 0

Views: 2329

Answers (2)

Bhavik Shah
Bhavik Shah

Reputation: 5183

May be you should use Apache POI to get connection

Here is the code:

FileInputStream myInput = new FileInputStream(inputFile);
XSSFWorkbook wb = new XSSFWorkbook(myInput);

XSSFSheet sheet = wb.getSheetAt(0);
XSSFRow row = sheet.getRow(0); 
XSSFCell cell = row.getCell(1);
cell.setCellValue(123);

Upvotes: 0

Aditya Jain
Aditya Jain

Reputation: 1095

Did you try escaping the . ?
A good idea would be to see the name of the column using ResultSetMetaData.getColumnName(index) method.

Upvotes: 2

Related Questions