码迷,mamicode.com
首页 > 数据库 > 详细

Java 连oracle 12C 起步

时间:2015-11-30 11:29:54      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:

package javaapplication2;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

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");
        Statement stmt=conn.createStatement();
        
        ResultSet rs=stmt.executeQuery("select item_no,batch_no,seq_no from dt_out_att ");
        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();
        stmt.close();
        conn.close();
    }
    
}

 

Java 连oracle 12C 起步

标签:

原文地址:http://www.cnblogs.com/xyzabc0004/p/5006630.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!