importing data from excel sheet into oracle table

Hi,I want to import data from excel sheet to oracle table.pls guide me with code examples.waiting 4 solutionsthanx
[142 byte] By [Rajshekara] at [2007-11-27 6:07:10]
# 1
How far are you already?Do you have Java already connected to Oracle?If so, you'd be best cutting out excel by saving the table as a CSV file which would be pretty easy to get to from Java.
Iain.Gallowaya at 2007-7-12 16:24:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

There are two options

1. try to use SQL*Loader utility.

2. Make JDBC ODBC connection to Excel file and use JDBC queries to read and store data to database. The name of first row columns are used as table columns. The java code example for this is posted below,

Connection con= null;

try

{

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

con= DriverManager.getConnection("jdbc:odbc:GC", "", "");

Statement stmt= con.createStatement();

ResultSet rs= stmt.executeQuery("select username, password from userlogin");

while (rs.next())

{

String lname = rs.getString(1);

String fname = rs.getString(2);

System.out.println(fname + " " + lname);

}

rs.close();

System.out.println(con.isClosed());

stmt.close();

}

finally

{

if (con != null)

con.close();

}

abhishekpandey_y2ka at 2007-7-12 16:24:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
The easy way would indeed be to export to csv first (= comma seperated). If not possible get into the jakarta poi lib http://jakarta.apache.org/poi/hssf/index.html
cappelleha at 2007-7-12 16:24:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...