Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC thin driver and encryption

Re: JDBC thin driver and encryption

From: Yasenko Yorgich <elcaro_at_softhome.net>
Date: 13 Nov 2002 08:22:30 -0800
Message-ID: <ba8b6976.0211130822.686849c1@posting.google.com>


After some fiddling with the sample code, this works on my Win2k, Oracle 8i (r8.1.7)

---code----

import java.sql.*;
import java.sql.*;
import java.io.*;
import java.util.*;

import oracle.net.ns.*;
import oracle.net.ano.*;

class Employee
{
  public static void main (String args [])     throws Exception
  {

// Register the Oracle JDBC driver

    System.out.println("Registring the driver...");     DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

    Properties props = new Properties();

    try {

      //FileInputStream defaultStream = new FileInputStream(args[0]);
      //props.load(defaultStream);


      int level = AnoServices.REQUIRED;
      
      props.put("user", "scott");
      props.put("password", "tiger");
     props.put("oracle.net.encryption_client", Service.getLevelString(level));
      props.put("oracle.net.encryption_types_client", "( DES40C )");
      props.put("oracle.net.crypto_seed","1070randomcharac");
      props.put("oracle.net.crypto_checksum_client",Service.getLevelString(level));
      props.put("oracle.net.crypto_checksum_types_client", "( MD5 )");
      

    } catch (Exception e) { e.printStackTrace(); }

// You can put a database name after the @ sign in the connection URL.
    Connection conn = DriverManager.getConnection

               ("jdbc:oracle:thin:@172.16.10.10:1521:orcl", props);

// Create a Statement

    Statement stmt = conn.createStatement ();

// Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select ENAME from EMP");

// Iterate through the result and print the employee names
    while (rset.next ())

       System.out.println (rset.getString (1));

    conn.close();
  }

}

------end code -------

settings on the servers' SQLORA.NET
# SQLNET.ORA Network Configuration File: d:\oracle\ora81\NETWORK\ADMIN\sqlnet.ora # Generated by Oracle configuration tools.

SQLNET.CRYPTO_CHECKSUM_TYPES_SERVER= (MD5) SQLNET.AUTHENTICATION_SERVICES= (NTS) SQLNET.ENCRYPTION_TYPES_SERVER= (DES40) SQLNET.CRYPTO_SEED = 4fhfguweotcadsfdsafjkdsfqp5f201p45mxskdlfdasf



WARNING: Spot the differnece with sqlora.net using (DES40) and client (DES40C) if you specify on the client des40 only, it won't work Received on Wed Nov 13 2002 - 10:22:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US