<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Free practice test , mock test, driving test, interview questions &#187; sadhna</title>
	<atom:link href="http://www.skill-guru.com/blog/author/sadhna/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skill-guru.com/blog</link>
	<description>Find free mock and practice test, create and sell tests</description>
	<lastBuildDate>Mon, 16 Jan 2012 16:53:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Character data type conversion when using SQL Server JDBC drivers</title>
		<link>http://www.skill-guru.com/blog/2011/05/03/character-data-type-conversion-when-using-sql-server-jdbc-drivers/</link>
		<comments>http://www.skill-guru.com/blog/2011/05/03/character-data-type-conversion-when-using-sql-server-jdbc-drivers/#comments</comments>
		<pubDate>Tue, 03 May 2011 17:53:35 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=4018</guid>
		<description><![CDATA[We have a existing old portal in asp with Sql server and now trying to get new features in new site developing in grails,java &#38; same sql server.
Sometime ago, I was working on a login page so that the same old portal credentials could be used.   One issue I had to address was that the [...]]]></description>
			<content:encoded><![CDATA[<p>We have a existing old portal in asp with Sql server and now trying to get new features in new site developing in grails,java &amp; same sql server.</p>
<p>Sometime ago, I was working on a login page so that the same old portal credentials could be used.   One issue I had to address was that the web app captures the password in clear text but sends an encoded password to the database (where the password is also stored in our encoded format).</p>
<p>Now I was trying to implement a simple logic for encryption; add 20 to each character’s int value and convert it to char and store the encrypted password.</p>
<p>For example the java code-</p>
<blockquote><p>StringBuffer t = new StringBuffer(&#8220;&#8221;);</p>
<p>String test = &#8220;sviadha&#8221;;for ( int i = 0; i &lt; test.length(); ++i ) {</p>
<p>char c = test.charAt( i );</p>
<p>int k = (int) c ;</p>
<p>int kk = k +20;</p>
<p>char ss = (char)kk;</p>
<p>t = t.append(ss);</p>
<p>}</p>
<p>System.out.println(&#8220;original password =&#8221;+ test);</p>
<p>System.out.println(&#8220;encrypted password ==&#8221;+ t);</p></blockquote>
<p>Now when I tried to match the stored password using new UI it was failed all the time.</p>
<p>No matter what I tried, in the Java-tier I could not get past the fact that by the time the password was received in the SQL-tier, there was an encoded password mismatch.   So I worked around the problem, but passing the clear text password to the database and the stored procedure did the encoding and finally the validation.</p>
<p>After digging it found the  real problem; it turns out that this is a MS SQL Server JDBC driver configuration.  By default MS JDBC driver is sent to pass all strings as NVARCHAR, not VARCHAR.  This forced a Unicode conversion on the way to the database.</p>
<p>That’s why the same encoding logic was working fine for asp-sql server based old site but not on java based new site.</p>
<p>Here’s the magic to change this behavior so VARCHAR are sent and received…</p>
<p>MyDataSource</p>
<blockquote><p>jdbc:jtds:sqlserver://mac1.temp.test:1434;DatabaseName=MyDatabase;tds=8.0;lastupdatecount=false; sendStringParametersAsUnicode=false</p>
<p>net.sourceforge.jtds.jdbc.Driver</p></blockquote>
<p>. . .<br />
<span id="more-4018"></span><br />
But this will again fail if we send some Unicode data to store as it is in the database.like-</p>
<p>String text = &#8220;\u0143\u0144&#8243;;<br />
sendStringParametersAsUnicode=false<br />
insert into unitable (_ntext) values (?)</p>
<p>Inserting into DB:<br />
143 144 (printed hex values)<br />
Read from database:<br />
3f 3f (printed hex values)</p>
<p>On the DB side it can be interpreted and another way to handle in sql query as below &#8212;</p>
<p>In SQL Server, nvarchar() has higher precedence than varchar(). SQL can’t convert nvarchar() to varchar() and then conduct seek since conversion could potentially lose information when nvarchar character doesn’t have matching one in varchar code page. But something is wrong here. ID is defined as varchar() in the table. And I know the application is passing the parameter @P0 as varchar() as well (see below the code snippet). How come it’s become nvarchar at SQL Server?</p>
<p>pStmt.setObject(1,passwd,Types.VARCHAR);//Java app code</p>
<p>It turns out that the JDBC driver sends character data including varchar() as nvarchar() by default. The reason is to minimize client side conversion from Java’s native string type, which is Unicode.</p>
<p>So how do you force the JDBC driver not to behave this way? There is a connection string property, named sendStringParametersAsUnicode. By default it’s true. When it’s set false, problem resolved: @P0 is sent as is (varchar()), no more loop join in query plan.</p>
<p>One would ask what if I want to pass both varchar and nvarchar parameters at the same time? Well, even with the connection property set false, you can explicitly specify nvarchar type like this:</p>
<p>pStmt.setObject(1,passwd,Types.NVARCHAR); //Java app code</p>
<p>After the connection string property change, Overall workload throughput improved more than 20%!!!</p>
<p>but it all depends on the code and data type you are sending from java ui to sql server  for using this conversion.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2011/05/03/character-data-type-conversion-when-using-sql-server-jdbc-drivers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginning-Compare Java Vs Microsoft( ASP.NET)</title>
		<link>http://www.skill-guru.com/blog/2010/11/01/beginning-compare-java-vs-microsoft-asp-net/</link>
		<comments>http://www.skill-guru.com/blog/2010/11/01/beginning-compare-java-vs-microsoft-asp-net/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 21:10:44 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2869</guid>
		<description><![CDATA[When I first started working in project of ASP.NET , I compared everything with my existing java world and summarized the following-
Solution and project files
Solutions and project files are VS.Net-specific thing with is similar to eclipse web/java project.
DLL
Nearest equivalent to java’s jar files are DLL(assemblies) Assemblies provide versioning, security, resource packaging etc. (but no compression [...]]]></description>
			<content:encoded><![CDATA[<p>When I first started working in project of ASP.NET , I compared everything with my existing java world and summarized the following-</p>
<p><strong>Solution and project files</strong></p>
<p>Solutions and project files are VS.Net-specific thing with is similar to eclipse web/java project.</p>
<p><strong>DLL</strong></p>
<p>Nearest equivalent to java’s jar files are DLL(assemblies) Assemblies provide versioning, security, resource packaging etc. (but no compression like jar files).<br />
you do not need to create them explicitly ;A build creates the compiler output which is either an exe or a dll file&amp;  They are stored in a subdicrtory.</p>
<p><strong>.VB</strong></p>
<p>.vb is in place of .class files and After i do a build i see a solution file, how to generate a dll?</p>
<p><strong>ASP/ASPX</strong></p>
<p>If I compare the above thing as  java/groovy developer then aspx/asp is in place of jsp/jsf/gsp  pages</p>
<p>I would write details about each with similarity and differences as I go deeper into it while working</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/11/01/beginning-compare-java-vs-microsoft-asp-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Check code error on Visual Studio without explicitly compiling..NO</title>
		<link>http://www.skill-guru.com/blog/2010/10/25/check-code-error-on-visual-studio-without-explicitly-compiling-no/</link>
		<comments>http://www.skill-guru.com/blog/2010/10/25/check-code-error-on-visual-studio-without-explicitly-compiling-no/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 15:24:37 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[Visual studio]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2865</guid>
		<description><![CDATA[I am using Visual Studio 2003. my experience with Eclipse is more .I have gotten accustomed to the way Eclipse handles underlining errors (in java source). whenever a syntactical error in my code in eclipse, it will usually be underlined &#38; i fix it, the underline will disappear almost immediately. very friendly Coding!
In Visual Studio2003 [...]]]></description>
			<content:encoded><![CDATA[<p>I am using Visual Studio 2003. my experience with Eclipse is more .I have gotten accustomed to the way Eclipse handles underlining errors (in java source). whenever a syntactical error in my code in eclipse, it will usually be underlined &amp; i fix it, the underline will disappear almost immediately. very friendly Coding!</p>
<p>In Visual Studio2003 however, you will not know anything until build and run the project on browser. really annoying!</p>
<p>Visual Studio 2008 with service pack 1 has something for this. But not in 2003 <img src='http://www.skill-guru.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>If you are using 2005 or above then can use error list window. it will give you at least some relief(the below part taken from msdn help)-</p>
<p>The Error List helps you speed application development. In the <strong>Error List</strong> window, you can: <span id="more-2865"></span></p>
<ul>
<li>Display the Errors, Warnings, and Messages produced as you edit and compile code.</li>
<li>Find syntax errors noted by IntelliSense.</li>
<li>Find deployment errors, certain Static Analysis errors, and errors detected while applying Enterprise Template policies.</li>
<li>Double-click any error message entry to open the file where the problem occurs, and move to the error location.</li>
<li>Filter which entries are displayed, and which columns of information appear for each entry.</li>
</ul>
<p>To display the <strong>Error List</strong>, on the <strong>View</strong> menu choose <strong>Error List</strong>.</p>
<p>Use the <strong>Errors</strong>, <strong>Warnings</strong>, and <strong>Messages</strong> buttons to select which entries to display.</p>
<p>To sort the list, click any column header. To sort again by an additional column, hold down the SHIFT key and click another column header. To select which columns are displayed and which are hidden, choose <strong>Show Columns</strong> from the shortcut menu. To change the order in which columns are displayed, drag any column header to the left or right.</p>
<table border="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><strong>Note </strong></td>
</tr>
<tr>
<td>The dialog boxes and menu commands you see might differ from those   described in Help depending on your active settings or edition. To change your   settings, choose Import and Export Settings on the Tools menu. For more   information, see <a href="http://msdn.microsoft.com/en-us/library/zbhkx167%28v=VS.80%29.aspx">Visual   Studio Settings</a>.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/10/25/check-code-error-on-visual-studio-without-explicitly-compiling-no/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transition of a Java Programmer to ASP.Net</title>
		<link>http://www.skill-guru.com/blog/2010/10/19/transition-from-java-programming-to-asp-net/</link>
		<comments>http://www.skill-guru.com/blog/2010/10/19/transition-from-java-programming-to-asp-net/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 17:40:29 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Visual studio]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2861</guid>
		<description><![CDATA[I am a experienced java/j2ee developer , a big fan of open source technologies .in past 10 years I did work in almost everything related to java world(core java, applet, servlet, java bean, jsf, jsp, spring, struts, myfaces, grails, gsp etc etc..and server admin jboss, weblogic, tomcat, jetty, bea etc etc ) . Mostly used [...]]]></description>
			<content:encoded><![CDATA[<p>I am a experienced java/j2ee developer , a big fan of open source technologies .in past 10 years I did work in almost everything related to java world(core java, applet, servlet, java bean, jsf, jsp, spring, struts, myfaces, grails, gsp etc etc..and server admin jboss, weblogic, tomcat, jetty, bea etc etc ) . Mostly used IDE eclipse , myeclipse, jbuilder and netbeans.</p>
<p>Recently my company decided that they will stop work on existing projects which are on new technologies and would support legacy products.  The future &#8230;.Microsoft technologies</p>
<div id="attachment_2873" class="wp-caption aligncenter" style="width: 292px"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/10/future.jpg"><img class="size-full wp-image-2873" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/10/future.jpg" alt="future" width="282" height="179" /></a><p class="wp-caption-text">future</p></div>
<p>I was not very happy to have agreed to management demand but sometimes you have to accept the way life is.</p>
<div id="attachment_2874" class="wp-caption aligncenter" style="width: 270px"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/10/No.jpg"><img class="size-full wp-image-2874" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/10/No.jpg" alt="I love Java" width="260" height="194" /></a><p class="wp-caption-text">I love Java</p></div>
<p>I have been moved to a new project and started working in asp.net .  Now this is a transition from java to Microsoft…. Change of mindset …open source to purchased software world and much…more changes..</p>
<p>I wrote following points and issues which I had faced during  setting up  until start working on the real code….hope it will be helpful to all java/j2ee developer who are moving to Asp.Net/ C#.<span id="more-2861"></span></p>
<p>Preferably good to work in the experienced technology but no harm in learning new language. After all our brain is not re-writing asp on the java J</p>
<p>Steps before working on real project are -</p>
<ul>
<li>Installing visual studio( we are using 2003)</li>
<li>Installing iis server</li>
<li>Setting up project</li>
<li>Working in studio environment</li>
</ul>
<p>Dear Java programmers few things you are going to hate here after working in eclipse. Learning Microsoft is not hard  as it have very prefabricated kind of approach.java n asp/.net both are object oriented so logic is same and easy to grasp the coding.</p>
<p>Few things which was expected from a java programmer to have here but in visual studio ,we are out of luck <img src='http://www.skill-guru.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong><span style="text-decoration: underline;">Visual studio  vs java ide(eclipse)</span></strong></p>
<p>1.      VS is much smarter than eclipse .one example is if we copy a chunk of code in the same page if will change the variable name so even if you save it, wont lead to error.</p>
<p>2.      difference in subeclipse &amp; Vs sources safe is while updating code eclipse only updates the changed file but vss does update all files,will ask only if want to update changed files.</p>
<p>3.      In VS, we can setup a startup page for project and if will be launced automatically on debug mode /launch of application.</p>
<p>4.      We can compare eclipse&#8217;s workspace with VS&#8217;s  solution.</p>
<p>In VS we can create -project, file &amp; solution and in Eclipse/myEclipse can be- project,file,package and many other java related option.</p>
<p>A Solution is a container for one or more projects, similar to a Project Group in VB 6. A Visual Studio .NET Solution<br />
can contain projects of different types, using different .NET languages.The only thing is that VS insists on Solutions (prompting you to create one when you open up a single project)&#8230; even when you only have one project.</p>
<p>Both workspace &amp; solution  can have multiple projects in it.</p>
<p>5.      If we have opened multiple files in IDE and want to close all but one; there is no option for close all in visual studio like eclipse.</p>
<p>6.      I have gotten accustomed to the way Eclipse handles underlining errors (in java source). When there is a error in my code in eclipse, it will usually be underlined right away, and if I fix it, the underline will disappear almost immediately, or at worst, when I save the file. In Visual Studio 2003 however, its really hard to correct the code until you build. Not very friendly. may be newer versions of visual studio has this feature. I have to stick to 2003 unfortunately.:(.</p>
<p>7.      Other thing  which pissed me off is -No place to see errors and exception same like java’s web servers on console or logs or through IDE screen. People here uses print statement or run and find the problem. Again higher version may be better in this.</p>
<p>I will keep on writing all minor &amp; major issues which faced during this change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/10/19/transition-from-java-programming-to-asp-net/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Output parameter not allowed as argument list prevents use of RPC.</title>
		<link>http://www.skill-guru.com/blog/2010/04/20/output-parameter-not-allowed-as-argument-list-prevents-use-of-rpc/</link>
		<comments>http://www.skill-guru.com/blog/2010/04/20/output-parameter-not-allowed-as-argument-list-prevents-use-of-rpc/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 14:14:44 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2096</guid>
		<description><![CDATA[While calling a stored procedure from my java class; I was getting the following  error-
java.sql.SQLException: &#8220;Output parameter not allowed as argument list prevents use of RPC.&#8221;
After doing a little research; I found that When calling a stored procedure that has output parameters, the driver has to call the procedure using a remote procedure call (RPC). [...]]]></description>
			<content:encoded><![CDATA[<p>While calling a stored procedure from my java class; I was getting the following  error-</p>
<p><strong>java.sql.SQLException: &#8220;Output parameter not allowed as argument list prevents use of RPC.&#8221;</strong></p>
<p>After doing a little research; I found that When calling a stored procedure that <span style="text-decoration: underline;">has output parameters</span>, the driver has to call the procedure using a remote procedure call (RPC). Stored procedures should be invoked using the special JDBC call escape syntax.</p>
<p>For example, {call stored_Proc1(?,?,?,?)}.</p>
<p>In this case the driver will be able to use an RPC successfully as all the parameters are represented by parameter markers (?). If however parameters are supplied as a mixture of parameter markers and literals,</p>
<p>for example {call stored_Proc1(?,’ ‘,?,0)}</p>
<p>Then the driver is unable to use an RPC and therefore cannot return output parameters. In these circumstances the driver raises the above exception and execution fails.</p>
<p>It is possible to use mixed parameter lists to call stored procedures that <span style="text-decoration: underline;">do not have output parameters</span>. In this case the driver will substitute the parameters locally and use a normal &#8220;execute procedure&#8221; SQL call; however, this mode of execution is less efficient than an RPC.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/04/20/output-parameter-not-allowed-as-argument-list-prevents-use-of-rpc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Jboss 4 Server Configuration changes for SQL Server 2008</title>
		<link>http://www.skill-guru.com/blog/2010/04/05/jboss-4-server-configuration-for-sql-server-2008/</link>
		<comments>http://www.skill-guru.com/blog/2010/04/05/jboss-4-server-configuration-for-sql-server-2008/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 14:58:31 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2006</guid>
		<description><![CDATA[Last week  our Sql Server was upgraded to 2008 version. And the upgrade , I found following exception being thrown by when deploying our project.
com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.
I upgraded the jdbc driver and replaced to sqljdbc.jar (version 2.0) and stored in [...]]]></description>
			<content:encoded><![CDATA[<p>Last week  our Sql Server was upgraded to 2008 version. And the upgrade , I found following exception being thrown by when deploying our project.</p>
<p><strong>com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.</strong></p>
<p>I upgraded the jdbc driver and replaced to sqljdbc.jar (version 2.0) and stored in lib folder of my project.<br />
But the error was same as under— <span id="more-2006"></span></p>
<p><strong>Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later</strong>.<br />
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)<br />
at com.microsoft.sqlserver.jdbc.DBComms.Prelogin(Unknown Source)<br />
at com.microsoft.sqlserver.jdbc.DBComms.(Unknown Source)<br />
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)<br />
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)<br />
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)<br />
&#8230; 46 more<br />
20:47:06,522 ERROR [STDERR] org.jboss.util.NestedSQLException: Could not create connection; &#8211; nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.); &#8211; nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; &#8211; nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later.))<br />
20:47:06,522 ERROR [STDERR]     at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)</p>
<p>After spending some time , I found that this issue will normally occur when you are using a older verison of JDBC driver to connect to sql server 2008. So make sure you are using sql server 2008 JDBC driver and you do not have sqlserver 2005 JDBC drivers in the classpath or in server/default/lib folder.</p>
<p>When you download the SQlserver 2008 JDBC driver from the Microsoft website, you will get two jar files: sqljdbc4.jar and sqljdbc.jar.<br />
For JDK5 &#8211; use sqljdbc.jar<br />
for JDK6 &#8211; use sqljdbc4.jar</p>
<p>When you JDK1.5 and trying to load sqljdbc4.jar, you might get the below exception.So use sqljdbc.jar[2008]<br />
Exceptionjava.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver</p>
<p><em><strong>SQL Server 2008 Database Configuration on Jboss 4</strong></em></p>
<p>To use JBoss 4.0 with SQL server, we first need to put the driver classes into the Project lib PATH. Copy the .jar file sqljdbc.jar to the /server/default/lib directory.<br />
To use the SQL data source, mention driver-class in jndi file. by setting com.microsoft.sqlserver.jdbc.SQLServerDriver and jdbc:sqlserver://</p>
<p><em><strong>MySQL Database Configuration on Jboss 4</strong></em><br />
To use JBoss 4.0 with MySQL, we first need to put the MySQL driver classes into the CLASSPATH. Copy the .jar file mysql-connector-java-3.0.9-stable-bin.jar to the /server/default/lib directory.<br />
To use the MySQL data source, copy /docs/examples/jca/mysql-ds.xml to the /server/default/deploy directory. Modify the mysql-ds.xml configuration file by setting  to com.mysql.jdbc.Driver and  to jdbc:mysql:///, where  is the MySQL host server and  is the MySQL database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/04/05/jboss-4-server-configuration-for-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JNDI lookup on JBoss</title>
		<link>http://www.skill-guru.com/blog/2010/03/11/jndi-lookup-on-jboss/</link>
		<comments>http://www.skill-guru.com/blog/2010/03/11/jndi-lookup-on-jboss/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 15:50:54 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[EJB]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[jndi]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1733</guid>
		<description><![CDATA[There is no standard way as per Java EE specs for  JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.
On specifying a Datasource&#8217;s JNDI name as &#8216;myDatasource&#8217;, JBoss binds as &#8216;java:myDatasource&#8217;. So if one want to deploy the application on Jboss application servers then can use the simplest [...]]]></description>
			<content:encoded><![CDATA[<p>There is no standard way as per Java EE specs for  JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.</p>
<p>On specifying a Datasource&#8217;s JNDI name as &#8216;myDatasource&#8217;, JBoss binds as &#8216;java:myDatasource&#8217;. So if one want to deploy the application on Jboss application servers then can use the simplest way is here. The steps for adding and using jndi Datasource to JBOSS 4.x is as under-</p>
<ul>
<li>Copy the jdbc driver to JBOSS_HOME/server/default/lib.</li>
</ul>
<ul>
<li>Create the jndi xml file for datasource – example ds.xml <span id="more-1733"></span></li>
</ul>
<p><em> &lt;?xml version=</em><em>&#8220;1.0&#8243; encoding=</em><em>&#8220;UTF-8&#8243;?&gt;</em></p>
<p><em>&lt;datasources&gt;</em></p>
<p><em>&lt;local-tx-datasource&gt;</em></p>
<p><em>&lt;jndi-name&gt;myDataSource&lt;/jndi-name&gt;</em></p>
<p><em>&lt;connection-url&gt;jdbc:sqlserver://10.0.120.109:1199;databaseName= Systest;<span style="text-decoration: underline;">lastupdatecount</span>=false;socketKeepAlive=true&lt;/connection-url&gt;</em></p>
<p><em>&lt;driver-class&gt;com.microsoft.sqlserver.jdbc.SQLServerDriver</em></p>
<p><em>&lt;/driver-class&gt;</em></p>
<p><em>&lt;min-pool-size&gt;5&lt;/min-pool-size&gt;</em></p>
<p><em>&lt;max-pool-size&gt;20&lt;/max-pool-size&gt;</em></p>
<p><em>&lt;user-name&gt;<span style="text-decoration: underline;">user</span>&lt;/user-name&gt;</em></p>
<p><em>&lt;password&gt;<span style="text-decoration: underline;">password</span>&lt;/password&gt;</em></p>
<p><em>&lt;check-valid-connection-sql&gt;SELECT 1&lt;/check-valid-connection-sql&gt;</em></p>
<p><em>&lt;metadata&gt;</em></p>
<p><em>&lt;type-mapping&gt;MS SQLSERVER2000&lt;/type-mapping&gt;</em></p>
<p><em>&lt;/metadata&gt;</em></p>
<p><em>&lt;/local-tx-datasource&gt;</em></p>
<p><em>&lt;/datasources&gt;</em></p>
<ul>
<li>Copy the ds.xml to JBOSS_HOME/server/default/deploy</li>
</ul>
<ul>
<li>Now we  look this up using <strong>java:jndi-name</strong> in our java code as in below example. it Works perfect. Example—</li>
</ul>
<p><strong> </strong></p>
<p><em><strong>public</strong> <strong>static</strong> Connection GetSqlServerConnection() {</em></p>
<p><em>java.sql.Connection conn = <strong>null</strong>;</em></p>
<p><em><strong>try</strong> {</em></p>
<p><em>Context initContext = <strong>new</strong> InitialContext();</em></p>
<p><em>javax.sql.DataSource ds = (javax.sql.DataSource)initContext.lookup(&#8220;java:myDataSource&#8221;);</em></p>
<p><em>conn = ds.getConnection();</em></p>
<p><em><strong>return</strong> conn;</em></p>
<p><em>}</em></p>
<p><em><strong> catch</strong> (javax.naming.NamingException nex) {</em></p>
<p><em>nex.printStackTrace();</em></p>
<p><em>logger.error(nex.getMessage(), nex);</em></p>
<p><em><strong>return</strong> <strong>null</strong>;</em></p>
<p><em>}</em></p>
<p><em><strong>catch</strong> (Exception e) {</em></p>
<p><em>e.printStackTrace();</em></p>
<p><em>logger.error(e.getMessage(), e);</em></p>
<p><em><strong>return</strong> <strong>null</strong>;</em></p>
<p><em>}</em></p>
<p><em>}</em></p>
<p>Now For compatibility with other containers, we can move the  jndi-datasource to for example  <strong>java:comp/ jdbc/jndi-name</strong> location then we need to add the &lt;resource-ref&gt; for jndi name to  <strong>jboss-web.xml &amp; web.xml.</strong><ins datetime="2010-03-11T15:42:29+00:00"></ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/03/11/jndi-lookup-on-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy Tutorial &#8211; Calling a stored procedure</title>
		<link>http://www.skill-guru.com/blog/2009/12/02/groovy-way-calling-a-stored-procedure/</link>
		<comments>http://www.skill-guru.com/blog/2009/12/02/groovy-way-calling-a-stored-procedure/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 17:37:46 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1179</guid>
		<description><![CDATA[Calling a stored procedure from a Sql server MySQL database or any other database in groovy is simple. First we need a datasource which spring could provide for us. Do the necessary datasource mapping in the resources.xml ( spring folder) in your grails folder &#38;/Or datasources.groovy.
In service, use the datasource to call a store procedure [...]]]></description>
			<content:encoded><![CDATA[<p>Calling a stored procedure from a Sql server MySQL database or any other database in groovy is simple. First we need a datasource which spring could provide for us. Do the necessary datasource mapping in the resources.xml ( spring folder) in your grails folder &amp;/Or datasources.groovy.</p>
<p>In service, use the datasource to call a store procedure as below example<br />
<pre><pre>import groovy.sql.Sql
class TestService{
def dataSource // using the datasource we define in the spring&#039;s resources.xml

&lt;strong&gt;/**Calling Procedure with in-parameters only- use sql.query**/&lt;/strong&gt;
def abcList = { params -&amp;gt;
Sql sql = new Sql(dataSource)
def clientkey = (SecurityUtils.getSecureClientKey(params) !=
null)?SecurityUtils.getSecureClientKey(params):1
//calling proc that returns resultset
sql.query(&quot;{call svr_RetrieveClientPreferences(?)}&quot;,[clientkey]) { rs -&amp;gt;
if (rs != null) {
int i = 0
while (rs.next()) {
/ *all functionality ...... */
}
}
}
}

&lt;strong&gt;/**Calling Procedure with in &amp;amp; Out parameters - use sql.call **/&lt;/strong&gt;
def abcCalc = { params -&amp;gt;
Sql sql = new Sql(dataSource)
guid = params.guide
userKey = params.user
//calling proc that returns out parameters
sql.call(&quot;{call gdx_ReadSessionData(?,?,?,?,?,?)}&quot;,
[guid, userKey, Sql.out(Sql.INTEGER.type),
Sql.INTEGER, Sql.VARCHAR, Sql.INTEGER])
{ date,userKeyCode,msgCode,retCode -&amp;gt; /* The out parameters will be returned in the same order it passed to procedure */
userKey = userKeyCode
println(&quot; return code&quot; + retCode)
}
}
}</pre></pre><br />
<strong>Note-</strong><br />
in-Out Param can be passed as Sql.out(Sql.&lt;DATATYPE&gt;.type)  OR Sql.&lt;DATATYPE&gt; .<br />
See more for DATATYPE here &#8211; http://groovy.codehaus.org/api/groovy/sql/Sql.html<br />
<strong>LIMITATION -</strong><br />
Some issues with groovy sql; where we want to use out parameters &amp; resultset  both   as a return of proc execution.</p>
<p>In this case we have to use the jdbc way (callable stmt) where stored procedure that return ResultSet and OUT parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/12/02/groovy-way-calling-a-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Groovy Closures</title>
		<link>http://www.skill-guru.com/blog/2009/08/31/groovy-closures/</link>
		<comments>http://www.skill-guru.com/blog/2009/08/31/groovy-closures/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 18:43:27 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=554</guid>
		<description><![CDATA[Groovy supports closures and they are very useful when we create Groovy applications.
The most important difference between a normal function/method and a Closure is that Closures can be passed onto other functions as arguments and they serve as Callbacks to the calling function.
For example we can pass closures as arguments to methods to execute them. [...]]]></description>
			<content:encoded><![CDATA[<p>Groovy supports closures and they are very useful when we create Groovy applications.</p>
<p>The most important difference between a normal function/method and a Closure is that Closures can be passed onto other functions as arguments and they serve as <strong><em>Callbacks</em></strong> to the calling function.</p>
<p>For example we can pass closures as arguments to methods to execute them. We can create closures ourselves, but we can also convert a method to a closure with the <code>.&amp;amp;</code> operator. And we can use the converted method just like a normal closure. Because Groovy can use Java objects we can also convert a Java method into a closure.</p>
<p><strong><span style="text-decoration: underline;">syntax to write Closure-</span></strong><br />
<pre>[[code]]czozMTM6XCJkZWYgY2xvc3VyZTEgPSB7cGFyYW1zIC0mZ3Q7DQovL3N0YXRlbWVudHMgJmFtcDsgbG9naWMNCn0NCjxzdHJvbmc+ZS57WyYqJl19Zy08L3N0cm9uZz4NCi8vdHlwZSAxwqAgLSBjbG9zdXJlIHdpdGhvdXQgYW55IHBhcmFtZXRlcg0KZGVmIGNsb3N1cmUyID0gew0KwntbJiomXX2gwqDCoMKgcHJpbnRsbiBcIlRlc3QgT25seVwiDQp9DQovL3R5cGUgMiDigJMgY2xvc3VyZSB3aXRoIHR3byBwYXJhbQ0KZGVmIGNsb3N7WyYqJl19dXJlMyA9IHsgU3RyaW5nIG5hbWUsIGludCBhZ2UgLSZndDsNCsKgwqDCoCBwcmludGxuIFwiTXkgbmFtZSBpcyA6ICRuYW1lIGFuZCB7WyYqJl19YWdlIGlzOiAkYWdlXCINCn1cIjt7WyYqJl19[[/code]]</pre><br />
A Closure is usually defined within the braces <code>{… }</code>. Parameters defines the list of parameters that are to be passed for the closure. The symbol <code>&#039;-&amp;gt;&#039;</code> is used to separate the Arguments with the set of statements in the Closure Definition.<br />
<strong><span style="text-decoration: underline;">call a Closure Definition-</span></strong><br />
<pre></pre><br />
Like &#8216;this&#8217; keyword which refers to the current object, there is &#8216;it&#8217; keyword which, when used within a Closure Definition refers to the default first parameter being passed to the method. The following code will prove that,<br />
<pre><pre>def closure4 = {
&nbsp;&nbsp;&nbsp;&nbsp;println it
}
Closure4.call(&quot;Test Again&quot;)
Closure4.call()

&lt;em&gt;Output--&lt;/em&gt;
Test Again
null</pre></pre><br />
<strong><span style="text-decoration: underline;">Java  method  to  groovy closure</span></strong><br />
<pre></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/08/31/groovy-closures/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Grails tutorial &#8211; How to create and run First Application in Grails</title>
		<link>http://www.skill-guru.com/blog/2009/07/23/start-grailing-how-to-create-and-run-first-application/</link>
		<comments>http://www.skill-guru.com/blog/2009/07/23/start-grailing-how-to-create-and-run-first-application/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 20:16:52 +0000</pubDate>
		<dc:creator>sadhna</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[grails tutorial]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=159</guid>
		<description><![CDATA[I am hoping you would have gone through Introducing Grails and then the Part 1 of this post Setting Up Grails .
Now I am covering the details of developing and running the application
1. Go to command prompt and your grails home directory.
2. Create the application. 

The create-app command creates the full project, with a template [...]]]></description>
			<content:encoded><![CDATA[<p>I am hoping you would have gone through<a href="http://www.skill-guru.com/blog/2009/06/26/grails-a-breath-of-fresh-air-for-java-people/"> Introducing Grails </a>and then the Part 1 of this post <a href="http://www.skill-guru.com/blog/2009/07/08/setting-up-grails-%E2%80%A6/" target="_self">Setting Up Grails</a> .</p>
<p>Now I am covering the details of developing and running the application</p>
<p><strong>1. </strong><strong>Go to command prompt and your grails home directory.</strong><br />
<strong>2. </strong><strong>Create</strong><strong> the application</strong>.<strong> </strong></p>
<ul>
<li>The create-app command creates the full project, with a template with placeholders for the different components of your application such as configuration, MVC, library, and much more.</li>
<li>&gt; grails create-app   (it will ask for a application name say – first_app)</li>
<li>Will create basic  view layout as main.gsp page<span id="more-159"></span></li>
</ul>
<p><strong>3. </strong><strong>Add the Business Logic and Model( Domain Classes)</strong></p>
<ul>
<li>The domain class is the core of the business application; it contains the state and behavior of your application.</li>
<li>&gt; cd first_app</li>
<li>&gt; grails create-domain-class  (enter name say – first;you need to use the same name for the class and the table you want to map your object on.)</li>
<li>The domain class is located in the following location:./first_app/grails-app/domain/First.groovy</li>
</ul>
<p>class First{ // A blank class will be created on create-domain<br />
/*can add vars you don&#8217;t need to worry about creating the getters and setters*/<br />
String name<br />
Date birthdate<br />
}</p>
<p><strong>4. </strong><strong>Create the different screens from the domain class</strong>.</p>
<ul>
<li>&gt; grails generate-all (For creating all screens-enter domain class name – first)</li>
<li>This command creates the different Views and Controllers; you can take a look to the directories: ./grails-app/controllers &amp;. /grails-app/views</li>
</ul>
<p>class FirstController {//will create &lt;domainname&gt;Controller<br />
// with some default closures<br />
def list = {…}<br />
&#8230;<br />
}<br />
<code>FirstController</code> also gets lots of new and useful dynamic methods whose names are handily self-explanatory:</p>
<ul>
<li><code>save()</code> <em>saves</em> the data to the table in the HSQLDB database.</li>
<li><code>delete()</code> <em>deletes</em> the data from the <code>table</code>.</li>
<li><code>list()</code> returns a list.</li>
<li><code>get()</code> returns a single record</li>
<li>create()</li>
<li>update().</li>
</ul>
<p>Also generates the 4 view gsp pages to render the output on screen.</p>
<h4>5.      Run the Application</h4>
<p>Grails provides a way to run the application in standalone mode (run-app). This command starts a Web container (based on Jetty) with the application deployed.</p>
<p>&gt; grails run-app  and go to <a href="http://localhost:8080/first_app/">http://localhost:8080/first_app/</a> to see it running.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/07/23/start-grailing-how-to-create-and-run-first-application/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

