import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class jdbc {
public static void main(String[] args){
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@192.168.98.27:1521:orcl";
Connection c = DriverManager.getConnection(url, "leyouoa", "leyouoa");
Statement stmt = c.createStatement();
String sql = "select id from uf_gdfybz";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println("ID: " + rs.getCharacterStream("id"));
}
stmt.close();
c.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
select INSTANCE_NAME from v$instance//查询oracle的sid
*/