zoukankan      html  css  js  c++  java
  • Java 连oracle 12C 起步_PreparedStatement

    package javaapplication2;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.PreparedStatement;
    
    public class JavaApplication2 {
        
        public static void main(String[] args) throws ClassNotFoundException, SQLException {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            String url="jdbc:oracle:thin:@//10.98.0.62:1521/wdpis";
            Connection conn=DriverManager.getConnection(url,"qu","query");
            PreparedStatement pst=conn.prepareStatement("select item_no,batch_no,seq_no from dt_out_att ");
            
            ResultSet rs=pst.executeQuery();
            while(rs.next()){
                System.out.print("Item_NO:"+rs.getString("item_no"));
                System.out.print("Batch_NO:"+rs.getString("batch_no"));
                System.out.println("Seq_NO:"+rs.getString("seq_no"));
            }
            rs.close();
            pst.close();
            conn.close();
        }
        
    }
    

      

  • 相关阅读:
    最大公约数与最小公倍数
    素数筛
    基础数学问题
    考试前打模板
    斐波那契公约数
    期望及期望dp
    状压dp总结
    树链剖分学习
    B君的教育
    [noip2016]愤怒的小鸟
  • 原文地址:https://www.cnblogs.com/xyzabc0004/p/5006669.html
Copyright © 2011-2022 走看看