{"id":6229,"date":"2018-06-20T21:22:49","date_gmt":"2018-06-20T21:22:49","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=6229"},"modified":"2018-06-20T21:22:49","modified_gmt":"2018-06-20T21:22:49","slug":"its-been-a-long-time-jdbc","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/its-been-a-long-time-jdbc\/","title":{"rendered":"It&#8217;s been a long time JDBC&#8230;"},"content":{"rendered":"<p>As I&#8217;m working in Java again. I&#8217;m having to reacquaint myself with various Java lanaguge features and libraries. <\/p>\n<p>It&#8217;s been a long time since I&#8217;ve had to use JDBC, but here&#8217;s a snippet of code to demonstrate a accessing an Oracle LDAP datasource.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\/\/ import java.sql.*;\r\n\r\nProperties connectionProps = new Properties();\r\nconnectionProps.put(&quot;user&quot;, &quot;YOUR_USER_NAME&quot;);\r\nconnectionProps.put(&quot;password&quot;, &quot;YOUR_PASSWORD&quot;);\r\n\r\nConnection conn = DriverManager.getConnection(\r\n   &quot;jdbc:oracle:thin:@ldap:\/\/SOME_URL:SOME_PORT\/,cn=OracleContext,dc=putridparrot,dc=com&quot;,\r\n                    connectionProps);\r\n\r\nStatement statement = conn.createStatement();\r\nResultSet rs = statement.executeQuery(&quot;select id, blob from SOME_TABLE&quot;);\r\n\r\nwhile(rs.next()) {\r\n   String id = rs.getString(1);\r\n   String blob = rs.getString(2);\r\n   \/\/ do something with the results\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As I&#8217;m working in Java again. I&#8217;m having to reacquaint myself with various Java lanaguge features and libraries. It&#8217;s been a long time since I&#8217;ve had to use JDBC, but here&#8217;s a snippet of code to demonstrate a accessing an Oracle LDAP datasource. \/\/ import java.sql.*; Properties connectionProps = new Properties(); connectionProps.put(&quot;user&quot;, &quot;YOUR_USER_NAME&quot;); connectionProps.put(&quot;password&quot;, &quot;YOUR_PASSWORD&quot;); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[161,216],"tags":[],"class_list":["post-6229","post","type-post","status-publish","format-standard","hentry","category-java","category-jdbc"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=6229"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6229\/revisions"}],"predecessor-version":[{"id":6239,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6229\/revisions\/6239"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=6229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=6229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=6229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}