资源下载地址:

instantclient-basic-nt-11.2.0.3.0: http://download.csdn.net/detail/qq_26437925/9381840

安装过程中遇到的问题参考如下:



使用navicat for oracle 连接

oracle 数据库

编写程序验证oracle jdbc连接

oracle 数据库

oracle 数据库

代码如下:

[cpp] view plain copy
  1. package com.cn;  
  2.   
  3. import java.sql.*;  
  4.   
  5. public class Test {  
  6.     public static void main(String[] args) {  
  7.           
  8.         try {  
  9.             // 加载驱动  
  10.             Class.forName("oracle.jdbc.driver.OracleDriver");  
  11.             // 得到连接  
  12.             Connection ct = DriverManager.getConnection(  
  13.                     "jdbc:oracle:thin:@127.0.0.1:1521:orcl",   
  14.                     "scott",  
  15.                     "123456");  
  16.   
  17.             Statement sm = ct.createStatement();  
  18.             ResultSet rs = sm.executeQuery("select * from emp");  
  19.             while (rs.next()) {  
  20.                 System.out.println("用户名:" + rs.getString(2));  
  21.             }  
  22.             rs.close();  
  23.             sm.close();  
  24.             ct.close();  
  25.         } catch (Exception e) {  
  26.             e.printStackTrace();  
  27.         }  
  28.     }  
  29. }  

相关文章:

  • 2021-04-02
  • 2021-07-04
  • 2022-02-14
  • 2022-12-23
  • 2021-12-18
猜你喜欢
  • 2022-01-02
  • 2021-11-29
  • 2021-10-08
相关资源
相似解决方案