tag:blogger.com,1999:blog-5277382285438737960Sat, 27 Feb 2010 12:15:41 +0000OrindaBlogJava, Oracle, JDBC and PL/SQL related information from Orinda Software, Dublin, Irelandhttp://www.orindasoft.com/public/blog/orindablog.htmlnoreply@blogger.com (David Rolfe)Blogger12125tag:blogger.com,1999:blog-5277382285438737960.post-8407693962322066825Mon, 22 Feb 2010 17:31:00 +00002010-02-27T09:37:56.138ZPL/SQLWeb ServicesOracleCreating Oracle PL/SQL Web Services With OrindaBuild<p><br />We have a new white paper on "<a href="http://www.blogger.com/ob6CostEffectiveWebServices.pdf?pdsrc=oblog">Cost Effective PL/SQL Web Services With OrindaBuild</a>". The key points are below...<br /><br /><br /></p><br /><p><br /><br />Regardless on whether you use our technology or not there are some things to bear in mind when moving your existing Oracle database to SOA:<br /><br /><br /></p><br /><p><br /><br /><span style="font-weight: bold;">Creating database web services is non-trivial.</span><br /><br /></p><br /><p><br /><br /><br />The ‘glue code’ that sits between your database and your web service engine will represent the bulk of your web service conversation effort. Not only that, it will need to be maintained as long as the underlying database exists. Creating this code may require more work than it took to create the database it uses.<br /><br /></p><br /><p><br /><br /><br /><span style="font-weight: bold;">Simply sticking a Java Data Access Object layer on top of Oracle won’t give you the basis for web services.</span><br /><br /><br /></p><br /><p><br /><br />Most existing systems will have business logic that is expressed with SQL statements. In such cases having access to the database schema is not enough - outside knowledge on how the data should be interpreted is required to turn the raw data stored in potentially hundreds of tables into valid business information.<br /><br /></p><br /><p><br /><br /><br /><span style="font-weight: bold;">Most existing systems will use PL/SQL, which is not always Java-friendly.</span><br /><br /></p><br /><p><br /><br /><br />PL/SQL offers huge advantages to developers, provided they can access it easily:<br /><br /></p><br /><p><br /><br /></p><ol><li>It allows a database designer to create PL/SQL packages that provide the functionality the application needs without exposing the users to the underlying complexity of the database.</li><li>The DBA can optimize the SQL statements that interact with the database without changing any external source code.</li><li>It’s significantly faster than raw SQL as it allows multiple requests to be met in one interaction, such as returning a customer as well as their purchase data while simultaneously logging the request for audit purposes.</li></ol><br /><span style="font-style: italic;">But:</span><br /><br /><p></p><br /><p><br /><br /></p><ol><li>PL/SQL makes extensive use of records and arrays as parameters.</li><li>PL/SQL procedure s that take records or arrays as parameters can be hard to access usingJDBC. </li></ol><br />Many PL/SQL procedures were never designed with JDBC in mind, and as a result the code to call the procedure can be many times longer than the procedure itself. The code can also be very, very complicated and beyond the ability of some developers to create within an economic timeframe.<br /><br /><br /><p></p><br /><p><br /><br />As a result of this when writing Web Services manually many developers end up either reverse engineering PL/SQL into Java or writing wrapper procedures that load and unload records into scalar variables instead.<br /><br /></p><br /><p><br /><br /><br /><span style="font-weight: bold;">How does OrindaBuild Help?</span><br /><br /><br /></p><br /><p><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.orindasoft.com/public/blog/uploaded_images/ws_stack-727588.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 185px; height: 390px;" src="http://www.orindasoft.com/public/blog/uploaded_images/ws_stack-727588.png" alt="" border="0" /></a>OrindaBuild solves this problem by writing the missing Java code for you. It’s GUI based, is easy to use and almost totally automatic. It’s also integrated with Eclipse, the industry leading IDE. You can even use OrindaBuild to package and deploy solutions in one step without writing a single line of code by hand.<br /><br /><br /></p><br /><p><br /><br />If you <a href="http://www.orindasoft.com/public/Pages.php4?location=Purchasetwo">buy</a> OrindaBuild you will be able to generate Web Service compatible Java for the vast majority of your existing Oracle databases using a simple GUI with minimal work.<br /><br /></p><br /><p><br /><br /><br />Fully functional but time-limited versions of OrindaBuild are freely<br /><a href="http://www.orindasoft.com/public/Pages.php4?location=Downloadtwo">downloadable</a>, so you can do your own evaluation.<br /><br /></p><br /><p><br /><br /><br />You can also download OrindaBuild as an Oracle <a href="http://www.orindasoft.com/public/Pages.php4?location=sdefeatures">SQLDeveloper Extension</a> or an<a href="http://www.orindasoft.com/public/Pages.php4?location=ecfeatures"> Eclipse Plugin</a><br /><br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-8407693962322066825?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2010/02/creating-oracle-web-services-with.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-8037282495632999269Fri, 19 Feb 2010 15:58:00 +00002010-02-27T09:41:34.510ZPL/SQLWeb ServicesEclipseOrindaBuildOrindaBuild PL/SQL Web Service Generator Now Available For Eclipse 3.5<p>OrindaBuild, a Web Service Generator for Oracle PL/SQL and SQL, is now available as a plugin for Eclipse 3.5.<br /><br /><br />To get a demo version do the following:<br /><br /><br />Click on "Help", then "Install New Software"...<br /><br /></p><br /><p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.orindasoft.com/public/blog/uploaded_images/ec35_install_1-790559.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 195px; height: 200px;" src="http://www.orindasoft.com/public/blog/uploaded_images/ec35_install_1-790558.png" alt="" border="0" /></a><br /><br /><br /><br /></p><br /><p><br /><br /><br /><br /><br /><br /><br /></p><br /><p><br /><br />Then add "http://www.orindasoft.com/public/ec35" as a new update site...<br /><br /></p><br /><p><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.orindasoft.com/public/blog/uploaded_images/ec35_install_2-789767.png"><img style="cursor: pointer; width: 350px; height: 400px;" src="http://www.orindasoft.com/public/blog/uploaded_images/ec35_install_2-789765.png" alt="" border="0" /></a><br /><br /><br /></p><br /><p><br />Now you've got the Orinda Site added you can go ahead and get a demo copy of the OrindaBuild plugin for Eclipse:<br /></p><br /><p><br /><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.orindasoft.com/public/blog/uploaded_images/ec35_install_3-722355.png"><img style="cursor: pointer; width: 392px; height: 400px;" src="http://www.orindasoft.com/public/blog/uploaded_images/ec35_install_3-722353.png" alt="" border="0" /></a><br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-8037282495632999269?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2010/02/orindabuild-web-service-generator-now.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-7779759376757044180Fri, 28 Aug 2009 16:06:00 +00002009-08-28T17:28:13.142+01:00SQLJPL/SQLJPublisherEclipseSQLDeveloperJDBCJDeveloperOrindaBuild writes the Java you need to call your PL/SQL procedures and SQL statements. Version 6 is now Production.<p><br /><span style="font-size:100%;">O</span>rindaBuild 6 automatically writes the JDBC calls and other Java code to call Oracle PL/SQL Stored Procedures from Java without having to use SQLJ or JPublisher. OrindaBuild can be pointed at your Oracle database and will write thousands of lines of access code in minutes. The end result is a Java service that exposes your existing Database's PL/SQL procedures along with any SQL statements others need access to.<br /><br /><br /></p><p><br /><br /><span style="font-weight: bold;">New Functionality supports all PL/SQL array types</span>.<br /><br /></p><p><br /><br /><br /><a href="http://www.orindasoft.com/public/blog/2009/02/orindabuild-6-beta-run-any-and-all.html">Previous versions</a> of OrindaBuild only supported one of the four different kinds of arrays in PL/SQL. We now support all of them, including arrays that can not be represented directly in JDBC.<br /><br /></p><p><br /><span style="font-weight: bold;">No other product can write Java JDBC calls for the PL/SQL OrindaBuild can.</span><br /><br /><br /></p><p><br /><br />Unlike JPublisher, OrindaBuild works with almost all possible PL/SQL procedures. OrindaBuild has no external dependencies other than JDBC drivers and does not require the use of SQLJ.<br /><br /></p><p><br /><br /><span style="font-weight: bold;"><br />Try generating Java to run your PL/SQL and SQL</span><br /><br /><br /></p><p><br /><br />A fully functional time limited demo version of OrindaBuild is available for download. In addition to a <a href="http://www.orindasoft.com/public/Pages.php4?location=Downloadtwo">stand alone version</a> it's available as extensions for <a href="http://www.orindasoft.com/public/SQLDeveloper%20Addintwo.php4#install">SQL Developer</a>, <a href="http://www.orindasoft.com/public/JDeveloper%20Addintwo.php4#install">Oracle JDeveloper</a> and <a href="http://www.orindasoft.com/public/Eclipse%20Plugintwo.php4#install">Eclipse</a>.<br /><br /><br /></p><p><br /><br />For further information see <a href="http://www.orindasoft.com/public/features.php4">here</a>.<br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-7779759376757044180?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2009/08/orindabuild-writes-java-you-need-to.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-4106432067071426271Tue, 10 Feb 2009 22:28:00 +00002009-02-20T16:24:58.540ZPL/SQLJDBCOrindaBuildArraysOrindaBuild 6 Beta: Run any and all PL/SQL or SQL as a Java service without writing code yourself<span style="font-weight: bold;"><p><b>The Need</b></span><br /></p><p><br />Utilities that automate the creation of Data Access Objects for Oracle and Java have been around for years, but suffered from a fundamental limitation - anyone who has worked with real-world Oracle databases for any length of time can tell you that simply being able to access the tables isn't good enough, and that much of the functionality of an Oracle database will be implemented in PL/SQL procedures and complicated SQL statements.<br /></p><p><br />Access to the raw data itself is at most 80% of the picture, and implementing the other 20% using a DAO paradigm involves re-implementing the same logic that lives in PL/SQL and complex SQL statements. So if you work with Java and you want to access an existing Oracle application you can really benefit from a utility that automates the task of writing all the Java JDBC calls you would otherwise need to write.<br /></p><p><br />To make things more complicated, there's a fundamental disconnect between the parameters you can pass to a PL/SQL procedure and those supported by Oracle's implementation of JDBC. Real-world PL/SQL makes extensive use of different kinds of records and arrays as parameters and return values for PL/SQL procedures and functions, but you can't directly use JDBC in every case because Oracle's JDBC implementation only recognize one kind of record and array.<br /></p><p><br />So while you can pass arrays of oracle Type objects to java via JDBC you can't pass arrays of records that are defined inside a PL/SQL package.<br /></p><p><br />This creates a problem for our Java developer, as they now have to either write a new PL/SQL API on top of the existing one or re-implement the logic expressed in the PL/SQL with individual SQL statements.<br /></p><p><br /><br /><span style="font-weight: bold;">What we used to do</span><br /></p><p><br /><br />The earlier versions of OrindaBuild worked within this limitation. We failed to understand how serious a limitation this was and assumed that because JDBC couldn't do it we couldn't do it either and therefore everyone had to live with this restriction. What we didn't initially realize was that the majority of the world's enterprise grade PL/SQL uses arrays or records that aren't supported by JDBC.<br /></p><p><br /><br /><span style="font-weight: bold;">No more limitations - pass <span style="font-style: italic;">any </span>kind of array you want to PL/SQL from Java</span><br /></p><p><br /><br />Over time it became clearer and clearer that we needed to address this issue. OrindaBuild 6, which went into Beta today, now supports access to <span style="font-style: italic;">all </span>possible arrays and records used by PL/SQL from Java, without you having to modify the PL/SQL.<br /></p><p><br />For example: OrindaBuild can write the Java classes Java< needed to call these PL/SQL Procedures. Follow the links to see the generated Java classes:<br /><br /><br /><br /></p><p><br /><code><pre> PACKAGE PACKAGE_ARRAY_EXAMPLE AS<br /></pre></code><code><pre> /*<br /></pre></code><code><pre> * THIS EXAMPLE SHOWS HOW TO CALL PL/SQL PROCEDURE <br /></pre></code><code><pre> * THAT TAKES A PARAMETER DEFINED IN A PL/SQL PACKAGE <br /></pre></code><code><pre> * AS AN ARRAY OF %ROWTYPE (TABLE RECORD).<br /></pre></code><code><pre> * <br /></pre></code><code><pre> * THERE IS NO DIRECT WAY TO CALL THIS PL/SQL PROCEDURE FROM JAVA.<br /></pre></code><code><pre> * <br /></pre></code><code><pre> * INSTEAD WE USE ORINDABUILD TO CREATE JAVA JDBC CODE THAT <br /></pre></code><code><pre> * CAN BYPASS THIS LIMITATION AND RETURN OR ACCEPT A PL/SQL <br /></pre></code><code><pre> * ARRAY FROM JAVA USING JDBC. <br /></pre></code><code><pre> * <br /></pre></code><code><pre> */<br /></pre></code><code><pre> --<br /></pre></code><code><pre> TYPE FLIGHTS_PLSQL_ARRAY IS TABLE OF FLIGHTS%ROWTYPE;<br /></pre></code><code><pre> --<br /></pre></code><code><pre> TYPE BOOKINGS_PLSQL_ARRAY IS VARRAY(30) OF BOOKINGS%ROWTYPE;<br /></pre></code><code><pre> --<br /></pre></code><code><pre> PROCEDURE <a class=news href="http://www.orindasoft.com/public/Java2HTML/com/orindasoft/demo/generated/plsql/PackageArrayExampleGetPlsqlArrayOfFlights.java.html">GET_PLSQL_ARRAY_OF_FLIGHTS</a><br /></pre></code><code><pre> (P_CITY IN FLIGHTS.DEPARTURE_CITY%TYPE<br /></pre></code><code><pre> ,P_FLIGHTS_FROM OUT NOCOPY FLIGHTS_PLSQL_ARRAY);<br /></pre></code><code><pre> --<br /></pre></code><code><pre> PROCEDURE <a class=news href="http://www.orindasoft.com/public/Java2HTML/com/orindasoft/demo/generated/plsql/PackageArrayExampleAddBookingsPlsqlArray.java.html">ADD_BOOKINGS_PLSQL_ARRAY</a><br /></pre></code><code><pre> (P_CUSTOMER IN CUSTOMERS%ROWTYPE<br /></pre></code><code><pre> ,P_BOOKING_TABLE IN BOOKINGS_PLSQL_ARRAY <br /></pre></code><code><pre> ,P_STATUS_MESSAGE OUT NOCOPY VARCHAR2);<br /></pre></code><code><pre> --<br /></pre></code><code><pre> END PACKAGE_ARRAY_EXAMPLE;<br /></pre></code><br /><br /><br><br /></p><p><br /><br /><span style="font-style: italic;">No other product has this capability.</span><br /></p><p><br />For an example of a generated Java service that uses Java to call PL/SQL procedures that take PL/SQL Package Arrays as parameters see <a class=news href="http://www.orindasoft.com/public/Java2HTML/com/orindasoft/demo/generated/DAOFactoryServiceImpl.java.html">here</a>.<br /><br /></p><p><br /><br /><br /><span style="font-weight: bold;">Getting OrindaBuild</span><br /><br /></p><p><br />OrindaBuild demo versions expire after roughly a month. We do the following kinds of Demos:<br /></p><p><br /><a href="http://www.orindasoft.com/public/Pages.php4?location=Downloadtwo">Full windows install</a> - OrindaBuild as a full stand alone Java Swing GUI.<br /></p><p><br /><a href="http://www.orindasoft.com/public/sdefeatures.php4"><br />Oracle SQL Developer Extension</a> - Works for SQL Developer 1.5.5440 and higher.<br /></p><p><br /><a href="http://www.orindasoft.com/public/ecfeatures.php4">Eclipse Plugin</a> - Works for versions 3.3 and 3.4<br /><br /></p><p><br /><span style="font-weight: bold;">Licencing</span><br /><br /></p><p><br />OrindaBuild is not free software. We have no problem with you downloading it as often as you want but we expect you to buy a license if you use it in a commercial environment. Note that OrindaBuild does not have a run time engine - it has a run time library, but license holders get the source and thus end up with a 100% source code solution. In practice you only need 1 copy of OrindaBuild per project.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-4106432067071426271?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2009/02/orindabuild-6-beta-run-any-and-all.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-7946735576892724542Tue, 13 Jan 2009 17:09:00 +00002010-02-27T12:15:41.760ZJavaPL/SQLSQLDeveloperJDBCOracleOrindaBuild Web Service Plugin for Oracle SQL Developer - 10,363 users and counting<p>Over the past two years we've put considerable effort in writing and in several cases re-writing OrindaBuild extensions for tools such as Oracle's <a href="http://www.oracle.com/technology/products/database/sql_developer/index.html">SQL Developer</a>, <a href="http://www.oracle.com/technology/products/jdev/index.html">JDeveloper</a> and <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-290.html">Eclipse 3.3</a>.<br /><br /></p><p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.orindasoft.com/public/_images/jdev_c4up2.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 199px; height: 77px;" src="http://www.orindasoft.com/public/_images/jdev_c4up2.jpg" alt="" border="0" /></a>We launched our JDBC code generator for Oracle SQL Developer 1.5 in July 2008. It's been a great success - as of today we've had 15,699 downloads from 10,363 different IP addresses. To add it to your copy of SQL Developer start the "Check For Updates" wizard and then choose "Third Party SQL Developer Extensions".<br /><br /></p><p><br />Once installed you'll find that an "OrindaBuild" files folder is added to the folders that appear under each connection. When you double click on the file you open OrindaBuild for the parent connection and can create Java to run your PL/SQL procedures, access tables or call any SQL statement. For more information see <a href="http://www.orindasoft.com/public/sdefeatures.php4">here</a>.<br /></p><p><br /><br />The demo version of the product expires after 6 weeks, but we allow repeated demo installs provided you don't use the product commercially.<br /></p><p><br /><br />Currently the product doesn't handle write Java to call PL/SQL procedures that take ARRAY or VARRAY objects defined inside PL/SQL packages. We have just finished implementing this and will release a Beta within a week or so. This means that OrindaBuild will soon be able to write Java to call pretty much any PL/SQL that lives inside your Oracle database, even if it can't be directly represented using JDBC.</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-7946735576892724542?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2009/01/orindabuild-jdbc-plugin-for-oracle-sql.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-6334674048425642878Mon, 30 Jun 2008 21:31:00 +00002008-06-30T23:26:01.665+01:00COMMIT WRITE10.2JDBC11.1OracleUsing "Commit Write Batch Nowait" from within JDBC<p>Anyone who has used the new asynchronous commit feature of Oracle 10.2 will be aware that it's very useful for transaction processing systems that would traditionally be bound by log_file_sync wait events.<br /></p><p><br />COMMIT WRITE BATCH NOWAIT is faster because it doesn't wait for a message assuring it that the transaction is safely in the redo log - instead it <span style="font-style: italic;">assumes </span>it will make it. This nearly eliminates log_file_sync events. It also arguably undermines the whole purpose of commit, but there are many situations where the loss of a particular transaction (say to delete a completed session) is perfectly survivable and far more preferable than being unable to serve incoming requests because all your connections are busy with log_file_sync wait events.<br /></p><p><br />The problem anyone using Oracle's JDBC driver is that neither the 10.2 or 11.1 drivers have any extensions which allow you to access this functionality easily - while Oracle have lots of vendor specific extensions for all sorts of things support for async commit is missing.<br /></p><p><br />This means you can:<br /></p><p><br /><ul><li><span style="font-weight: bold;">Turn on async commit at the instance level by messing with the COMMIT_WRITE init.ora parameter</span>. There's a really good chance this will get you fired, as throughout the entire system COMMIT will be asynchronous. While we think this is insane for production systems there are times where setting it on a development box makes sense, as if you are 80% log file sync bound setting COMMIT_WRITE to COMMIT WRITE BATCH NOWAIT will allow you to see what problems you face if you can somehow fix your current ones.</li></ul><br /></p><p><br /><ul><li><span style="font-weight: bold;">Change COMMIT_WRITE at the session level.</span> This isn't as dangerous as doing it system wide but it's hard to see it being viable for a real world system with transactions people care about.</li></ul><br /></p><p><br /><ul><li><span style="font-weight: bold;">Prepare and use a PL/SQL block that goes "BEGIN COMMIT WRITE BATCH NOWAIT; END".</span> This is safer than the first two ideas but still involves a network round trip.</li></ul><br /></p><p><br /><ul><li><span style="font-weight: bold;">Wrap your statement in an anonymous block with an asynchronous commit</span>. This is the best approach we've seen. Your code will look something like this:</li></ul><br /></p><p><br /><br><br /><pre><code>BEGIN</code></pre><br /><pre><code>--</code></pre><br /><pre><code>insert into generic_table</code></pre><br /><pre><code>(a_col, another_col, yet_another_col)</code></pre><br /><pre><code>values</code></pre><br /><pre><code>(?,?,?);</code></pre><br /><pre><code>--</code></pre><br /><pre><code>COMMIT WRITE BATCH NOWAIT;</code></pre><br /><pre><code>--</code></pre><br /><pre><code>END;</code></pre><br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-6334674048425642878?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2008/06/using-commit-write-batch-nowait-from.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-492040808896238204Wed, 15 Aug 2007 07:23:00 +00002007-09-06T09:25:05.360+01:00JavaSQLDeveloperJDBCOracleJDeveloper11GOracle 11G first lookOracle 11g is now available for download, but only for Linux. This blog posting covers practical issues we've seen since we started playing with it. If you are looking for marketing/new feature info you can find the PDF's <a href="http://www.oracle.com/technology/products/database/oracle11g/index.html">here</a>.<br /><br /><br /><br /><ol></ol><br /><span style="font-size:130%;"><br />Installation</span><br /><ol></ol><br /><br /><br /><ol><li>Download is a 1.8GB zip file. </li><li>The Installer requires a minimum of 922MB of memory and large quantities of swap space. If you need more swap you can use 'swapadd'.</li><li>Installer for X86 expects recent patches - don't think that your copy of RHEL4 will work without new rpm's.</li><li>Oracle has changed the default location of the *dump and other configuration directories.</li><li>Some minor Kernel tweaks required.</li></ol><br /><br /><ol></ol><br /><span style="font-size:130%;"><br />DB Upgrade Process</span><br /><ol></ol><br /><br /><br /><br />Process expects that your copy of 10.2.0 is patched to 10.2.0.3.0 to address a DST issue. If not you have to manually apply Oracle patches and jump through various other hoops. We encountered problems with the upgrade and eventually built an11g DB from scratch for our regression testing. This may a fundamental problem with the upgrade but is more likely to be because 'someone' unplugged our router during the upgrade process and left the DB in a mess.<br /><br /><br /><br /><ol></ol><br /><span style="font-size:130%;"><br />Security<br /></span><ol></ol><br />Passwords are now case sensitive. This will cause hours of fun.<br /><ol></ol><br /><span style="font-size:130%;"><br />11g JDBC Driver</span><br /><ol></ol><br /><br /><ol><li>1.4 and earlier versions of Java are not supported.</li><li>9.0.1 and prior versions of Oracle are not supported.</li><li>'oracle.jdbc.driver' is gone - but then it's been deprecated since 9i...</li><li>We were expecting OracleConnection to be extended to prrovide support for Asynchronous Commit, but that didn't happen. We'll be adding our own support to OrindaBuild.</li></ol><br /><br /><br /><ol></ol><br /><span style="font-size:130%;">JPublisher</span><br /><ol></ol><br /><br />The 11g version of JPublisher still creates .sqlj files but then deletes them after producing .java files. JPublisher still has all its other limitations.<br /><br /><ol></ol><br /><span style="font-size:130%;"><br />OrindaBuild 11g Support</span><br /><ol></ol><br /><br />We have completed regression testing and the first build that supports 11g is available <a href="http://www.orindasoft.com/public/Pages.php4?location=Downloadtwo">here</a>. JDeveloper users can use this update center: <br /><ol></ol><br />http://www.orindasoft.com/public/jdev103Center.xml<br /><ol></ol><br />SQLDeveloper users can use this update center:<br /><ol></ol><br />http://www.orindasoft.com/public/sqldevCenter.xml<span style="font-size:100%;"><a href="http://www.orindasoft.com/public/sqldevCenter.xml" class="news"></a><ol></ol></span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-492040808896238204?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2007/08/oracle-11g-first-look.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-138389255579174221Thu, 12 Jul 2007 06:11:00 +00002007-07-12T07:17:54.858+01:00OracleOracle's DECODE funtion...Oracle's decode function can be used to create arbitrary ORDER BY clauses. This is useful if you are providing lists with the most frequently picked value at the top - e.g. a list of countries which starts with 'United States' and then turns into a conventional alphabetical listing. Your SELECT statement will have two things in the ORDER BY clause - first it sorts by a DECODE that turns your favoured value into '1' and all other values into '2' and then it sorts the rest of the list conventionally. The alternatives to using DECODE are to hard code the entire list (bad!) or add a numeric column to the underlying table that defines the sort order, which is a lot more work than a DECODE in an ORDER BY.<br /><br /><pre><br />SQL> r</pre><br><pre></pre><br><pre><br />1 select country_name</pre><br><pre><br />2 from iso_countries</pre><br><pre><br />3* order by decode(country_name,'UNITED STATES',1,2)<br /></pre><br><pre> , country_name</pre><br><pre><br /></pre><br><pre></pre><br><pre><br />COUNTRY_NAME</pre><br><pre><br />--------------------------------------------------</pre><br><pre><br />UNITED STATES</pre><br><pre><br />AFGHANISTAN</pre><br><pre><br />ALBANIA</pre><br><pre><br />ALGERIA</pre><br><pre><br />AMERICAN SAMOA</pre><br><pre><br />ANDORRA</pre><br><pre><br />ANGOLA</pre><br><pre><br />ANGUILLA</pre><br><pre><br />ANTARCTICA</pre><br><pre><br />ANTIGUA AND BARBUDA</pre><br><pre><br />ARGENTINA</pre><br><pre><br />...</pre><br><pre></pre><br><pre><br /></pre><br /><br />This behavior is common for web sites where drop down lists have to be dynamic (the contents may change) but also require location or market specific default preferences.<br /><br /><br /><br /><br /><br />While we're on the subject of lists of countries one really should think twice before including <a href="http://en.wikipedia.org/wiki/Bouvet_Island">Bouvet Island</a> one's list...<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-138389255579174221?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2007/07/oracles-decode-funtion.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-437970200002244632Wed, 11 Jul 2007 21:27:00 +00002007-07-11T22:33:23.094+01:00BLOBs, CLOBs and BFILEs<span style="font-size:180%;"><p>Summary</p></span><br /><br /><br /><div style="text-align: left;"><span style="font-size:100%;"><p>Oracle users currently have 3 different Large OBject data types to choose from - BLOB, CLOB and BFILE. We'll look at the basic mechanics of how they work from a Java developers perspective and then explain why oracle.sql.BFILE poses serious challanges for web service developers.</p><br /><p><br /><br /><br /><span style="font-size:130%;">LOB's 101</span><br /></p><br /><br /><br /><p><br />When you retrieve an oracle.sql.BLOB or oracle.sql.CLOB the single most important thing to understand is that you're dealing with a pointer, not a file. Not only that, but that the oracle.sql.CLOB you just retrieved from the database is totally independent of the SQL statement or PL/SQL procedure that was used to return it to you. What you've actually got is a pointer to a large object inside the database that will continue to exist until your commit, rollback or lose your connection. Once you understand this life will become bearable. There are significant API changes for Oracle's JDBC drivers as you move up through the different versions of Oracle. You will need to re-read the JavaDocs and check your LOB code line by line when you upgrade. Of course, if you used OrindaBuild you could just re-generate your code...<br /></p><br /><p><br /><span style="font-size:130%;">BFILE</span><br /></p><br /><p><br />oracle.sql.BFILE is different. A BFILE is a pointer to a file that resides outside the database. In fact a BFILE consists of two things:<br /><br /></p></span><ol><li>The name of an Oracle DIRECTORY (as found in the ALL_DIRECTORIES view)</li><li>The name of the file within that directory</li></ol><span style="font-size:100%;"><p><br />oracle.sql.BFILE objects are small - often under 100 bytes. Oracle makes no attempt to verify that the file referred to by the oracle.sql.BFILE exists and is usable until you attempt to read from it. The only way to create an oracle.sql.BFILE is to call use the SQL function BFILENAME, which implies a database call. You can quite happily create BFILE objects for files which don't exist. This makes sense when you consider how much work checking every BFILE every time it was referred to would impose on the server, but obviously needs to be understood by the developer.<br /></p><br /><p><br /><span style="font-size:130%;">LOBs and Web Services</span><br /></p><br /><p><br />If you're going to write a Web Service app and are one of the surprising number of people who are still on 8i you should upgrade to at least 9i. Creating CLOBS and BLOBS is a lot easier because of the createTemporary() method that appears in 9.0.1.Using LOBS in a Web Service environment is not a problem, provided you think carefully about how big the LOBs will actually be and how much memory you'll need - Oracle can support huge CLOBS and BLOBS that simply wouldn't be practical in a Web Service scenario.Creating BFILES and Web Services. If you are writing a web service application that stores LOBs in Oracle you should avoid the use of the BFILE data type. It may well seem very tempting but the JVM which is running the service will need to be on the same filesystem as the Oracle database server, which will severly limit scalability. If, as is normal, your JVM is on a different machine you could in theory get round this by creating a BFILE that points to a non-existent directory/file on the database server and then trying to asynchronously move the file to where the BFILE pointer claims it is before anyone actually tries to read the BFILE. For obvious reasons we don't recommend this.<br /></p><br /><br /><span style="font-size:78%;">[This post originally appeared on JRoller] </span><br /></span></div><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-437970200002244632?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2007/07/blobs-clobs-and-bfiles.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-4591380623179306316Sun, 01 Jul 2007 16:51:00 +00002007-07-12T00:01:08.091+01:00JavaJDBCOracleNot All Jdbc Advice Is Good JDBC Advice...While wandering around the web I stumbled across a link to a <a href="http://www.onjava.com/pub/a/onjava/excerpt/oraclejdbc_19/index.html?page=1"> sample chapter</a> for 'Java Programming with Oracle JDBC', published in December 2001 by O'Reilly. Now 2001 is a bit dated but one would assume that if they are plugging it on their web site it must still be relevent. And that any <i>glaring </code></p><p><code>errors</i> would have been corrected, right? Think again...<p></p><p>The author spends the chapter conducting elaborate benchmarks which in his view demonstrate that there's nothing special about <b>PreparedStatement</b><br />and that you should really be using Statement most of the time. His reasoning is based on the premise that the additional set up costs of Prepareing a statement and sending all the bind variables etc cause applications to run more slowly than if you had simply said something like:<br /></p><p><code>code></p><p><br /><p><code>Statement stmt = conn.createStatement();<br /></code></p><p><code>stmt.executeUpdate(<br /></code></p><p><code>"insert into oehr.testxxxperf ( id, code, descr,insert_user, insert_date ) "<br /></code></p><p><code>"values ( " + Integer.toString( i ) + ", '125678901234567890', "<br /><code></code></p><p><code>"'1234567890', " +</code></p><p><br /><code></code></p><p><code><br /></code></p><p><br /><code></code></p><p><code>"USER, to_date('" + sdf.format(new java.util.Date(System.currentTimeMillis()))<br />+ "', 'YYYYMMDDHH24MISS'))");<code></code></code></p><p>instead of:</p><code>PreparedStatement stmt = conn.prepareStatement(<br /></code></p><p><code>"insert into oehr.testxxxperf ( id, code, descr,insert_user, </code></p><p><code>insert_date ) " +<br /></code></p><p><code>"values ( ?, ?, ?, ?, ? )");<br /></code></p><p><code>startTime = System.currentTimeMillis();<br /></code></p><p><code>int i=1;<br /></code></p><p><code>stmt.setInt(1,i);<br /></code></p><p><code>stmt.setString(2,"123456789012345678901234567890");<br /></code></p><p><code>stmt.setString(3,"123456789019012345678901234567890");<br /></code></p><p><code>stmt.setString(4,"ZXVI01");<br /></code></p><p><code>stmt.setDate(5,newjava.sql.Date(System.currentTimeMillis()));<br /></code></p><p><code>stmt.executeUpdate();<p><br /></code><br /><p><br />The point made is that unless you plan on issuing <i>hundreds</i> of statements the first method is faster because it has fewer network round trips and therefore less elapsed time. All of which is true - provided there is only 1 copy of the client software being used. In practice what will happen is that using <b>Statement</b> in preference to <b>PreparedStatement</b> will cause the database server to devote significant resources to compiling execution plans for <i>each and every</i> version of the insert statement being called. Indeed, not using <b>PreparedStatement</b> and bind variables is listed as the second most common mistake in Oracle's '<br /><a href="http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96532/ch2.htm#13670">Top Ten Mistakes Found in Oracle Systems</a>'.There's also a less obvious but equally serious problem with cobbling together your SQL statements instead of using bind variables and <b>PreparedStatement</b> - sooner or later someone with an apostrophe in their name will show up and cause a syntax error:<br /></p><br /><br /><p><code>Int empno = 42;<br /></code></p><p><code>String empname = "O'Reilly";<br /></code></p><p><code>String myStatement = "INSERT INTO EMP (empno, ename) VALUES ("<br /></code></p><p><code>+ empno + ",'" + empname + "');";<br /></code></p><br /><p><br /></p><p><br />But wait... it gets worse! If you're working on a public facing web system and some bright spark realizes you are hacking together SQL statements you could have something like this happen:<br /></p><br /><p><code><code><br />Int empno = 42;<br /></code></p><p><code>String ename = "'Smith', sal = 99999";<br /></code></p><p><code>String myStatement = "UPDATE EMP set ename = "<br /></code></p><p><code>+ ename+ " WHERE empno = " + empno');";<br /></code><p></p><p><br /></p><p>which means that your Statement would be:</p><br /><code>UPDATE EMP set ename = 'Smith', sal = 99999 WHERE empno = 42;<br /></code><br /><p></p><p><span style="font-size:78%;">[This post originally appeared on JRoller]</span></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-4591380623179306316?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2007/07/not-all-jdbc-advice-is-good-jdbc-advice.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-8326568062705036459Wed, 20 Jun 2007 16:27:00 +00002007-07-11T19:36:59.396+01:00OracleRowid Madness<p>For years the first of my interview questions for Oracle developers has been one in which I ask them to explain why it's a bad idea to use the ROWID of table 'A' as a foreign key to table 'B'. This is not hard for a competant person to answer, as ROWID changes when you import the data into another database which will happen sooner or later. It never occured to me that someone could be crazy enough to actually do this, but someone <a href="http://groups-beta.google.com/group/comp.databases.oracle.server/browse_frm/thread/5a70bbe4a79cd596/e981567d07fee3fe?q=ROWID+group:comp.databases.oracle.*&rnum=1&amp;hl=en#e981567d07fee3fe"> has</a>.</p><br /><p><span style="font-size:78%;">[This post originally appeared on JRoller]</span><br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-8326568062705036459?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2007/07/hello-world.htmlnoreply@blogger.com (David Rolfe)0tag:blogger.com,1999:blog-5277382285438737960.post-5544982857412813230Wed, 06 Jun 2007 19:03:00 +00002007-07-11T19:35:47.539+01:00JavaWhy '43113f...0308' is bad news for Java users...<p>While going through our web server logs recently we found out that we had our first single word google hit. Unfortunately the word in question is <a href="http://www.google.com/search?hl=en&q=43113f32554e54494d45110e4350500308&amp;btnG=Google+Search">43113f32554e54494d45110e4350500308</a>,<br />which we suspect isn't terribly memorable. It's thrown as an error id when the JVM crashes and is referred to in the <a href="http://www.orindasoft.com/public/Supporttwo.php4#Java_VM_Crashes_when_asked_to_generate_a_large_number%28hundreds%29_of_java_files">support</a> section of our web site.</p><p>We've now had hundreds of people show up at our web site trying to find out about this. We suspect we may see many more, as the underlying problem appears to affect all applications that use the Java 1.3 or 1.4 JVMs.</p><p>If you encounter this you will find the following information useful:<br /></p><p></p><ul><ul><li>This is Sun bug <a class="news" href="http://developer.java.sun.com/developer/bugParade/bugs/4820592.html" target="_blank">4820592</a>.</li><li>The bug appears to be limited to x86 based systems.</li><li>The bug will appear as a JVM crash after the application has done a fair amount of work.</li><li>If you try and use the 'debug' mode of an IDE such as Eclipse the JVM crash will take place at odd and changing locations.</li><li>Using interpreted mode ('-Xint') is an effective workaround.</li><li>Changing other JVM parameters may postpone the crash but will not prevent it.</li><li>To prevent it you can:<br /></li><ul><li>Move to Java 1.5</li></ul><ul><li>Rewrite your code.</li></ul></ul></ul>In our case we were able to fix the problem by replacing an ArrayList of String[] with an ArrayList of File, with each File containing 0 or more String. We suspect that the presence of zero length 'String[]'s in the arraylist was the root cause of the problem.<br /><p></p><p><span style="font-size:78%;">[This post originally appeared on JRoller]</span> </p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277382285438737960-5544982857412813230?l=www.orindasoft.com%2Fpublic%2Fblog%2Forindablog.html' alt='' /></div>http://www.orindasoft.com/public/blog/2007/07/why-43113f32554e54494d45110e4350500308.htmlnoreply@blogger.com (David Rolfe)0