hi thanks for your guide. when i compiling that code not showing any error.when i calling that file in web browser up to that line all print statement displaying after that line no display statement working i thinking that line only having problem please see Below code i trying to get and read xls file.please guide me i trying lot
code:
try
{
//getting parameter value
input of F1="C:/asia/book1.xls"
String imp=request.getParameter("F1");
out.println("welcome5");//printing
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
out.println("welcome to peopletech23999884");//printing
out.println(imp);printing C:/asia/book1.xls
//after imp value printed its printing java.lang.NullPointerException
conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=" + imp);
out.println("welcome to peopletech1");//not printing here onwards no print statement displaying
st = conn.createStatement();
String query = "Select * from [Sheet1$]" ;
rs = st.executeQuery( query );
while( rs.next() )
{
String name=rs.getString(1);
String loc=rs.getString(2);
try
{
Class.forName
("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "meetme", "meetme");
st = conn.createStatement();
st.executeUpdate("Insert INTO sample1(`name` , `location`)VALUES('"+ name +"' ,'"+ loc +"')");
rs1=st.executeQuery("select * from sample1");
if(rs1.next())
{
out.println(name);
}
}
catch(Exception e)
{
out.println(e);
}
}//while
}//try
catch( Exception e )
{
out.println(e);
}