SPWrapper generates java (and now python) classes able to invoke stored procedures and to execute sql statements for you: you just have to give it the stored procedure name or the sql statement.
Be the first to post a text review of SPWrapper. Rate and review a project by clicking thumbs up or thumbs down in the right column.
this release fixes a bug with netbeans 6.1, due to a log library incomatibility. It also introduces DYNTABLES, very useful with oracle stored procedures with refcursors. Data in ref cursor gets loaded into a list of hash tables. The list preseves rows sorting and the has table make data access available through column names.
Added dyntable support for oracle result set in stored procedures
Hello, the new release increases the support for ref cursor with stored procedures introducing dyntable datatype. DYNTABLE make it easyer to deal with these result set. You simply have to provide an overry rule in the ant makefile to turn a result set output into a dyntable output. For each dyntable parameter this snippet is added to the generated source code java.sql.ResultSet r_X_RIGHE_CONTAB=(narrowedStatement).getCursor(8); if (r_X_RIGHE_CONTAB != null) { ResultSetMetaData meta = r_X_RIGHE_CONTAB.getMetaData(); while (r_X_RIGHE_CONTAB.next()) { HashMap<String, Object> row = new HashMap<String, Object>(); int colNo = meta.getColumnCount(); for (int i = 1; i <= colNo; i++) { String name = meta.getColumnName(i); row.put(name, r_X_RIGHE_CONTAB.getObject(i)); } X_RIGHE_CONTAB.add(row); } } X_RIGHE_CONTAB is the output parameter name, the result set. The result set is iterated and a new hashmap is created for each row, then each column object is read out with getObject, and pushed into the hashmap. Notice that the Oracle JDBC driver returns column names all uppercase, so the Hash key are all uppercase strings. The actual hashmap value is always the object returned by the jdbc driver, so some surprise can occour. For instance Number types are converted to BigDecimals! If you are using the code inside Tomcat you have one furter step to do before using this code. You have to make the underlying connection directly available to SPWrapper. In fact Tomcat hides the native connection inside its pooling object, but we need the proprietary getCursor method to retrive the data. Open you context file and add change the Resource tag as follows <Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" name="jdbc/xxxx" password="xxxx" type="javax.sql.DataSource" url="jdbc:oracle:thin:@10.10.10.10:1521:ORCL" username="yyyyy" accessToUnderlyingConnectionAllowed='true' /> The key is to add the accessToUnderlyingConnectionAllowed='true' attribute to the resource. Now you are ready to use DYNTABLEs inside your web pages.
Be the first person to add a text review.
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use
Thanks for your rating!
Would you also like to write a review?