Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC thin driver and encryption
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.*;
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
![]() |
![]() |