<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>jtds &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/jtds/</link>
	<description>Feed of posts on WordPress.com tagged "jtds"</description>
	<pubDate>Sun, 29 Nov 2009 01:41:06 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Prepare to Program with Java :  The Folder and Path (Part 1)]]></title>
<link>http://javacabin.wordpress.com/2009/11/25/prepare-to-program-with-java-the-folder-and-path-part-1/</link>
<pubDate>Wed, 25 Nov 2009 04:26:18 +0000</pubDate>
<dc:creator>demitkecil</dc:creator>
<guid>http://javacabin.wordpress.com/2009/11/25/prepare-to-program-with-java-the-folder-and-path-part-1/</guid>
<description><![CDATA[Pramudya Yanuanto This article gives you very basic knowledge about how to prepare your environment ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="mailto:demitkecil@yahoo.com">Pramudya Yanuanto</a></p>
<p>This article gives you very basic knowledge about how to prepare your environment for Java, yet give you my experiences for using Java such a long time.</p>
<p>While we can program Java in Linux, most of this article talk about the process in Windows.</p>
<p>I assume that you may use many Databases, Editors (to take advantages of some features), and many versions of JDK (to maintain your old project without difficulties).</p>
<p style="text-align:center;"><a href="http://javacabin.wordpress.com/files/2009/11/folder-structures1.gif"><img class="size-full wp-image-18  aligncenter" src="http://javacabin.wordpress.com/files/2009/11/folder-structures1.gif" alt="Folder Structure" width="139" height="157" /></a></p>
<p>Yes, I put everything under folder Java since I program with more than 10 languages, so it will make me faster finding it. Beside, if you put some program under Windows Program File Folder, it will be to long to type it …</p>
<h2>JDKs Folder</h2>
<p>Lets start with JDKs Folder. Why should we need this folder?</p>
<p>I’ve used Java to program for quite a long time ago, so I have used the old JDK. If I have to maintain it (with tight budget from the customer), It will be better for me to used the old one rather than adjust anything with new JDK that may arise some new errors.</p>
<p>And if you a new Java programmer, may be you have to maintain old Java program that can not be upgarded (due to customer request) into a new JDK version.</p>
<p>Here is a link where you can find an old JDK:</p>
<p><a href="http://java.sun.com/javase/downloads/previous.jsp">http://java.sun.com/javase/downloads/previous.jsp</a></p>
<p style="text-align:center;"><a href="http://javacabin.wordpress.com/files/2009/11/old-jdk.png"><img class="alignnone size-full wp-image-28" title="old-jdk" src="http://javacabin.wordpress.com/files/2009/11/old-jdk.png" alt="" width="449" height="271" /></a></p>
<p>Sun still maintain such of JDKs and I personally thanks to all staff of Sun for such of generousity.</p>
<p>Here are the JDK and JRE that’s still reside in Sun</p>
<ul>
<li>JDK/JRE 1.1</li>
<li>JDK/JRE 1.2.1 update 4</li>
<li>JDK/JRE 1.2.2 update 4 – 17</li>
<li>JDK/JRE 1.3.0 initial until update 5</li>
<li>JDK/JRE 1.3.1 initial until update 25</li>
<li>JDK/JRE 1.4.0 initial until update 4</li>
<li>JDK/JRE 1.4.1 initial until update 7</li>
<li>JDK/JRE 1.4.2 initial until update 19</li>
<li>JDK/JRE 5 initial until update 21</li>
<li>JDK/JRE 6 initial until 16 (current is update 17)</li>
</ul>
<p>That’s such a very good service for a free perfect thing …</p>
<p>Now your folder may look like this :</p>
<p style="text-align:center;"><a href="http://javacabin.wordpress.com/files/2009/11/folder-jdk.gif"><img class="size-full wp-image-21 aligncenter" title="Folder JDK" src="http://javacabin.wordpress.com/files/2009/11/folder-jdk.gif" alt="" width="138" height="206" /></a></p>
<p>Notice that in JDK 6, I use 2 folders. I use that because I always use the update 6 and then will move it to the newest update but still want to test it for some time.</p>
<p>So I use all the JDK to make sure that we do the right ting. Upgrade can create undesirable effect if we have just a tight budget.</p>
<h2>Drivers Folder</h2>
<p>Yes as the name states, it will be used to store all of your database folders. Why bother? I use Oracle database back since version 5. Yes, oracle start using Java at version 8i. The problem is that oracle use the same name for jars for it’s drivers.</p>
<p>The name is always like these with a little bit varian (no matters the version is):</p>
<ul>
<li>classes111.jar</li>
<li>classes111_g.jar</li>
<li>classes12.jar</li>
<li>classes12dms.jar</li>
<li>classes12dms_g.jar</li>
<li>classes12_g.jar</li>
<li>javadoc.tar</li>
<li>nls_charset11.jar</li>
<li>nls_charset12.jar</li>
<li>ocrs12.jar</li>
<li>ojdbc14.jar</li>
<li>ojdbc14_g.jar</li>
</ul>
<p>It means that you can not keep them in the same folder.</p>
<p>In this folders you also see jTDS folder that contain driver for Microsoft SQL Server 6.5 to 2008 and  Sybase ASE version 10, 11, 12, 15. a very wonderful driver for very small size. We will discuss it in details when we cover the JDBC.</p>
<p>Our folder will look like this :</p>
<p style="text-align:center;"><a href="http://javacabin.wordpress.com/files/2009/11/folder-drivers.gif"><img class="size-full wp-image-22 aligncenter" title="Folder Drivers" src="http://javacabin.wordpress.com/files/2009/11/folder-drivers.gif" alt="" width="135" height="342" /></a></p>
<h2>Editor Folders</h2>
<p>Yes most of us fanatic with our editor. We are a kind of attached into our editors. As a hired programmers that sometime work into different company under some project leaders, I have to adjust my editor to conform to other project members.</p>
<p>Some editor also have features that more advance than other editors.</p>
<p>Here are my editor folders</p>
<p style="text-align:center;"><a href="http://javacabin.wordpress.com/files/2009/11/folder-editors.gif"><img class="alignnone size-full wp-image-23" title="Folder Editors" src="http://javacabin.wordpress.com/files/2009/11/folder-editors.gif" alt="" width="149" height="275" /></a></p>
<p>We will see how we can manage this complex structure easily on my next articleo</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Query Microsoft SQL server named instance using Oracle SQL Developer]]></title>
<link>http://lianggang.wordpress.com/2009/08/07/query-microsoft-sql-server-named-instance-using-oracle-sql-developer/</link>
<pubDate>Fri, 07 Aug 2009 19:02:50 +0000</pubDate>
<dc:creator>lianggang</dc:creator>
<guid>http://lianggang.wordpress.com/2009/08/07/query-microsoft-sql-server-named-instance-using-oracle-sql-developer/</guid>
<description><![CDATA[One way I use to connect to Microsoft SQL server 2005/2000 is using jTDS driver from Oracle SQL Deve]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>One way I use to connect to Microsoft SQL server 2005/2000 is using jTDS driver from Oracle SQL Developer.</p>
<p>1. Download jTDS JDBC Driver &#8211; a free JDBC driver, and supposed to be a fast one. http://jtds.sourceforge.net/</p>
<p>2. Install jTDS driver into Oracle SQL Developer as &#8220;Third Party JDBC Driver&#8221;</p>
<p>Open Oracle SQL Developer, click the menu &#8220;Tools&#8221; -&#62; &#8220;Preference&#8221;; then on the pop-up window of</p>
<p>&#8220;Preference&#8221; -&#62; &#8220;Database&#8221; -&#62; &#8220;Third Party JDBC Driver&#8221; -&#62; &#8220;Add Entry&#8221;</p>
<p><img class="size-medium wp-image-136 alignnone" title="Add Third Party JDBC Driver" src="http://lianggang.wordpress.com/files/2009/08/thirdparty2.jpg?w=300" alt="Add Third Party JDBC Driver" width="300" height="219" /></p>
<p>3. Then go to &#8220;New/Select Database Connection&#8221;</p>
<p>Notice the tabs for ACCESS, SQL Server , Sybase.  Click SQL Server tab.</p>
<p>3.1 To access the Named Instance on a MS SQL host, you need to specify the instance name besides hostname</p>
<p>At this moment, Oracle SQL Developer doesn&#8217;t have have a field for you to enter that.  The workaround is add named instance information into &#8220;Port&#8221; field.</p>
<p><img class="size-medium wp-image-133 alignleft" title="create connection to a named instance" src="http://lianggang.wordpress.com/files/2009/08/named-instance.jpg?w=300" alt="create connection to a named instance" width="300" height="191" /> Connecting to MS SQL instance MySQLSERVER1 on server MyWinServer1, you enter &#8220;mywinserver1&#8243; in HOST, then, you need to enter the port with  1433.<br />
Connecting to MS SQL named instance MyNamedIns on Server MyWinServer1, you enter  &#8220;mywinserver1&#8243; on HOST With named instance, you need to enter  1433/;instance=mynamedins</p>
<p>Because URL format for jTDS is  jdbc:jtds:://[:][/][;=[;...]]  Adding &#8220;/;instance=mynamedins&#8221; at the end of &#8220;port&#8221; field does the trick.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[CallableStatements, JdbcTemplate and jTDS]]></title>
<link>http://sacrephill.wordpress.com/2008/10/15/callablestatements-jdbctemplate-and-jtds/</link>
<pubDate>Wed, 15 Oct 2008 12:56:43 +0000</pubDate>
<dc:creator>Phill</dc:creator>
<guid>http://sacrephill.wordpress.com/2008/10/15/callablestatements-jdbctemplate-and-jtds/</guid>
<description><![CDATA[I&#8217;ve been using the jTDS driver to connect to our SQL Server database. We have a stored proced]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve been using the <a href="http://jtds.sourceforge.net/">jTDS</a> driver to connect to our SQL Server database. We have a stored procedure which I needed to call. In this project I would normally use iBATIS, but this particular call required the features of JdbcTemplate and CallableStatements (there are good reasons which I won&#8217;t go into now!)</p>
<p>The stored procedure has one out parameter, and also returns a ResultSet. I thought this would be pretty simple to set up &#8211; but all my attempts kept coming up with the error message &#8220;Could not set up parameter for remote server&#8221; (which the jTDS driver was sending back).</p>
<p>At the time I was using named parameters. What I&#8217;ve done is to switch to using positioned parameters (i.e. setString(1, &#8220;Parameter&#8221;); registerOutParameter(2, Types.VARCHAR)) and that has seemed to fix the problem.</p>
<p>A bit bizarre, but as I couldn&#8217;t find any info about this error anywhere on the internet I thought it was worth posting about in case it saves someone else a headache <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Java Server Faces, SQL SERVER and CHAR FIELDS]]></title>
<link>http://netbeansboy.com/2008/09/18/the-nightmare-of-char-fields-in-sql-server-and-a-naughty-solution/</link>
<pubDate>Thu, 18 Sep 2008 09:19:20 +0000</pubDate>
<dc:creator>pncblessed</dc:creator>
<guid>http://netbeansboy.com/2008/09/18/the-nightmare-of-char-fields-in-sql-server-and-a-naughty-solution/</guid>
<description><![CDATA[I have modified the excellent JTDS driver to strip the spaces from CHAR FIELDS so that Java Server f]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have modified the excellent JTDS driver to strip the spaces from CHAR FIELDS so that Java Server faces controls do not get confused when fields are of different lengths and also when you go to edit a field you don&#8217;t get a pile of spaces at the end of the text.</p>
<p><strong>The problem.</strong></p>
<p>Well I have a project where the people who originally designed the database were obviously monkeys. So they used CHAR fields throughout the database. But not all the same size, for example:-</p>
<p>TABLE 1 (SERVICE CODES) SERVICE CODE CHAR 2 JI</p>
<p>Then in an other table</p>
<p>TABLE 2 SERVICE CODE CHAR 50</p>
<p>This means that if you create a drop down box on a page with the service code list it would be padded and would not match the other table. I initially started modifying the SQL code to CAST service code as a CHAR to match the other one. Since there were 100 odd tables this meant masses of extra work to use Java Server Faces.</p>
<p>The other problem is that editing fields have extra spaces at the end of the data &#8211; what a nightmare.</p>
<p>So I pulled down the open source JTDS driver and rewrote it to trim all spaces from CHAR fields, thus making JSF work right and solving my SPACE problem.</p>
<p>The files are here</p>
<p><a title="Source" href="http://www.ukconstruction.com/jtdssource.zip">Source Code (converted into a Netbeans Project)</a></p>
<p><strong>Note</strong> if you download and use this you do so at your own risk, no warranty, implied or otherwise is provided for this software.</p>
<p><strong>Note 2: </strong>if you were using an OLD jdts driver you will need to remove the references from the SERVER as well as NETBEANS and use this new one &#8211; I might get round to renaming the driver to something else but if you find there are spaces where there should not be its probably because you are running the standard driver not the new one.</p>
<p><strong>Note 3: If you just want the driver its in the &#8220;dist&#8221; subdirectory, you need the LIB folder as well.</strong></p>
<p><strong>Note 4: If you publish a project using this driver and modify the driver then publish it again, NB won&#8217;t change the driver on the glassfish server if it has the same name, so you&#8217;ll have to copy it over yourself.</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Definición del DataSource]]></title>
<link>http://cyberhotel.wordpress.com/2008/03/05/definicion-del-datasource/</link>
<pubDate>Wed, 05 Mar 2008 19:23:59 +0000</pubDate>
<dc:creator>cyberhotel</dc:creator>
<guid>http://cyberhotel.wordpress.com/2008/03/05/definicion-del-datasource/</guid>
<description><![CDATA[Lo primero que suele aparecer en el fichero de configuración es un apartado en el cual definimos el ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p class="MsoNormal" align="justify">    Lo primero que suele aparecer en el fichero de configuración es un apartado en el cual definimos el DataSource, esto es, el origen de datos, y en él indicamos lo siguiente:</p>
<blockquote>
<p class="MsoNormal"><span style="background:white none repeat scroll 0 50%;color:blue;">&#60;!&#8211;</span><span style="background:white none repeat scroll 0 50%;color:gray;"> ======= Definition of the DataSource =======</span><span style="background:white none repeat scroll 0 50%;color:blue;">&#8211;&#62;</span><span> </span></p>
<p class="MsoNormal"><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">bean</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"> id</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">dataSource</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"><br />
class</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">org.apache.commons.dbcp.BasicDataSource</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;">&#8220;<br />
destroy-method</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">close</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"></span></p>
<p><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span></span><span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"> name</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">driverClassName</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>            </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">net.sourceforge.jtds.jdbc.Driver</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span>           </span></span></p>
<p><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"> name</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">url</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span>        </span><span>                        </span><span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">             &#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">jdbc:jtds:sqlserver://localhost:4492/hotel</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span></span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">      &#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span>      </span></p>
<p><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"></span></p>
<p class="MsoNormal"><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"> name</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">username</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>            </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">cyberhotel</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span>       </span></span></p>
<p class="MsoNormal"><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"> name</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">password</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>            </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">cyberhotel</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>            </span><br />
<span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:red;"> name</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">=&#8221;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">defaultAutoCommit</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#8220;&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>            </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;">false</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">value</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><br />
<span>      </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">property</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span></p>
<p class="MsoNormal"><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:black;"><span> </span></span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#60;/</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:maroon;">bean</span><span style="background:white none repeat scroll 0 50%;font-size:10pt;font-family:'Courier New';color:blue;">&#62;</span><span style="font-size:10pt;font-family:'Courier New';color:blue;"> </span></p>
</blockquote>
<p class="MsoNormal" align="justify"><i><span style="background:white none repeat scroll 0 50%;color:black;">driverClassName</span></i><span style="color:black;">: Es el driver utilizado para conectar con la base de datos, en este caso utilizamos Sql Server 2005, existe un driver proporcionado por Microsoft pero suele dar problemas con hibernate, por lo que se suele utilizar el driver <a href="http://jtds.sourceforge.net/" title="JTDS">JTDS</a> para este gestor de base de datos.</span></p>
<div align="justify"></div>
<p class="MsoNormal" align="justify"><i>url</i>: Es una ruta que comienza con una firma determinada, en este caso jdbc:jtds:sqlserver:, esta firma nos viene indicada en la documentación del driver. A continuación de la firma se indica la ruta de la base de datos a utilizar, en este caso está en <i>localhost</i> (máquina local) en el puerto 4492 y la base de datos se llama <i>hotel</i> por este motivo escribimos //localhost:4492/hotel.</p>
<div align="justify"></div>
<p class="MsoNormal" align="justify"><i>username</i>: Indicamos el nombre de usuario para la base de datos.</p>
<div align="justify"></div>
<p class="MsoNormal" align="justify"><i>password</i>: Indicamos la contraseña para ese usuario en la base de datos.</p>
<div align="justify"></div>
<p class="MsoNormal" align="justify"><i>defaultAutoCommit</i>: Indicamos que se hagan los <i>commit</i> de las transacciones automáticamente o no. Se suele dejar a false pues como veremos más adelante en las transacciones se pueden dar excepciones, en cuyo caso es necesario un <i>rollback</i>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Conexão JDBC ao SQL Server 2000]]></title>
<link>http://blpsilva.wordpress.com/2008/01/26/conexao-jdbc-ao-sql-server-2000/</link>
<pubDate>Sat, 26 Jan 2008 17:28:44 +0000</pubDate>
<dc:creator>blpsilva</dc:creator>
<guid>http://blpsilva.wordpress.com/2008/01/26/conexao-jdbc-ao-sql-server-2000/</guid>
<description><![CDATA[Atenção, este blog foi migrado para: http://brunopereira.org Como falei anteriormente, estou usando ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Atenção, este blog foi migrado para: <a href="http://brunopereira.org" target="_self">http://brunopereira.org</a></strong></p>
<p>Como falei anteriormente, estou usando o SQL Server 2000 para um projetinho freela. Para me conectar ao SQL Server, baixei o driver jdbc <a href="http://jtds.sourceforge.net/" target="_blank">jtds</a>, pois li que ele funciona melhor que o driver jdbc fornecido pela Microsoft. Isto não me surpreende muito, pois a Microsoft não deve ter muito interesse em alavancar o uso de Java com o SQL Server, preferindo sempre empurrar o uso de .NET.Pois bem, eu estava tendo problemas para me conectar ao SQL Server via jdbc. Inicialmente o problema parecia ser da forma de autenticação, pois o servidor foi instalado com as opções default e as configurações padrão especificavam autenticação pelo Windows somente, sem autenticação pelo SQL Server. Eu encontrei na internet várias referências dizendo que os drivers jdbc para o SQL Server 2000 não suportam autenticação pelo Windows, então habilitei também a autenticação pelo banco de dados.</p>
<p>Após habilitar a autenticação pelo banco de dados, eu continuava sem conseguir conectar. Os problemas eram sempre os mesmos, e a mensagem de erro era essa aqui:   <strong>&#8220;An error occurred while establishing the connection:  Type: java.sql.SQLException   Error Code: 0   SQL State: 08S01<br />
Message:  Network error IOException: Connection refused: connect&#8221;</strong>. Procurando por esse erro, encontrei algumas referências sugerindo conferir se o servidor estava configurado para permitir acesso por TCP/IP, e no meu caso estava sim.</p>
<p>Como eu não estava conseguindo conectar de forma alguma usando TCP/IP, tentei conectar através de named pipes, e funcionou. Minha URL de conexão com o uso de named pipes ficou da seguinte forma: <strong>jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=sistema_cms;namedPipe=true</strong></p>
<p>Ah, um detalhe importante. Ao tentar usar essa URL com localhost em vez de 127.0.0.1 , eu recebia um erro dizendo que o nome da máquina não era encontrado na rede. Colocando o hostname correto da máquina (no meu caso, blpsilva-vostro) funcionou sem problemas também. Possivelmente esta solução que utilizei não é a melhor possível para situações mais críticas. Entretanto, para o meu caso esta solução excede bastante o &#8220;good enough&#8221;, então fiquei com ela mesmo.</p>
<p>OBS: Esse template do WordPress tem o péssimo hábito de eventualmente cortar algumas frases que não caibam na largura da área central . Para não prejudicar a leitura aqui, segue abaixo novamente o nome do último parâmetro da URL jdbc:</p>
<p><strong>namedPipe=true</strong></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
