Hi Ogh,
if plattform is not an issue for you, you can use odbc for that purpose.
One requirement though: Your tables need to be extremly well formed (header,
data thats it, no fancy stuff). I made a convinience API that makes opening
odbc datasources a charm. It can also create new ones or delete existing.
For working on tables you can use either a JDBC Connection or the
abstraction I made, which basically returns javax.swing.TableModel's instead
of RecordSets. It's not very well documented (yet :), but includes testcases
and a sample application. If you want to you use it, just email me and I'll
send it to you (no need to pollute the mailing list :).
Steps for doing it without my code (Win2k):
First you need to register your excel file as odbc datasource
Got to Control Panel -> Administrative Tools -> Data Sources -> Choose
Excel-Files and 'New', the rest should be self-explaining, do remember the
name you gave your new datasource though
some sample code:
// The jdbc driver you'll be using (is included in the J2SE)
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Connection string where ds_name must be the datasource name you assigned
before
con = DriverManager.getConnection("jdbc:odbc:ds_name","","");
//sample select where sheet_name is the name of, well, the sheet you want to
work with
// for some strange reason, "[ $]" has to be there.
select = con.prepareStatement("select * from
[sheet_name$]",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
Hope that helped!
Cheers,
Wulf
-----Ursprungliche Nachricht-----
Von: Qgh Rohgy [mailto:[EMAIL PROTECTED]
Gesendet: Samstag, 15. Marz 2003 03:23
An: [EMAIL PROTECTED]
Betreff: Use of HSSF for Excel interface with Database?
Hello,
I have a project which need an excel interface for the
users to create/update/delete multiple records in the
database tables.
Could I use POI HSSF API for this purpose?
I went through the API and realized that there is no
easy way to do so. Unless I find the value of each
Cell in the Excel file.
Example :-
Date Amount
3/13 20
3/14 25
3/12 15
3/13 10
I have 2 columns in my XLS file
Date and Amount.
I want to update values in my Database of rows whose
Date is greater than 3/12.
Is there an efficent way of querying this in HSSF and
then updating the Db table?
Is it possible? How should I do it?
Is there any other API that I could use?
Thanks in advance,
qgh
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]