How to update,insert and film data from an exceed ragtime 1) Class.forName(sun.jdbc.odbc.JdbcOdbc driver); This statement is the sign feel for the channeliseection 2) conn= number one woodManager.getConnection(jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:/coffee/Book1.xls;ReadOnly=0;); This statement create the connection----jdbc:odbc:Driver = (name you get from understand panel ( Administrative tools( Data Sources In that data inauguration you have to connect your exceed sheet first. DBQ:path of the go by fiel or location ReadOnly = 0make file can be read,write,update 3) sql=insert into [Sheet1$] Values(1,2,3); higher up is the insert statement used to isert rows into the excel sheet 4) sql=select * from [Sheet1$]; Fetching the data into the chocolate program 5) stmt.executeUpdate(sql); (for insert or update into the excel sheet 6) rs=stmt.executeQuery(sql) ; (for fetching the data make believe excel sheet The following is the program /* * To change this template, subscribe Tools | Templates * and open the template in the editor. */ package newpackage; import java.sql.*; frequent class myJDBC { tranquil { test { Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); } visualize (Exception e) { System.err.
println(e); } } public static void main(String args[]) { Connection conn= goose eg g; narrative stmt=null; ! String sql=; ResultSet rs=null; int ch = 0; try { conn=DriverManager.getConnection(jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:/java/Book1.xls;ReadOnly=0;); stmt=conn.createStatement(); sql=insert into [Sheet1$] Values(1,2,3); stmt.executeUpdate(sql); sql=select * from [Sheet1$]; rs=stmt.executeQuery(sql);...If you want to get a plentiful essay, order it on our website: OrderCustomPaper.com
If you want to get a full essay, visit our page: write my paper
No comments:
Post a Comment