<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2535177635560113926</id><updated>2024-08-28T19:55:18.773-07:00</updated><category term="JDBC - ODBC Questions"/><category term="Exception"/><category term="Struts"/><category term="Design Patterns"/><category term="Java Collection Interview Questions"/><title type='text'>Java Interview Questions</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>58</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-5356872026293872028</id><published>2013-06-25T23:11:00.000-07:00</published><updated>2013-06-25T23:11:00.639-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What is rowset and its Type?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;que&quot;&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt; 
&lt;br /&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
A RowSet is an object that 
encapsulates a set of rows from either Java Database Connectivity (JDBC)
 result sets or tabular data sources like a file or spreadsheet.
RowSets support component-based development models like JavaBeans, with a
 standard set of properties and an event notification mechanism.&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;right&quot; bgcolor=&quot;#fafafa&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tinyblack&quot; style=&quot;border: 0px dashed rgb(173, 210, 226); width: 336px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
 &lt;td&gt;
&lt;ins style=&quot;border: none; display: inline-table; height: 280px; margin: 0; padding: 0; position: relative; visibility: visible; width: 336px;&quot;&gt;&lt;ins id=&quot;aswift_2_anchor&quot; style=&quot;border: none; display: block; height: 280px; margin: 0; padding: 0; position: relative; visibility: visible; width: 336px;&quot;&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;que&quot;&gt; &lt;span class=&quot;queIndex&quot;&gt;&lt;/span&gt;&lt;strong&gt;What are the different types&amp;nbsp; of RowSet ?&lt;/strong&gt;&lt;/span&gt; 
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
There are two types of  RowSet are there. They are:
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Connected &lt;/strong&gt;- A connected RowSet object connects to the database once and  remains connected until the application terminates.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Disconnected -&lt;/strong&gt; A disconnected RowSet object 
connects to the database, executes a  query to retrieve the data from 
the database and then closes the connection. A  program may change the 
data in a disconnected RowSet  while it is disconnected. Modified data 
can be updated in the database after a  disconnected RowSet 
reestablishes the connection  with the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/5356872026293872028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-rowset-and-its-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5356872026293872028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5356872026293872028'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-rowset-and-its-type.html' title='What is rowset and its Type?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-7142117509713356013</id><published>2013-06-20T23:06:00.000-07:00</published><updated>2013-06-20T23:06:00.019-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What are the new features added to JDBC 4.0?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;que&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
The major features added in JDBC 4.0 include :&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Auto-loading of JDBC driver class&lt;/li&gt;
&lt;li&gt;Connection management enhancements&lt;/li&gt;
&lt;li&gt;Support for &lt;code&gt;RowId&lt;/code&gt; SQL type&lt;/li&gt;
&lt;li&gt;DataSet implementation of SQL using Annotations&lt;/li&gt;
&lt;li&gt;SQL exception handling enhancements&lt;/li&gt;
&lt;li&gt;SQL XML support&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/7142117509713356013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-are-new-features-added-to-jdbc-40.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7142117509713356013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7142117509713356013'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-are-new-features-added-to-jdbc-40.html' title='What are the new features added to JDBC 4.0?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-8996471104838320210</id><published>2013-06-18T23:09:00.000-07:00</published><updated>2013-06-18T23:09:00.447-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What is the difference between a Statement and a PreparedStatement? </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;5&quot; class=&quot;mytable&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;th width=&quot;50%&quot;&gt;&lt;strong&gt;Statement&lt;/strong&gt;&lt;/th&gt;
     &lt;th width=&quot;50%&quot;&gt;&lt;strong&gt;PreparedStatement&lt;/strong&gt;&lt;/th&gt;
  &lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
    &lt;td&gt;A standard Statement is used to create a Java representation of a  literal SQL statement and execute it on the database.&lt;/td&gt;
    &lt;td&gt;A PreparedStatement is a precompiled&amp;nbsp; statement. This means that
 when the PreparedStatement is  executed, the RDBMS can just run the 
PreparedStatement SQL statement without having to compile it first.&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
    &lt;td&gt;Statement has to verify its metadata against the database every time.&lt;/td&gt;
    &lt;td&gt;While a prepared statement
has to verify its metadata against the database only once. &lt;/td&gt;
  &lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
    &lt;td&gt;If  you want to execute the SQL statement once go for STATEMENT&lt;/td&gt;
    &lt;td&gt;If you want to execute a single SQL statement multiple number of times, then go for PREPAREDSTATEMENT. 
