I have the following piece of code to read an Excel file and convert it into a Excel File:
var sql = "Select * from [#sheetName#$]";
CreateObject("java", "java.lang.Class").forName("sun.jdbc.odbc.JdbcOdbcDriver");
objInst = CreateObject("java","java.sql.DriverManager").getConnection(
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=" & arguments.fileName);
stmnt = objInst.createStatement();
sheetData = stmnt.executeQuery(sql);
qryData = CreateObject('java', 'coldfusion.sql.QueryTable').init(sheetData);
objInst.Close();
The code works fine in ColdFusion 8, 9, 10 and 11.
But when tried in Railo, I get the following error:
Railo 4.2.1.008 Error (java.sql.SQLException) Message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Cause java.sql.SQLException Stacktrace The Error Occurred in D:\Engineering\eclipse_workspace\simplymail\filename.cfm: line 22 20: objInst = CreateObject("java", 21: "java.sql.DriverManager").getConnection( 22: "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=" & arguments.fileName); 23: stmnt = objInst.createStatement(); 24: sheetData = stmnt.executeQuery(sql);
Unable to find the solution and posting here for a pointer.