Chinaunix首页 | 论坛 | 博客
  • 博客访问: 739092
  • 博文数量: 771
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 5005
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-11 14:24
文章分类

全部博文(771)

文章存档

2011年(1)

2008年(770)

我的朋友

分类:

2008-09-11 14:30:32

    package com.hyq.src;

    import java.sql.*;

    import java.sql.ResultSet;

    public class TestProcedureOne {

    public TestProcedureOne() {

    }

    public static void main(String[] args ){

    String driver = "oracle.jdbc.driver.Driver";

    String strUrl = "jdbc:oracle:thin:@127.0.0.1:1521: hyq ";

    Statement stmt = null;

    ResultSet rs = null;

    Connection conn = null;

    CallableStatement cstmt = null;

    try {

    Class.forName(driver);

    conn =  DriverManager.getConnection(strUrl, " hyq ", " hyq ");

    CallableStatement proc = null;

    proc = conn.prepareCall("{ call HYQ.TESTA(?,?) }");

    proc.setString(1, "100");

    proc.setString(2, "TestOne");

    proc.execute();

    }

    catch (SQLException ex2) {

    ex2.printStackTrace();

    }

    catch (Exception ex2) {

    ex2.printStackTrace();

    }

    finally{

    try {

    if(rs != null){

    rs.close();

    if(stmt!=null){

    stmt.close();

    }

    if(conn!=null){

    conn.close();

    }

    }

    }

    catch (SQLException ex1) {

    }

    }

    }

    }


--------------------next---------------------

阅读(418) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~