PreparedStatement objects can be reused with passing different values to the queries
&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/8996471104838320210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-difference-between-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8996471104838320210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8996471104838320210'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-difference-between-statement.html' title='What is the difference between a Statement and a PreparedStatement? '/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-1970796172338925455</id><published>2013-06-18T23:08:00.000-07:00</published><updated>2013-06-18T23:08:00.212-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What is PreparedStatement? </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
A prepared statement is an SQL 
statement that is precompiled by the database.  Through precompilation, 
prepared statements improve the performance of SQL  commands that are 
executed multiple times (given that the database supports  prepared 
statements). Once compiled, prepared statements can be customized prior 
 to each execution by altering predefined SQL parameters.
&lt;/div&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;pre class=&quot;mid&quot; style=&quot;text-align: left;&quot;&gt; PreparedStatement pstmt = conn.prepareStatement(&quot;UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?&quot;);
  pstmt.setBigDecimal(1, 153833.00);
  pstmt.setInt(2, 110592);&lt;/pre&gt;
&lt;pre class=&quot;mid&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;mid&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;em&gt;Here: &lt;strong&gt;&lt;code&gt;conn&lt;/code&gt;&lt;/strong&gt; is an instance of the Connection class and &lt;code&gt;&quot;&lt;strong&gt;?&lt;/strong&gt;&quot;&lt;/code&gt; represents parameters.These parameters must be specified before execution.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
    &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/1970796172338925455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-preparedstatement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/1970796172338925455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/1970796172338925455'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-preparedstatement.html' title='What is PreparedStatement? '/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-6076575327857611802</id><published>2013-06-18T22:50:00.000-07:00</published><updated>2013-06-18T22:50:00.653-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Exception"/><title type='text'>How to create custom exceptions? </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
A. By extending the Exception class or one of its subclasses.&lt;/div&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
&lt;u&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;pre class=&quot;mid&quot;&gt;&lt;span style=&quot;color: #800040;&quot;&gt;class &lt;/span&gt;MyException &lt;span style=&quot;color: #800040;&quot;&gt;extends Exception &lt;/span&gt;{
&amp;nbsp; &lt;span style=&quot;color: #800040;&quot;&gt;public &lt;/span&gt;MyException() { &lt;span style=&quot;color: #800040;&quot;&gt;super&lt;/span&gt;(); }
&amp;nbsp; &lt;span style=&quot;color: #800040;&quot;&gt;public &lt;/span&gt;MyException(&lt;span style=&quot;color: #800040;&quot;&gt;String &lt;/span&gt;s) { &lt;span style=&quot;color: #800040;&quot;&gt;super&lt;/span&gt;(s); }
&amp;nbsp; }&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/6076575327857611802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/how-to-create-custom-exceptions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6076575327857611802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6076575327857611802'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/how-to-create-custom-exceptions.html' title='How to create custom exceptions? '/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-5107625680116637972</id><published>2013-06-15T22:49:00.000-07:00</published><updated>2013-06-15T22:49:00.946-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Exception"/><title type='text'>What if there is a break or return statement in try block followed by finally block?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If there is a return statement in the try block, the finally block 
executes right after the return statement encountered, and before the 
return executes.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/5107625680116637972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-if-there-is-break-or-return.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5107625680116637972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5107625680116637972'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-if-there-is-break-or-return.html' title='What if there is a break or return statement in try block followed by finally block?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-4574907869136612618</id><published>2013-06-14T23:11:00.000-07:00</published><updated>2013-06-14T23:12:11.321-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What is a DataSource and its Advantages ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span class=&quot;que&quot;&gt;&lt;span class=&quot;queIndex&quot;&gt;&lt;/span&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt; 
&lt;br /&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
A DataSource object is the representation of a data source in the  Java programming language. In basic terms, 
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;A DataSource is a facility for  storing data.&lt;/li&gt;
&lt;li&gt;DataSource can be referenced by JNDI.&lt;/li&gt;
&lt;li&gt;Data Source may point to RDBMS, file System , any DBMS etc..&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;&lt;span class=&quot;que&quot;&gt;&lt;strong&gt;What are the advantages of DataSource?&lt;/strong&gt;&lt;/span&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
The few advantages of data source are : &lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;An application does not need to hardcode driver  information, as it does with the  &lt;code class=&quot;mid&quot;&gt;DriverManager.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The &lt;code class=&quot;mid&quot;&gt;DataSource&lt;/code&gt; implementations can easily change  the properties of data  sources. &lt;em&gt;For  example&lt;/em&gt;: There is no need to modify the application code when making changes to the database details.&lt;/li&gt;
&lt;li&gt;The DataSource facility allows developers to implement a &lt;code class=&quot;mid&quot;&gt;DataSource&lt;/code&gt; class to take advantage of features like connection  pooling and distributed transactions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/4574907869136612618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-datasource-and-its-advantages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/4574907869136612618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/4574907869136612618'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-is-datasource-and-its-advantages.html' title='What is a DataSource and its Advantages ?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-4942673618503967696</id><published>2013-06-14T23:10:00.002-07:00</published><updated>2013-06-14T23:10:47.895-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>Which is the right type of driver to use and when? </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Type I driver is handy for prototyping&lt;/li&gt;
&lt;li&gt;Type III driver adds security, caching, and connection control&lt;/li&gt;
&lt;li&gt;Type III and Type IV drivers need no pre-installation&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/4942673618503967696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/which-is-right-type-of-driver-to-use.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/4942673618503967696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/4942673618503967696'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/which-is-right-type-of-driver-to-use.html' title='Which is the right type of driver to use and when? '/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-3363264676991198086</id><published>2013-06-14T23:07:00.003-07:00</published><updated>2013-06-14T23:07:30.331-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What are the main components of JDBC ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
The life cycle of a servlet consists of the following phases:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DriverManager&lt;/strong&gt;: Manages  a list of database 
drivers. Matches connection requests from the java  application with the
 proper database driver using communication subprotocol.  The first 
