Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using ms excel as a database

 
j wu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating an online web voting web page. I have been informed that there is a java code that can be used to display data from an excel spreadsheet on a webpage. I have about 3000 rows of data and about 5 columns of data on the spreadsheet. I want to know how to use java to put all this information online. The reason for this is, I need to frequently change this excel spreadsheet annually and I do not want to hard code it in. Any suggestions will be useful, thank you.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably want poi.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also setup an ODBC connection to an Excel file and then just query ODBC much the same way as any other database.
 
Prem Khan
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah id sujgest using the jdbc-odbc brigde. I even have the code ready for such a thing. It can make use of any ODBC DSN so create one first. This one makes use of a MS Access database, but you could make it work with excel. Dont know it excel can do SELECT statments. Excel is a pretty messed up tool to be useing for a DB.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

String url = "jdbc dbc:CLIENTDB";
Connection conn = DriverManager.getConnection(url, "websysaccess", "mshobx");
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

if (rows.size() > 0) {
StringBuffer sql = new StringBuffer("SELECT * FROM tblMemberAddress");
if (rows.size() == 1) {
sql.append(" WHERE MemberID = " + ((UserTblMemberAddress)rows.get(0)).getMemberId());
sql.append(" AND AddressID = '" + ((UserTblMemberAddress)rows.get(0)).getAddressId() + "'");
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic