简体   繁体   English

如何从java中的结果集列名获取值?

[英]How to get value from resultset column name in java?

I'm reading value from Excel using jdbc-odbc in java ? 我在java中使用jdbc-odbc从Excel读取价值? 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.. 请帮我..

Did you try escaping the . 你试过逃避了吗? ?
A good idea would be to see the name of the column using ResultSetMetaData.getColumnName(index) method. 一个好主意是使用ResultSetMetaData.getColumnName(index)方法查看列的名称。

May be you should use Apache POI to get connection 也许你应该使用Apache POI来获得连接

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM