Blog PostsStatistics Feedback About Login  


Go

Blog Selection


Add Default to Tabular Form in APEX
4
Dimitri Gielis 09-AUG-2010 15:58

If you want to set a default value for a column in your tabular form, you can set the Default Type to "PL/SQL Expression or Function" and put into Default e.g. 'N'.


That sets the default for that column to the static text 'N'.
Show Comments (0)

Oracle Continues their Acquisition Path
4
Bradley Brown 09-AUG-2010 12:50

Do you work for a company that might be in Oracle's path?  How do you feel about working for Oracle?  Personally I'd love to figure out the gap that Oracle has today, develop software that fills that gap and then sell it to them in 2-5 years.  Stephen Jannise of Distribution Software Advice has written a good article about their strategy, history, and targets.  He also has a poll that you can participate in.  I'd love to hear feedback on people's thoughts about all of the above!

http://www.softwareadvice.com/articles/enterprise/oracle-mergers-acquisitions-whos-next-1080310/
Show Comments (0)

Proxy Authentication with Thoth Gateway
4
Oradude 08-AUG-2010 06:00

Christian Vind submitted an enhancement request for the Thoth Gateway to support Oracle proxy authentication by passing on the current Windows username to the database connection string.

The point of proxy authentication is that

  • The proxy user only has "create session" privileges but can't do much else.
  • The real user does not have "create session" privileges and cannot log on to the database without knowing the proxy user name and password (and that is only set on the web/application server).
  • The USER function returns the real user name, and all standard database auditing, roles, etc. work as usual.

As of version 1.3 of the Thoth Gateway, proxy authentication is now supported. Here is how it works:


IIS Setup

Set up the application (virtual directory) in IIS where the gateway runs with Integrated Windows Authentication, so that the CGI environment variable LOGON_USER will be populated with the client's Windows username. (If the user is using Internet Explorer to browse the site, his identity will be passed on to the web server/gateway automatically; if using another browser, then an explicit logon is required.)

Oracle Setup

Define an "application server user", ie the common user that connections will be established through:


-- Log on as DBA (SYS or SYSTEM) that has CREATE USER privilege.


create user appserver identified by eagle;



create user end_user identified by secret;
grant create session to end_user;
alter user end_user grant connect through appserver;




Now test the setup with SQL*Plus, by connecting with the "application server user", and then "becoming" the end user:



-- note we don't specify the end_user password, but still become that user


SQL> connect appserver[end_user]/eagle
Connected.
SQL> select user from dual;


USER
------------------------------
END_USER


SQL>



Note that since the point of this is to take advantage of existing Active Directory accounts, you probably want to create your users like this:


create user "your_domain\end_user" identified externally;
grant create session to "your_domain\end_user";
alter user "your_domain\end_user" grant connect through appserver;




Thoth Gateway Setup

In web.config, modify the DAD settings (the following example assumes a local Oracle XE installation):


param name="DatabaseConnectString" value="//127.0.0.1:1521/xe"
param name="DatabaseConnectStringAttributes" value="Enlist=false;Proxy User Id=appserver;Proxy Password=eagle;"
param name="DatabaseUserName" value="LOGON_USER"
param name="DatabasePassword" value=""


