|
for AFILE setup an odbc connection (on NT, Start->Settings->Control Panel->DataSources(ODBC)..) the name you give the odbc connection slots in here: excelConnection = DriverManager.getConnection("jdbc:odbc:" + odbcName, "", ""); then: String excelQuery = "select * from [ASHEET$];"; //Excel sheet name here is a link that may help: http://www.javaworld.com/javaworld/javaqa/2001-06/04-qa-0629-excel.html "Bruce Jin" <JIN007M@hotmail.com>@midrange.com on 04/03/2002 17:20:58 Please respond to java400-l@midrange.com Sent by: java400-l-admin@midrange.com To: java400-l@midrange.com cc: Subject: Re: Transfer Exell to AS400 Hi Patrick: I have an Excel file AFILE and sheet ASHEET. How do I code the these two statements? excelConnection = DriverManager.getConnection("jdbc:odbc:" + odbcName, "", String excelQuery = "select * from [Contacts$];"; file://Excel sheet name Thanks. Bruce ----- Original Message ----- From: <Patrick.F.O'Dowd@gsk.com> To: <java400-l@midrange.com> Sent: Monday, March 04, 2002 5:47 AM Subject: Re: Transfer Exell to AS400 > > > I have used jdbc to load excel spreadsheet to as400 files: > Connection excelConnection = null; > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); > excelConnection = DriverManager.getConnection("jdbc:odbc:" + odbcName, "", ""); > > > Statement excelSelect = null; > excelSelect = excelConnection.createStatement(); > String excelQuery = "select * from [Contacts$];"; file://Excel sheet name > ResultSet excelData = excelSelect.executeQuery(excelQuery); > > while (excelData.next()) { > String node = excelData.getString("Node"); > String contactName = excelData.getString("Contact Name"); > > etc.. > > To convert the excel data to XML, you could use JDOM. > > _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.