
Can any please help it is very urgent.
I tried to read excel sheet using ODBC type 1 driver and i have done successfully.but disadvantage is when i create a executabloe jar for this .it is working in my system only .since the odbc coneecction is their in my system only.if i want to work in my colleagues system i need to connect same DNS name in my colleague system also .So, this is the problem. so, can any one help me without creating DNS we should retrieve data from excel using ODBC.plz help me guys..........

Follow these steps:
Open Data Sources (Start->Settings->Control Panel->Administrative Tool->Data Sources(ODBC)
Open User DSN tab
Add a user DSN
Select Microsoft Excel Driver(*.xls)
Select work book or excel file and Create the DSN name (e.g excel)
Click "Ok" and restart your compiler.
Compile the following java code:
import java.sql.*;
public class JDBCExcel {
public static void main(String args[]) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:excel","", "");
Statement st = conn.createStatement(); String query = "select * from [Excel sheet$]";
ResultSet rs = st.executeQuery(query);
while(rs.next()){
System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
}
}
catch(Exception e){}
}
}
Note: 'Excel sheet' is the sheet name of the selected excel file in the query.

Sir,
Actually i too know how to read data using type 1 driver.sir,you have given procedure to do is done right but u have used type 1 driver but i want to do this using type 2 or type 4 driver (i.e nothing but not to create DNS in local system) the program should automatically do DNS creation and them access excel data and should given output of reading data in console.
thnx for write some answer that u know...
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.