driver that recognizes a certain subprotocol under JDBC will be used to 
establish a database Connection.&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;strong&gt;Driver&lt;/strong&gt;: The  database communications link, 
handling all communication with the database.  Normally, once the driver
 is loaded, the developer need not call it explicitly.&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;strong&gt;Connection &lt;/strong&gt;: Interface  with all methods for 
contacting a database.The connection object  represents communication 
context, i.e., all communication  with database is through connection 
object  only. &lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;strong&gt;Statement&lt;/strong&gt; : Encapsulates  an SQL statement which is passed to the database to be parsed, compiled,  planned and executed.&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;&lt;strong&gt;ResultSet&lt;/strong&gt;: 
  The ResultSet represents set of  rows retrieved due to query execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/3363264676991198086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-are-main-components-of-jdbc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3363264676991198086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3363264676991198086'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/what-are-main-components-of-jdbc.html' title='What are the main components of JDBC ?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-8875939423417475620</id><published>2013-06-14T22:48:00.001-07:00</published><updated>2013-06-14T22:48:46.786-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Exception"/><title type='text'>Explain the significance of try-catch blocks? </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;justify&quot; class=&quot;content&quot;&gt;
Whenever the exception occurs in 
Java, we need a way to tell the JVM what code to execute. To  do this, 
we use the try and catch keywords. The try is used to define a block of 
code in which  exceptions may occur. One or more catch clauses match a 
specific exception to a block of code  that handles it.&lt;/div&gt;
&lt;br /&gt;
&lt;img alt=&quot;Try-Catch-Finally&quot; src=&quot;http://developersbook.com/corejava/interview-questions/try-catch.png&quot; /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/8875939423417475620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/explain-significance-of-try-catch-blocks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8875939423417475620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8875939423417475620'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/explain-significance-of-try-catch-blocks.html' title='Explain the significance of try-catch blocks? '/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-8551377590340235152</id><published>2013-06-14T22:47:00.002-07:00</published><updated>2013-06-14T22:47:15.959-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Exception"/><title type='text'>Why Errors are Not Checked?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
A unchecked exception classes which are the &lt;i&gt;error&lt;/i&gt; classes (Error 
and its subclasses) are exempted from compile-time checking because they
 can occur at many points in the program and recovery from them is 
difficult or impossible. A program declaring such exceptions would be 
pointlessly.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/8551377590340235152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2013/06/why-errors-are-not-checked.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8551377590340235152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8551377590340235152'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2013/06/why-errors-are-not-checked.html' title='Why Errors are Not Checked?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-8612549437334307530</id><published>2011-09-23T10:59:00.000-07:00</published><updated>2011-09-23T10:59:00.098-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>What is session facade?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
A session façade is an EJB design pattern in which a session bean is works like a wrapper over entity beans. A client does not have a direct access to Entity beans but through session beans only for reducing network overhead. Usually stateless session beans are used as single access point for the clients but stateful session beans can also be used for the same purpose. A layer of session beans exposed to clients to access not only gives a clean approach towards client access to bean components but also reduce network calls so as to make the whole system of high performance.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/8612549437334307530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/what-is-session-facade.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8612549437334307530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/8612549437334307530'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/what-is-session-facade.html' title='What is session facade?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-7101867701328805213</id><published>2011-09-22T10:56:00.000-07:00</published><updated>2011-09-22T10:56:00.103-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>Difference between Abstract Factory and Factory Method design patterns?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;In order to answer this question we must first understand what are Abstract Factory and Factory Method design patterns.&lt;br /&gt;&lt;br /&gt;An Abstract Factory(AF) provides an interface for creating families of related or dependent objects without specifying their concrete classes. you usually have multiple factory implementations. Each factory implementation is responsible for creating objects that are usually in a related hierarchy.&lt;br /&gt;&lt;br /&gt;In case of Factory Method(or simply called Factory pattern), generally a key or parameter is provided and method obtains an object of that type.The classic example can be creating a Database Connection Factory which is responsible for providing a vendor specific database connection objects(like Oracle,DB2,MS SQL Server etc.) depending upon the kind of parameter is provided.&lt;br /&gt;&lt;br /&gt;AF is very similar to the Factory Method pattern.One difference between the two is that with the Abstract Factory pattern, a class delegates the responsibility of object instantiation to another object via composition whereas the Factory Method pattern uses inheritance and&lt;br /&gt;relies on a subclass to handle the desired object instantiation.&lt;br /&gt;&lt;br /&gt;The best example to quote of AF is EJBHome object.When a client composes the home interface and calls a create method to get the component interface. The component interface is the abstract product and the implementation is created by the container. The client composes the abstract factory (home interface) and calls a create method on the abstract factory to create the product.&lt;br /&gt;&lt;br /&gt;In nutshell, AF is a creational pattern for the family of objects, whereas the factory method is a way to get one individual member of a family.So in a way, AF uses Factory method.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/7101867701328805213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/difference-between-abstract-factory-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7101867701328805213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7101867701328805213'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/difference-between-abstract-factory-and.html' title='Difference between Abstract Factory and Factory Method design patterns?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-3632052055657195027</id><published>2011-09-21T10:56:00.000-07:00</published><updated>2011-09-21T10:56:00.069-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>Adapter Design Pattern in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;Adapter design pattern lets unrelated classes communicate and work with each other.It achieves this objective by creating new interfaces for creating compatibility amongst otherwise non communicable classes.&lt;br /&gt;&lt;br /&gt;The adapter classes in Java API are WindowAdapter,ComponentAdapter, ContainerAdapter, FocusAdapter, KeyAdapter, MouseAdapter and MouseMotionAdapter.&lt;br /&gt;&lt;br /&gt;In case of listener interfaces,whenever a class implements such an interface, one has to implement all of the seven methods.In case of WindowListener interface,it has seven methods.WindowAdapter class implements WindowListener interface and make seven empty implementation. When a class subclasses WindowAdapter class, one may choose the implementation of a method as per one&#39;s choice of implementation.&lt;br /&gt;&lt;br /&gt;Adapter design pattern is also referred as Wrapper pattern when it is introduced by composition of classes.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/3632052055657195027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/adapter-design-pattern-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3632052055657195027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3632052055657195027'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/adapter-design-pattern-in-java.html' title='Adapter Design Pattern in Java'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-1436798279345223784</id><published>2011-09-20T10:55:00.000-07:00</published><updated>2011-09-20T10:55:00.743-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>Decorator Design Pattern in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;Decorator design pattern attaches additional responsibilities or functions, dynamically or statically on an object.One can add new functionalities on an object without affecting other objects enhancing flexibility of an object.&lt;br /&gt;&lt;br /&gt;The best example of Decorator pattern in a visual manner can be illustrated from JScrollPane object which can be used to decorate a JTextArea object or a JEditorPane object. The different borders of a window like BevelBorder, CompoundBorder, EtchedBorder TitledBorder etc. are other examples of classes working as decorators existent in Java API.&lt;br /&gt;&lt;br /&gt;Decorator pattern can be used in a non-visual fashion. For example, BufferedInputStream, DataInputStream, and CheckedInputStream are decorating objects of FilterInputStream class. These decorators are standard Java API classes.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/1436798279345223784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/decorator-design-pattern-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/1436798279345223784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/1436798279345223784'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/decorator-design-pattern-in-java.html' title='Decorator Design Pattern in Java'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-7776887243182863474</id><published>2011-09-19T10:58:00.000-07:00</published><updated>2011-09-19T10:58:00.076-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>Different types of design patterns?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;There are three kinds of design patterns:&lt;br /&gt;&lt;br /&gt;Creational patterns:&lt;br /&gt;&lt;br /&gt;They are related with how objects and classes are created. While class-creation patterns use inheritance effectively in the instantiation process,while object-creation patterns use delegation to get the job done.&lt;br /&gt;&lt;br /&gt;* Abstract Factory groups object factories that have a common theme.&lt;br /&gt;* Builder constructs complex objects by separating construction and representation.&lt;br /&gt;* Factory Method creates objects without specifying the exact object to create.&lt;br /&gt;* Prototype creates objects by cloning an existing object.&lt;br /&gt;* Singleton restricts object creation for a class to only one instance.&lt;br /&gt;&lt;br /&gt;Structural patterns:&lt;br /&gt;&lt;br /&gt;They are related to class and object composition.This pattern uses inheritance to define new interfaces in order to compose new objects and hence new functionalities.&lt;br /&gt;&lt;br /&gt;* Adapter allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class.&lt;br /&gt;* Bridge decouples an abstraction from its implementation so that the two can vary independently.&lt;br /&gt;* Composite composes one-or-more similar objects so that they can be manipulated as one object.&lt;br /&gt;* Decorator dynamically adds/overrides behavior in an existing method of an object.&lt;br /&gt;* Facade provides a simplified interface to a large body of code.&lt;br /&gt;* Flyweight reduces the cost of creating and manipulating a large number of similar objects.&lt;br /&gt;* Proxy provides a placeholder for another object to control access, reduce cost, and reduce complexity.&lt;br /&gt;&lt;br /&gt;Behavioral patterns:&lt;br /&gt;&lt;br /&gt;These design patterns deal with objects communication. They are specifically concerned with communication between objects.&lt;br /&gt;&lt;br /&gt;* Chain of responsibility delegates commands to a chain of processing objects.&lt;br /&gt;* Command creates objects which encapsulate actions and parameters.&lt;br /&gt;* Interpreter implements a specialized language.&lt;br /&gt;* Iterator accesses the elements of an object sequentially without exposing its underlying representation.&lt;br /&gt;* Mediator allows loose coupling between classes by being the only class that has detailed knowledge of their methods.&lt;br /&gt;* Memento provides the ability to restore an object to its previous state (undo).&lt;br /&gt;* Observer is a publish/subscribe pattern which allows a number of observer objects to see an event.&lt;br /&gt;* State allows an object to alter its behavior when its internal state changes.&lt;br /&gt;* Strategy allows one of a family of algorithms to be selected on-the-fly at runtime.&lt;br /&gt;* Template method defines the skeleton of an algorithm as an abstract class, allowing its subclasses to provide concrete behavior.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/7776887243182863474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/different-types-of-design-patterns.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7776887243182863474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7776887243182863474'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/different-types-of-design-patterns.html' title='Different types of design patterns?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-7550695285728302399</id><published>2011-09-19T10:54:00.000-07:00</published><updated>2011-09-19T10:54:00.301-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>Explain Facade Design Pattern in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;The objective of Facade pattern is to make a complex system simple. It is achieved by providing a unified or general interface, which is a higher layer to these subsystems.Facade pattern decouples subsystems, reduce its dependency, and improve portability,makes an entry point to your subsystems and hides clients from subsystem components and their implementation.&lt;br /&gt;&lt;br /&gt;JDBC design is a good example of Façade pattern. A database design is complicated. JDBC is used to connect the database and manipulate data without exposing details to the clients.&lt;br /&gt;&lt;br /&gt;A client is exposed to certain set of methods like just getting a single instance of database connection or closing it when not required.&lt;br /&gt;&lt;br /&gt;Another possibility is designing security of a system with Façade pattern. Clients&#39; authorization to access information may be classified. General users may be allowed to access general information, special guests may be allowed to access more information,administrators and executives may be allowed to access the most important information. These subsystems may be generalized by oneinterface. The identified users may be directed to the related&lt;br /&gt;subsystems.&lt;br /&gt;&lt;br /&gt;interface PublicMethod{&lt;br /&gt;   public void accessPublicMethod();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;interface SpecialMethod extends PublicMethod{&lt;br /&gt;&lt;br /&gt;   public void accessSpecialMethod();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;interface PrivateMethod extends PublicMethod {&lt;br /&gt;&lt;br /&gt;   public void accessPrivateInfo();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class PublicInfo implements PublicMethod{&lt;br /&gt;&lt;br /&gt;   public void accessPublicMethod() {&lt;br /&gt;&lt;br /&gt; //...&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   //...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class SpecialInfo extends PublicInfo implements SpecialMethod {&lt;br /&gt;&lt;br /&gt;   public void accessSpecialMethod() {&lt;br /&gt;&lt;br /&gt;       //...&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class PrivateInfo extends SpecialInfo implements PrivateMethod {&lt;br /&gt;&lt;br /&gt;   public void accessPrivateMethod () {&lt;br /&gt;&lt;br /&gt; // ...&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt; &lt;br /&gt;   //...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The above code example illustrates that the whole system is not exposed to the clients. It depends on the user classification.&lt;br /&gt;&lt;br /&gt;When a person is exposed to special information, that person is allowed to access public information also. When a person is exposed to private information, that person is allowed to access public and special information as well.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/7550695285728302399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/explain-facade-design-pattern-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7550695285728302399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/7550695285728302399'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/explain-facade-design-pattern-in-java.html' title='Explain Facade Design Pattern in Java'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-6376130756016299466</id><published>2011-09-18T10:59:00.001-07:00</published><updated>2011-09-18T10:59:41.393-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>What are Design Patterns and why one needs them?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;A pattern based designing approach is best suited in devising solutions for problems occurring over and over again.The design patterns are language-independent strategies for solving common object-oriented design problems.&lt;br /&gt;&lt;br /&gt;When you design, you should have advanced knowledge of such solutions in order to overcome problems that may occur in your system. GoF, Gang-Of-Four,because of the four authors who wrote, Design Patterns: Elements of Reusable Object-Oriented Software(ISBN 0-201-63361-2) is a software engineering book describing recurring solutions to common problems in software design. The book&#39;s authors are Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. It is language independent approach of designing systems on the based of patterns.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/6376130756016299466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/what-are-design-patterns-and-why-one.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6376130756016299466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6376130756016299466'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/what-are-design-patterns-and-why-one.html' title='What are Design Patterns and why one needs them?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-6297751793659483605</id><published>2011-09-18T10:58:00.000-07:00</published><updated>2011-09-18T10:58:18.021-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><title type='text'>Singleton Design Pattern?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;The Singleton Design Pattern is a Creational type of design pattern which assures to have only a single instance of a class, as it is necessary sometimes to have just a single instance.The examples can be print spooler,database connection or window manager where you may require only a single object.&lt;br /&gt;&lt;br /&gt;In a Singleton design pattern,there is a public, static method which provides an access to single possible instance of the class.The constructor can either be private or protected.&lt;br /&gt;public class SingletonClass {&lt;br /&gt;private static SingletonClass instance = null;&lt;br /&gt;protected SingletonClass() {&lt;br /&gt;// can not be instantiated.&lt;br /&gt;}&lt;br /&gt;public static SingletonClass getInstance() {&lt;br /&gt;if(instance == null) {&lt;br /&gt;instance = new SingletonClass();&lt;br /&gt;}&lt;br /&gt;return instance;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In the code above the class instance is created through lazy initialization,unless getInstance() method is called,there is no instance created.This is to ensure that instance is created when needed.&lt;br /&gt;&lt;br /&gt;public class SingletonInstantiator {&lt;br /&gt;public SingletonInstantiator() {&lt;br /&gt;SingletonClass instance = SingletonClass.getInstance();&lt;br /&gt;SingletonClass anotherInstance =&lt;br /&gt;new SingletonClass();&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In snippet above anotherInstance is created which is a perfectly legal statement as both the classes exist in the same package in this case &#39;default&#39;, as it is not required by an instantiator class to extend SingletonClass to access the protected constructor within the same package.So to avoid even such scenario, the constructor could be made private.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/6297751793659483605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/singleton-design-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6297751793659483605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6297751793659483605'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/singleton-design-pattern.html' title='Singleton Design Pattern?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-5820577366241448821</id><published>2011-09-18T10:53:00.000-07:00</published><updated>2011-09-18T10:53:49.490-07:00</updated><title type='text'>Singleton Pattern</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Singleton design pattern is the first design pattern I learned (many years back). In early days when someone asks me, “do you know any design pattern?” I quickly and promptly answer “I know singleton design pattern” and the question follows, “do you know anything other than singleton” and I stand stumped!&lt;br /&gt;
&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;there should be only one instance allowed for a class and&lt;/li&gt;
&lt;li&gt;we should allow global point of access to that single instance&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/5820577366241448821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/singleton-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5820577366241448821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5820577366241448821'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/singleton-pattern.html' title='Singleton Pattern'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-6464088798985305025</id><published>2011-09-15T14:23:00.000-07:00</published><updated>2011-09-15T14:23:00.599-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;10. What is the fastest type of JDBC driver?&lt;/strong&gt;&lt;br /&gt;
Type 4 (JDBC Net pure Java Driver) is the fastest JDBC driver. Type 1
and Type 3 drivers will be slower than Type 2 drivers (the database
calls are make at least three translations versus two), and Type 4
drivers are the fastest (only one translation).&lt;br /&gt;

&lt;strong&gt;11. Is the JDBC-ODBC Bridge multi-threaded?&lt;/strong&gt;&lt;br /&gt;
No. The JDBC-ODBC Bridge does not support multi threading. The
JDBC-ODBC Bridge uses synchronized methods to serialize all of the
calls that it makes to ODBC. Multi-threaded Java programs may use the
Bridge, but they won’t get the advantages of multi-threading.&lt;br /&gt;

&lt;strong&gt;12. What is cold backup, hot backup, warm backup recovery?&lt;/strong&gt;&lt;br /&gt;
Cold backup means all these files must be backed up at the same time,
before the database is restarted. Hot backup (official name is ‘online
backup’ ) is a backup taken of each tablespace while the database is
running and is being accessed by the users&lt;br /&gt;

&lt;strong&gt;13. What is the advantage of denormalization?&lt;/strong&gt;&lt;br /&gt;
Data denormalization is reverse procedure, carried out purely for
reasons of improving performance. It maybe efficient for a
high-throughput system to replicate data for certain data.&lt;br /&gt;

&lt;strong&gt;14. How do you handle your own transaction ?&lt;/strong&gt;&lt;br /&gt;
Connection Object has a method called setAutocommit ( boolean flag) .
For handling our own transaction we can set the parameter to false and
begin your transaction . Finally commit the transaction by calling the
commit method.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/6464088798985305025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6464088798985305025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/6464088798985305025'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/10.html' title=''/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-3029109048571428801</id><published>2011-09-13T14:21:00.000-07:00</published><updated>2011-09-13T14:21:00.258-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>JDBC Interview Question - Part 3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;7. What is Connection?&lt;/strong&gt;&lt;br /&gt;
Connection class represents a connection (session) with a specific
database. SQL statements are executed and results are returned within
the context of a connection.&lt;br /&gt;

A Connection object’s database is able to provide information
describing its tables, its supported SQL grammar, its stored
procedures, the capabilities of this connection, and so on. This
information is obtained with the getMetaData method.&lt;br /&gt;

&lt;strong&gt;8. What does Class.forName return?&lt;/strong&gt;&lt;br /&gt;
A class as loaded by the classloader.&lt;br /&gt;

&lt;strong&gt;9. What is Connection pooling?&lt;/strong&gt;&lt;br /&gt;
Connection pooling is a technique used for sharing server resources
among requesting clients. Connection pooling increases the performance
of Web applications by reusing active database connections instead of
creating a new connection with every request. Connection pool manager
maintains a pool of open database connections.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/3029109048571428801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/jdbc-interview-question-part-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3029109048571428801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3029109048571428801'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/jdbc-interview-question-part-3.html' title='JDBC Interview Question - Part 3'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-5553146631296003847</id><published>2011-09-12T14:20:00.000-07:00</published><updated>2011-09-12T14:20:00.055-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>JDBC Interview Question - Part 2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;. What are the steps required to execute a query in JDBC?&lt;/b&gt;&lt;br /&gt;
First we need to create an instance of a JDBC driver or load JDBC
drivers, then we need to register this driver with DriverManager class.
Then we can open a connection. By using this connection , we can create
a statement object and this object will help us to execute the query.
&lt;br /&gt;
&lt;b&gt;5. What is DriverManager ?&lt;/b&gt;&lt;br /&gt;
DriverManager is a class in java.sql package. It is the basic service for managing a set of JDBC drivers.&lt;br /&gt;
&lt;b&gt;6. What is a ResultSet ?&lt;/b&gt;&lt;br /&gt;
A table of data representing a database result set, which is usually
generated by executing a statement that queries the database.&lt;br /&gt;
A ResultSet object maintains a cursor pointing to its current row of
data. Initially the cursor is positioned before the first row. The next
method moves the cursor to the next row, and because it returns false
when there are no more rows in the ResultSet object, it can be used in
a while loop to iterate through the result set.&lt;br /&gt;
&lt;br /&gt;
Also,&lt;br /&gt;
 &lt;br /&gt;
Resulset could be defined in three ways.&lt;br /&gt;
TYPE_SCROLL_SENSITIVE (can scroll forward or backward and sensitive to the changes made in the database)&lt;br /&gt;
TYPE_SCROLL_INSENSITIVE ( can scroll forward and backward but
insensitive to database changes; It is actually snapshot of database so
once data fetched not changed)&lt;br /&gt;
TYPE_FORWARD_ONLY (can move only in forward direction) &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/5553146631296003847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/jdbc-interview-question-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5553146631296003847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5553146631296003847'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/jdbc-interview-question-part-2.html' title='JDBC Interview Question - Part 2'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-5743832897836436663</id><published>2011-09-10T14:23:00.001-07:00</published><updated>2011-09-10T14:23:39.046-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>What are the different JDBC drivers available?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
here are mainly four type of JDBC drivers available. They are:
Type 1 : JDBC-ODBC Bridge Driver – A JDBC-ODBC bridge provides JDBC
API access via one or more ODBC drivers. Note that some ODBC native
code and in many cases native database client code must be loaded on
each client machine that uses this type of driver. Hence, this kind of
driver is generally most appropriate when automatic installation and
downloading of a Java technology application is not important. For
information on the JDBC-ODBC bridge driver provided by Sun.&lt;br /&gt;

