access-〉oracle导数据

<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>

<%
 //system.pub.oraclesql myDao = new system.pub.oraclesql();
 
try{
 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 String url = "jdbc:odbc:test1";
 Connection con = DriverManager.getConnection(url, "", "");
 String query = "select * from Sheet2";
 Statement statement = con.createStatement();
 ResultSet rs = statement.executeQuery(query);
 out.println("哈哈哈哈");
 while(rs.next()){
  int id = rs.getInt("id");
  String type = rs.getString("type");
  String guige = rs.getString("guige");
  String computer_product_no = rs.getString("computer_product_no");
  String vga_product_no = rs.getString("vga_product_no");
  String buying_date = "to_date('2004-10-01 00:00:00','yyyy-mm-dd HH24:MI:SS')";
  String computer_name = "一机房台式机"+id;
  String vga_name = "一机房显示器"+id;
  
  system.pub.oraclesql myDao = new system.pub.oraclesql();
  
  String insert = "insert into product(id,product_name,producer,type,count,price,buying_date,category,product_no,fixedAssets_no,teacher_id,location_id,KIND) values(product_sequence.nextval,'"+computer_name+"','联想集团','开 天M4600',1,'',"+buying_date+",0,'"+computer_product_no+"','',42,1,2)";
  out.println(insert+"<br>");
  myDao.execUpdate(insert);
  
  insert = "insert into product(id,product_name,producer,type,count,price,buying_date,category,product_no,fixedAssets_no,teacher_id,location_id,KIND) values(product_sequence.nextval,'"+vga_name+"','联想集团','开 天M4600',1,'',"+buying_date+",0,'"+vga_product_no+"','',42,1,1)";
  //insertStr = new String(insert.getBytes("ISO8859_1"),"gb2312");
  myDao.execUpdate(insert);
  
  myDao.CloseConn();
 }
}
catch(Exception e){
 System.out.println(e);
}
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值