|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Cover Story PBDJ Cover Story — A DataWindow Based on Oracle Stored Procedures with a Result Set
In DataWindow.NET 2.0, Sybase added support for access to Oracle
By: Mikhail Klygin
May. 18, 2006 12:15 PM
In DataWindow.NET 2.0, Sybase added support for access to Oracle through the Oracle managed data provider (ODP.NET). A managed data provider provides better performance and more support than a non-managed driver for database-specific functions, though not as much as the Oracle native driver.
Unfortunately, the ADO.NET driver provided with DataWindow.NET currently doesn't support that functionality. Therefore, our demonstration to implement such functionality will still use the native drivers. At some point, when the ADO.NET driver supports this functionality, the techniques shown in this article should still be applicable. Bruce Armstrong provided an excellent description of using the DataWindow with Oracle stored procedures in his article "Using Oracle Stored Procedures in Your DataWindows" (PBDJ, Vol. 10, issue 2). It has a detailed explanation of the REF CURSOR concept, which is the key to the solution. The main ideas of that article are still the same for both DataWindows in PowerBuilder and DataWindow.NET. Therefore, we won't discuss the theory, but instead focus on a practical example.
Oracle Stored Procedure Example
REF CURSOR ORACLE TYPE We need only one ref cursor because we can use the same ref cursor for all procedures; that's why we use an unconstrained ref cursor. At the end of Listing 1, we granted access to our package (and our ref cursor) to every database user.
STORED PROCEDURE We can populate the cursor many different ways, but the simplest one is OPEN cursor FOR SELECT.
Sybase DataWindow.NET 2.0 Example Sybase DataWindow.NET has two classes for a database connection: AdoTransaction and Transaction. The AdoTransaction class is used for managed and unmanaged ADO.NET providers. However, since it currently doesn't handle REF CURSOR from the stored procedure, we will be using the Transaction class only.
DataWindow
REFERENCES
INSTANCE VARIABLES
public partial class Form1 : Form
CONNECTION SETTINGS
private void Form1_Load(object sender, EventArgs e)
LIST OF DEPARTMENTS The second solution is better, because it's simpler and allows you to avoid the hard coding of Oracle classes, which in turn provides an opportunity to create a program that supports different database vendors. However, this is not as obvious to .NET developers as it is to PowerBuilder ones, so we will populate Combo-box with the example in Listing 3.
SHOW LIST OF EMPLOYEES FOR THE CHOSEN DEPARTMENT
RESULT
Conclusion References
Reader Feedback: Page 1 of 1
Your Feedback
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
||||||||||||||||||||||||||||||||||||||||||||||||||||