As I’m working in Java again. I’m having to reacquaint myself with various Java lanaguge features and libraries.
It’s been a long time since I’ve had to use JDBC, but here’s a snippet of code to demonstrate a accessing an Oracle LDAP datasource.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // import java.sql.*; Properties connectionProps = new Properties(); connectionProps.put( "user" , "YOUR_USER_NAME" ); connectionProps.put( "password" , "YOUR_PASSWORD" ); Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@ldap://SOME_URL:SOME_PORT/,cn=OracleContext,dc=putridparrot,dc=com" , connectionProps); Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery( "select id, blob from SOME_TABLE" ); while (rs.next()) { String id = rs.getString( 1 ); String blob = rs.getString( 2 ); // do something with the results } |