Type 2: Native API Partly Java Driver- A native-API partly Java
technology-enabled driver converts JDBC calls into calls on the client
API for Oracle, Sybase, Informix, DB2, or other DBMS. Note that, like
the bridge driver, this style of driver requires that some binary code
be loaded on each client machine.&lt;br /&gt;

Type 3: Network protocol Driver- A net-protocol fully Java
technology-enabled driver translates JDBC API calls into a
DBMS-independent net protocol which is then translated to a DBMS
protocol by a server. This net server middleware is able to connect all
of its Java technology-based clients to many different databases. The
specific protocol used depends on the vendor. In general, this is the
most flexible JDBC API alternative. It is likely that all vendors of
this solution will provide products suitable for Intranet use. In order
for these products to also support Internet access they must handle the
additional requirements for security, access through firewalls, etc.,
that the Web imposes. Several vendors are adding JDBC technology-based
drivers to their existing database middleware products.&lt;br /&gt;

Type 4: JDBC Net pure Java Driver – A native-protocol fully Java
technology-enabled driver converts JDBC technology calls into the
network protocol used by DBMSs directly. This allows a direct call from
the client machine to the DBMS server and is a practical solution for
Intranet access. Since many of these protocols are proprietary the
database vendors themselves will be the primary source for this style
of driver. Several database vendors have these in progress.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/5743832897836436663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/what-are-different-jdbc-drivers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5743832897836436663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/5743832897836436663'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/what-are-different-jdbc-drivers.html' title='What are the different JDBC drivers available?'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2535177635560113926.post-3200734626602789709</id><published>2011-09-10T14:19:00.001-07:00</published><updated>2011-09-10T14:22:45.375-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC - ODBC Questions"/><title type='text'>JDBC Interview questions - Part 1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;1. What is JDBC?&lt;/b&gt;&lt;br /&gt;JDBC technology is an API (included in both J2SE and J2EE releases) that provides cross-DBMS connectivity to a wide range of SQL databases and access to other tabular data sources, such as spreadsheets or flat files. With a JDBC technology-enabled driver, you can connect all corporate data even in a heterogeneous environment&lt;br /&gt;
&lt;b&gt;2. What are stored procedures?&lt;/b&gt;&lt;br /&gt;A stored procedure is a set of statements/commands which reside in the database. The stored procedure is precompiled. Each Database has it’s own stored procedure language,&lt;br /&gt;
&lt;b&gt;3. What is JDBC Driver ?&lt;/b&gt;&lt;br /&gt;The JDBC Driver provides vendor-specific implementations of the abstract classes provided by the JDBC API. This driver is used to connect to the database.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaintques.blogspot.com/feeds/3200734626602789709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaintques.blogspot.com/2011/09/jdbc-interview-questions-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3200734626602789709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2535177635560113926/posts/default/3200734626602789709'/><link rel='alternate' type='text/html' href='http://javaintques.blogspot.com/2011/09/jdbc-interview-questions-part-1.html' title='JDBC Interview questions - Part 1'/><author><name>Admin</name><uri>http://www.blogger.com/profile/15288240428690089530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>