Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.0
  HXTT Cobol v4.0
  HXTT DBF v7.0
  HXTT Excel v6.0
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Paradox v7.0
  HXTT PDF v1.1
  HXTT Text(CSV) v7.0
  HXTT Word v1.0
  HXTT XML v3.0
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT Excel
Urgent: 2010 Excel Support for JDK 1.3
Srikanth
2012-07-11 08:27:01.0
Hi,
I want to read 2010 Excel file (.xlsx and .xlsm) using JDK 1.3, please let me know which version of HXTT fits this requirement.

Note:
I want to create the JDBC connection using InputStream and create in memory table using InputStream.

I would be easy for me if you give some working example/sample code for how to read the .xlsx file and put in memory.
Re:Urgent: 2010 Excel Support for JDK 1.3
HXTT Support
2012-07-11 15:47:15.0
>I want to read 2010 Excel file (.xlsx and .xlsm) using JDK 1.3
JDBC 4.1 packages are for JDK 1.7.X. JDBC 4.0 packages are for JDK 1.6.X. JDBC 3.0 packages are for JDK 1.3.X, 1.4.X, 1.5.X, 1.6.X, and 1.7.X. JDBC 2.0 packages are for JDK1.2.X, and 1.3.X. JDBC 1.2 packages are for JDK1.1.X, and Personal Java. You can use Excel_JDBC30(20, or 12).jar for your JDK1.3 .
Re:Urgent: 2010 Excel Support for JDK 1.3
HXTT Support
2012-07-11 15:48:14.0
>I want to create the JDBC connection using InputStream and create in memory table using InputStream.

package test.jdbc.excel;

import java.net.URL;
import java.net.URLConnection;

import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.Properties;

public class testInputCreate{
private static void test(String url){
System.out.println(url);
try {
Class.forName("com.hxtt.sql.excel.ExcelDriver").newInstance();

Properties properties=new Properties();
// properties.setProperty("versionNumber","XLSX");
Connection con = DriverManager.getConnection(url,properties);

String sql;
PreparedStatement pstmt;

sql="create database testaaa ?";
pstmt = con.prepareStatement(sql);

URL httpurl=new URL("http://www.hxtt.com/test/testxls.XLS");
// URL httpurl=new URL("http://www.hxtt.com/test/excelxlsx.xlsx");
URLConnection urlConnection=httpurl.openConnection();
InputStream is=urlConnection.getInputStream();
pstmt.setObject(1,is);//create a table from a HTTP stream
pstmt.executeUpdate();

pstmt.close();
is.close();

sql = "select * from testaaa.sheet1";
Statement stmt=con.createStatement();
ResultSet rs = stmt.executeQuery(sql);

ResultSetMetaData resultSetMetaData = rs.getMetaData();
int iNumCols = resultSetMetaData.getColumnCount();
for (int j = 1; j <= iNumCols; j++) {
System.out.println(resultSetMetaData.getColumnLabel(j)
+ " " + resultSetMetaData.getColumnTypeName(j)
+ " " + resultSetMetaData.getColumnDisplaySize(j)
);
}
Object colval;

rs.beforeFirst();
long ncount = 0;
while (rs.next()) {
ncount++;
for (int j = 1; j <= iNumCols; j++) {
colval = rs.getObject(j);
System.out.print(colval + " ");
}
System.out.println();
}
System.out.println("row count:"+ncount);

rs.close();

stmt.execute("drop database testaaa");//remove that testaaa table.

stmt.close();

con.close();
}
catch( SQLException sqle )
{
do
{
System.out.println(sqle.getMessage());
System.out.println("Error Code:"+sqle.getErrorCode());
System.out.println("SQL State:"+sqle.getSQLState());
sqle.printStackTrace();
}while((sqle=sqle.getNextException())!=null);
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}

public static void main(String argv[]) {
test("jdbc:excel:/d:/test/excel/?delayedClose=-1");
test("jdbc:excel:/_memory_/?delayedClose=-1");
}
}


Re:Re:Re:Urgent: 2010 Excel Support for JDK 1.3
Srikanth
2012-07-12 04:34:10.0
Hi,
Thanks a lot for quick reply. My excel file will be passed from client side to server side. So, i will get the input stream as httpRequest.getInputStream();

Here is my problem.

When i use
File file = new File("C:\\sample\\sample.xlsx");
InputStream is = new FileInputStream(file);
pstmt.setObject(1,is);//create a table from a FileInput stream
pstmt.executeUpdate();

The testaaa table is creating and i can able to read data.

When i use

InputStream is = httpRequest.getInputStream(); // The file is selected from jsp
pstmt.setObject(1,is);//create a table from a FileInput stream
pstmt.executeUpdate();

The testaaa table was not creating. Please suggest.
Re:Re:Re:Re:Urgent: 2010 Excel Support for JDK 1.3
HXTT Support
2012-07-12 04:44:44.0
You can try
URL httpurl=new URL("http://www.yourhost.com/yourjsp?yourparameters=sss");

// URL httpurl=new URL("http://www.hxtt.com/test/excelxlsx.xlsx");

URLConnection urlConnection=httpurl.openConnection();

InputStream is=urlConnection.getInputStream();
Re:Re:Re:Re:Urgent: 2010 Excel Support for JDK 1.3
HXTT Support
2012-07-12 04:46:57.0
Your jsp maybe haven't sent a correct excel(xls or xlsx) file.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap