oracle 数据库

来源:互联网 发布:mac查看内存占用 编辑:程序博客网 时间:2024/06/04 00:43

资源下载地址:

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

Navicat_for_Oracle_10.0.11.0:http://download.csdn.net/detail/qq_26437925/9381823


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

Windows系统安装Oracle 11g数据库图文教程

解决Navicat无法连接Oracle的问题


Navicat for Oracle Cannot load OCI DLL

Navicat for oracle 提示 cannot load OCI DLL,126 193的解决方法

使用navicat for oracle 连接


编写程序验证oracle jdbc连接



代码如下:

[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. }  

原创粉丝点击