Notice the value "LOGON_USER" specified for the DatabaseUserName parameter. This is a reserved string that will be replaced with the actual value of the LOGON_USER value from the web request (ie. the user's Windows username, typically "domain\username"). You can also specify "LOGON_USER_NO_DOMAIN" to strip away the domain part of the user name -- what you use will depend on how you have set up your user accounts in Oracle.

Testing It

To test that everything works at this point, create a procedure similar to the following, and execute it via the gateway (don't forget to grant execute privileges on it to the end-user's account, and create a public synonym for it unless you prefix with the procedure owner's name in the URL).


procedure test_proxy_auth
as
begin


  htp.header(1, 'Proxy authentication');


  htp.ulistopen;
  htp.listitem ('USER = ' || user);
  htp.listitem ('Proxy user = ' || sys_context('userenv', 'proxy_user'));
  htp.listitem ('CGI LOGON_USER = ' || owa_util.get_cgi_env('LOGON_USER'));
  htp.ulistclose;


end test_proxy_auth;



If successful, the USER function should return the end-user's Windows username, and the Proxy User should display as "appserver".

Postscript: A little enigma

Actually, if you do as described above, you could possibly get this error when you try to run the procedure via the gateway:

ORA-1045: user %s lacks CREATE SESSION privilege; logon denied


At least, that's what I got . To get around it, I had to explicitly grant this to the "appserver" user:

grant create session to appserver;

The funny thing is that my example above, tested via SQL*Plus, shows that this works without the grant! But when attempting the same connection via ODP.NET, it gives the above error unless the grant is made.

And if I revoke the "create session" from the end_user, the above example doesn't work in SQL*Plus, because of the missing privilege. Which seems to contradict the purpose of proxying, as defined at the top of this blog post.

If anybody knows why SQL*Plus and ODP.NET show different behaviour here, please let me know.

Show Comments (0)

Thoth Gateway version 1.3 available
4
Oradude 08-AUG-2010 05:31

There is a new version of the Thoth Gateway, a mod_plsql replacement for IIS, available for download. The latest version is 1.3.

It contains the following bug fixes and enhancements:



  • Bug Fix: Issue with parsing client IP address: Added exception handling to prevent error when parsing client IP address with invalid format.
  • Ignore additional request parameters: Certain tools and frameworks may dynamically add additional parameters to a request, which causes the corresponding PL/SQL call to fail, since these parameters are not defined in the procedure signature. As of this version, the gateway will now retry the call after dropping (ignoring) any parameters that cannot be found in the Oracle data dictionary for the procedure being called.
  • Support for Oracle proxy authentication (and Single Sign On) via dynamic username substitution: Oracle proxy authentication, combined with Integrated Windows Authentication in IIS, allows you to pass the end-user's identity from the client to the database session (so the function USER will return the end-user's Windows username, with no login required). This is useful in an intranet scenario where users are defined in an Active Directory domain and use Internet Explorer to access the PL/SQL web application.


For existing installations, simply overwrite the existing PLSQLGatewayModule.dll file in the "bin" folder with the latest version from the downloaded archive.
Show Comments (0)

DBA_QUEUES and the little mistery of the blanks
4
Oracle Quirks 06-AUG-2010 17:50

 
Show Comments (0)

APEX 4.0 Enhancements: Validating Form Data
4
Anthony Rayner 05-AUG-2010 13:48

Oracle Application Express 4.0 introduces lots of big new features; websheets, dynamic actions, plug-ins, RESTful web services, team development, updated charts, the list goes on. But there are also many enhancements to existing functionality that we hope will help to simplify the overall process of developing applications in APEX. One such area, and the focus of this post is how data is validated. This post will give you an overview of what's changed with validations and how these changes will make your daily development life a little easier.


Item-Centric Validation
Historically in APEX if you want to validate data input on a page, you create a validation. The validation is a separate component that you need to define and maintain. Now in APEX 4.0, the actual item can handle some simple validation of the data it receives. For example, all item's (both native to APEX and plug-ins) now have a 'Value Required' attribute. By setting this to 'Yes', APEX will automatically validate a value has been entered and raise an error if not, no separate validation required.

Additional to this 'Value Required' validation, some item types also validate their data, based on how the item is defined. For example, the new 'Number' item type, which you can use for handling numeric data contains settings for 'Minimum Value' and 'Maximum Value'. When these are defined, APEX will automatically validate the data received based on these settings and raise appropriate errors.

Settings for the new 'Number' item, settings highlighting are automatically validated

The new datepicker item in APEX 4.0 also supports this type of automatic validation. Additional to the 'Value Required' setting (available for all items), the datepicker also allows setting 'Format Mask', 'Minimum Date', 'Maximum Date' and 'Year Range'. In doing so, APEX will again automatically validate the data received based on these settings and raise appropriate errors.

Settings for the new 'Date' item, settings highlighting are automatically validated

Plug-in items may also contain automatic validations, depending on whether the plug-in author has coded in this support.

You also have a couple of ways of customising the error message that is displayed by APEX when these validations fail, in terms of content and position. To override the default error messages, please refer to this section of the user guide. This details all of the 'Text Messages' that you would need to define in your applications to override the defaults. If you want to change where the error is displayed on screen, please see the 'Default Error Display Location' attribute available via 'Edit Application Properties' on the application homepage.

Finally, debug mode has also been enhanced to show when these validations are executed and whether they passed or failed.

Item based validations offer a more logical approach to validating data and requires fewer moving parts, which means less to define and less to maintain. Of course, for other more complex situations a separate validation will still be required, but this greatly simplifies some of the more common, simple scenarios.


Button-Centric Validation Exclusion
Again, historically in APEX if you don't want a validation to fire when certain buttons are pressed, you would define that logic in the validation. Let's take an example. If you have a typical 'Form' page used for inserting, updating and deleting data, you may want your validations to fire for insert and update, but not for delete. This would involve going through each validation and setting some condition such as where REQUEST != 'DELETE' or similar, to prevent the validation from firing. Now, in APEX 4.0, the actual button can be defined to either 'Execute Validations' or not.

Specify that pressing the button should not cause any validations to fire.

This is much easier, all you need to do is set this at button level and that's it, no item, plug-in or custom validations will fire. Wizard created forms will set this up for you automatically, so when creating these types of forms, the 'Create' and 'Save' buttons execute validations and the 'Delete' and 'Cancel' buttons do not.

You can also override this at validation level by setting the 'Always Execute' validation attribute to 'Yes' (defaults to 'No'). This could be useful for example if you want to always execute a security check, regardless of any button exclusions.

Debug mode has again been enhanced here to show if validations are prevented from firing because of the button setting.


Tabular Form Validations
APEX 4.0 now also supports declarative validation of tabular form data. Before APEX 4.0, there was no declarative support for validating this type of form and you would have to do a lot of manual PL/SQL to validate your data. Currently, tabular form validations only support a subset of what's available with page item validation, but do cater for some of the more common scenarios (required values, type checks and string comparisons). We are looking to extend this in a future release of APEX.


Error Message Label Placeholders
This is small but one of my favourites. When defining an error message that displays when a validation fails, if the validation is associated with a specific page item, you can now use the #LABEL# placeholder to dynamically reference the associated item's label.

Use #LABEL# instead of hard-coding the associated item label text.

So instead of having to duplicate the label text in the error message (and have to remember to change it if you change the item's label) as was historically the case, just use the #LABEL# placeholder and that's it. Again, less to define and less to maintain. An equivalent placeholder is also available for the new tabular form validations, .


Upgrading Applications
So finally, what about your existing APEX applications that have been long since built, where you want to take advantage of some of these new features. Well, take a look at the 'Upgrade Application' feature available via the 'Utilities' menu from the application homepage. This assists you in upgrading your application to use some of the new features in APEX 4.0.

Of particular relevance to validations are the following upgrade types:
  • Update Text Field Item to Number Field Item, where appropriate - Locates where you have an unconditional 'Is Numeric' validations on 'Text Field' items and upgrades them to use the 'Number' item type with in-built numeric checking. Also removes the now redundant separate validation.
  • Update Value Required item attribute to Yes, where appropriate - Locates where you have unconditional 'Not Null' validations on items and sets those item's 'Value Required' attribute to 'Yes'. Also removes the now redundant separate validation.
  • Numeric, Required and Date Picker Item updates based upon conditional validations - Just locates where you have conditional validations for 'Is Numeric', 'Not Null' or 'Is Valid Date' on 'Text Field' items, for your manual review. So you can determine if the validation can be replaced with some item settings and button exclusions.


So quite a few little enhancements that hopefully add up to easier and more intuitive data validation. Good luck with your new APEX 4.0 style validations and let us know what you think!

Many thanks to Patrick Wolf for reviewing this post and filling in the gaps.
Show Comments (0)

Upgrade to APEX 4.0 - Known Issues - Workarounds and Patches
4
Dimitri Gielis 04-AUG-2010 15:21

If you upgrade your application from APEX 3.x to 4.0 you might encounter some issues.

At ODTUG I did a live migration of an application written in APEX 3.2 to 4.0 and I talked about some of the issues I discovered and how I worked around them. I'm doing the same presentation at APEXPosed in Brussels in October. You also might have seen my previous posts where I upgrade DG Tournament from APEX 3 to 4.

On the Known Issues page you see the issues categorized nicely. If the issues can be fixed by working around it, it's also mentioned there. Oracle is working hard on a patchset (4.0.1) and they hope to release it soon. On Metalink you can already find patches for specific issues too.

I plan to write some other blog posts with steps I did when upgrading DG Tournament to APEX 4.0.
Show Comments (0)

APEX Father is speaking ...
4
Dimitri Gielis 04-AUG-2010 14:54

If you didn't pickup another important APEX blog to follow yet... you definitely want to follow Mike Hichwa.

Mike is the "father" of APEX, it must be over 10 years ago he started with the development of APEX (HTMLDB/Project Flows).

Mike is a VP at Oracle and is now responsible for a lot more than APEX alone. He also has SQL Developer and many other tools all related to Database Development.
Show Comments (0)

Using APP_ID in Translations
4
Peter Raganitsch 04-AUG-2010 12:25

Just a quick note: When you are working with a multilingual/translated APEX Application you sometimes need to join LOV Values in your SELECT Statement. Given Example, you have a report which reads from some table and joins the values you have defined in a Static LOV SELECT SOME.A , SOME.B
Show Comments (0)

ODTUG comes to Europe in October! Registration open!
4
Dimitri Gielis 03-AUG-2010 16:00

As announced on the latest OBUG APEX SIG, we will participate in the first ever ODTUG event in Europe!

It's a two day conference focused on PL/SQL and APEX, with two full tracks for each.

If you look at the Agenda you will see the presenters are well known in the APEX community and amongst the best in their field. On the PL/SQL side you have ofcourse Steven Feuerstein and a lot of other big names.

Registration is open now, so don't wait to register, places are limited!
Show Comments (0)

 1 2 3 4 5 6 7 8 9 10 








 
 
Blog Roll
  • APEXtras
  • Ahcene Bourouis
  • Andy Tulley
  • Anja Hildebrandt
  • Anthony Rayner
  • Anton Nielsen
  • Apex Blog
  • Apex dbe pl
  • Ben Burrell (Munky)
  • Bernard Fischer-Wasels
  • Bradley Brown
  • Carl Backstrom
  • Carsten Cerny
  • Carston Czarski
  • Christian Rokitta
  • Christopher Beck
  • Dan Durbaca
  • Dan Mcghan
  • David Njoku
  • David Peake
  • Denes Kubicek
  • Dietmar Aust
  • Dimitri Gielis
  • Dirk McComsey
  • Doug Gault
  • Douwe Pieter van den Bos
  • Duncan Mein
  • E-Dba
  • Eric Boissonneault
  • Evgeny Timoshinin
  • German APEX Community
  • Håvard Kristiansen
  • IAdvise
  • Ilmar Kerm
  • Iloon Ellen
  • Insum
  • Jason Aughenbaugh
  • Jason M.
  • Jason Straub
  • Jean-Phillipe Pinte
  • Jeff Holoman
  • Jeffrey Kemp
  • Joel Kallman
  • John Scott
  • Jon Trostheim
  • Jornica
  • João Oliveira
  • Kristian Jones
  • Learco Brizzi
  • Louis-Guillaume Carrier-Bédard
  • Marc Sewtz
  • Mark Lancaster
  • Martin B. Nielsen
  • Martin Giffy D'Souza
  • Matt Ball
  • Matt Nolan
  • Niels de Bruijn
  • Niels de Bruijn
  • Noel Portugal
  • Oracle Nerd
  • Oracle Quirks
  • Oradude
  • PL/GMaps
  • Patrick Wolf
  • Paul Brookes
  • Paulo Vale
  • Pawel Barut
  • Peter De Boer
  • Peter Manchev
  • Peter Raganitsch
  • Przemek Staniszewski
  • RCI
  • Roel Hartman
  • Rutger de Ruiter
  • Sara Blair
  • Sathish Kumar
  • Scott Spendolini
  • Scott Wesley
  • Stew Stryker
  • Sujay Dutta
  • Sumnertech Blog
  • Tobias Arnhold
  • Tyler Muth
  • Unknown APEX
  • Wei Zheng

    © Created and Hosted by Apex Evangelists