0

Is there a PLATFORM INDEPENDENT connection string for EXCEL file in java. jdbc:odbc is platform dependent. Is there anything else ??

1
  • I sang aware that odbc was available on other platforms...could be wrong though.... Commented Dec 26, 2013 at 8:08

1 Answer 1

1

In this post you could see an example of using a connection string without the ODBC. I suppose this is what you are looking for...

Class.forName("com.hxtt.sql.excel.ExcelDriver").newInstance();  

String url = "jdbc:Excel:///E:/JavaWithExcel/Feedback.xlsx";  
String sql = "select * from [Sheet1]";  

Connection con = DriverManager.getConnection(url, "", "");  

Statement stmt = con.createStatement();  
System.out.println(con);  
System.out.println(stmt);  

stmt.close();  
con.close();  

Anyway, you have to understand that the connection string is always specific to the underlying environment. It could depend on the operating system, on the file system or something else... I would just use different configuration files for each environment.

Hope I helped!

Sign up to request clarification or add additional context in comments.

1 Comment

Please include a brief description in your answer of what the link is telling us. Suppose the link were offline or changed, then we would have no idea what you are telling us.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.