This is a very small DB Connector code in Java as a wrapper class to Apache DBUtils.
The Commons DbUtils library is a small set of classes designed to make working with JDBC easier. JDBC resource cleanup code is mundane, error prone work so these classes abstract out all of the cleanup tasks from your code leaving you with what you really wanted to do with JDBC in the first place: query and update data.
Some of the advantages of using DbUtils are:
No possibility for resource leaks. Correct JDBC coding isn’t difficult but it is time-consuming and tedious. This often leads to connection leaks that may be difficult to track down.
Cleaner, clearer persistence code. The amount of code needed to persist data in a database is drastically reduced. The remaining code clearly expresses your intention without being cluttered with resource cleanup.
Automatically populate Java Bean properties from Result Sets. You don’t need to manually copy column values into bean instances by calling setter methods. Each row of the Result Set can be represented by one fully populated bean instance.
DbUtils is designed to be:
Small – you should be able to understand the whole package in a short amount of time.
Transparent – DbUtils doesn’t do any magic behind the scenes. You give it a query, it executes it and cleans up for you.
Fast – You don’t need to create a million temporary objects to work with DbUtils.
DbUtils is not:
An Object/Relational bridge – there are plenty of good O/R tools already. DbUtils is for developers looking to use JDBC without all the mundane pieces.
A Data Access Object (DAO) framework – DbUtils can be used to build a DAO framework though.
An object oriented abstraction of general database objects like a Table, Column, or Primary Key.
A heavyweight framework of any kind – the goal here is to be a straightforward and easy to use JDBC helper library.
System design is a very broad topic. Even a software engineer with many years of working experience at top IT company may not be an expert on system design. If you want to become an expert, you need to read many books, articles, and solve real large scale system design problems. This repository only teaches you to handle the system design interview with a systematic approach in a short time. You can dive into each topic if you have time. Of course, welcome to add your thoughts!
Clarify the constraints and identify the user cases Spend a few minutes questioning the interviewer and agreeing on the scope of the system. Remember to make sure you know all the requirements the interviewer didn’t tell your about in the beginning. User cases indicate the main functions of the system, and constraints list the scale of the system such as requests per second, requests types, data written per second, data read per second.
High-level architecture design Sketch the important components and the connections between them, but don’t go into some details. Usually, a scalable system includes web server (load balancer), service (service partition), database (master/slave database cluster plug cache).
Component design For each component, you need to write the specific APIs for each component. You may need to finish the detailed OOD design for a particular function. You may also need to design the database schema for the database.
Basic Knowledge about System Design:
Here are some articles about system design related topics.
Clarify the scenario, write out user cases Use case is a description of sequences of events that, taken together, lead to a system doing something useful. Who is going to use it and how they are going to use it. The system may be very simple or very complicated. Special system requirements such as multi-threading, read or write oriented. Define objects Map identity to class: one scenario for one class, each core object in this scenario for one class. Consider the relationships among classes: certain class must have unique instance, one object has many other objects (composition), one object is another object (inheritance). Identify attributes for each class: change noun to variable and action to methods. Use design patterns such that it can be reused in multiple applications.
The locked code in your editor passes array A (of size N) and index i to the print method, whose try block attempts to print element A[i]; if i is Out-of-Range, an Array Index Out Of Bounds Exception is thrown.
Complete the code in your editor so that it prints the maximum and minimum elements in array A—regardless of whether or not an exception is thrown.
The first line contains an integer, N, the number of elements in A.
The second line contains N space-separated integers describing A.
The third line contains an index, i, to be accessed.
Note: Input from stdin handled by the locked code in the editor.
−1000≤Aj≤1000 where 1≤j≤N
The try block will print the value accessed at A[i]; if an Exception is thrown, it will be printed by the locked code in your editor.
You must print the respective maximum and minimum values in array A as a single pair of space-separated integers on a new line—regardless of whether an exception is thrown.
Note: Observe that your max/min values may print on either the first or second line, depending on whether or not an Exception was thrown!
Sample Input 0
-12 0 1 -899 23 45 96 10 75 23 0 33
Sample Output 0
Sample Input 1
4 908 -05 445 -208 325 -2 -718 863 400
Sample Output 1
Sample 0: N=12, i=100, maximum(A)=96, and minimum(A)=−899 A‘s indices range from 0 to 11, so attempting to access index 100 throws an Exception. The maximum and minimum values in the array are printed on a new line as a pair of space-separated integers. The program’s control flow then returns to main where the the Exception is caught and printed on a new line.
Sample 1: N=10, i=9, maximum(A)=908, and minimum(A)=−718 A‘s indices range from 0 to 9, so an attempt to access index 9 will be successful and the value at A (i.e.: 400) is printed on a new line. The program’s control flow then proceeds to print the maximum and minimum values in A as a pair of space-separated integers on a new line.
What is MDS?
Metadata Services (MDS) is a feature provided by oracle to store customization and personalization information in a repository. The repository can either be stored in a database or in a file system as we will see.
To apply MDS to your application follow this:
Pages should be (.jspx) not (.jsp).
In your project properties –> ADF View check on “Enable User Customization” then select “Across Sessions Using MDS”.
Create a new class like this
This class has two main functions:
– getName() which return the folder name that hold all users changes.
– getValue() which return the folder name for the login user. This folder should be unique for every login user and will saved inside the getName() folder.
In Application Resources –> Descriptors –> ADF META-INF open adf-config.xml.
In adf-config file go to MDS Configurations and add your class
In adf-config file go to View tab and add all Tags.
Now you apply MDS to your application.
If you run your application in Integrated Weblogic there will be no problem, you should only specify the path to store the users changes (changes will stored in file system). You will find this path in your Application properties –> Run –> MDS.
If you deploy your application in standalone weblogic server you should setup Repository Creation Utility (RCU). You can download it from here
RCU will create a new schema in your database which hold all the changes.
Unzip RCU downloaded file and go to rcuHome –> BIN and run rcu.bat.
Select Create then Press Next
Enter Database connection with sysdba username and password then press next
If any error message appear press ignore
Select Metadata Services Then Press Next
Enter the password for the newly created User in database then press Next. Then follow all other steps until Finish
After finishing installation of RCU you should configure you weblogic domain to the MDS Repository.
Open your weblogic Enterprise manager using URl like
Enter weblogic username and password
Right click in you Weblogic domain the choose “Metadata Repositories”
Press Register Button and Enter Database Connection then Press Query
You will find your repository information press on your repository and enter Repository Name and Schema Password Then Press OK.
Now you register your MDS to Your Weblogic Domain.
You can select it and choose the target.
Weblogic automatic create a data source for connecting to your MDS Repository. If you go to Weblogic Console (http://localhost:7001/console) and go to Services –> Data Sources you will find a newly Data Source
Deploy your application directly from JDeveloper to your weblogic server the MDS Deployment Configuration will automatically opened with the configurations of your MDS Repository you should only enter the Position Name. Souce
RAD Framework with most commonly used components of any Front End Application available as inbuilt feature
Model-View-Controller (MVC) design pattern and offers an integrated solution that covers all the layers of this architecture with solution to such areas as:
ORM and Data Persistence
Reusable Task-flow approach,
Rich Web user interface elements,
Data binding to UI,
Customization via sandboxes etc
Separation of Business Logic implementation details, via metadata and use of this metadata-driven architecture enables developers to focus on the business logic and user experience.
Drag-n-Drop features, via JDeveloper IDE, provides the ease to use and customize.
ADF Skin Editor: New ADF Skin editor for visually creating and modifying the appearance of ADF Faces applications.(JDeveloper 11G and above)
JSF 2.0: JSF 2.0 support in the IDE and for ADF applications. (JDev 11g R2 release)
ADF Faces and Data Visualization Tools (DVT) support touch gestures for interactivity on the touch-enabled devices, such as touch support for drag and drop, tooltips, data tips, and context menus.
ADF Faces and DVT components are certified on iPad. Additionally, ADF DVT Graph and Gauge components support rendering in HTML5.
MDS is metadata service that is used to store metadata information. When you use ADF, it generates lot of internal files about its own components and DB binding details. All these are stored internally by ADF into MDS.
ADS (Active Data service)- This is used in ADF to push any data changes automatically from the back end into the portal layer. This is different from Ajax which is used to send request from UI to data service layer.
Some times we need to reset the sequence values in the database back to 0.
Here is a small procedure to reset any sequence.
create or replace
procedure reset_sequence(p_seq in varchar2)
-- Select the next value of the sequence
'select ' || p_seq ||
'.nextval from dual' INTO l_value;
-- Set a negative increment for the sequence,-- with value = the current value of the sequence
'alter sequence ' || p_seq ||
' increment by -' || l_value || ' minvalue 0';
-- Select once from the sequence, to-- take its current value back to 0
'select ' || p_seq ||
'.nextval from dual' INTO l_value;
-- Set the increment back to 1
'alter sequence ' || p_seq ||
' increment by 1 minvalue 0';
Whatever sequence you wish to reset, call the procedure as: