﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-Java Sky  of  Zhao</title><link>http://www.blogjava.net/SINOJAVA/</link><description>受挫一次,对生活的理解加深一层;失误一次对人生的感悟增添一阶;不幸一次,对世界的认识成熟一级;磨难一次,对成功的内涵透彻一遍!</description><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 06:09:45 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 06:09:45 GMT</pubDate><ttl>60</ttl><item><title>【转】MySQL中判断表是否存在</title><link>http://www.blogjava.net/SINOJAVA/archive/2010/01/08/308767.html</link><dc:creator>SINOJAVA</dc:creator><author>SINOJAVA</author><pubDate>Fri, 08 Jan 2010 12:22:00 GMT</pubDate><guid>http://www.blogjava.net/SINOJAVA/archive/2010/01/08/308767.html</guid><wfw:comment>http://www.blogjava.net/SINOJAVA/comments/308767.html</wfw:comment><comments>http://www.blogjava.net/SINOJAVA/archive/2010/01/08/308767.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/SINOJAVA/comments/commentRss/308767.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SINOJAVA/services/trackbacks/308767.html</trackback:ping><description><![CDATA[MySQL中判断表是否存在:<br />
1. SHOW&nbsp;&nbsp; TABLES&nbsp;&nbsp; LIKE&nbsp;&nbsp; '%tb_bp_d_case%';&nbsp;&nbsp; <br />
<br />
2. select `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` where `TABLE_SCHEMA`='dbname' and `TABLE_NAME`='tablename' ;<br />
<br />
3. 如果表不存在就建立这个表，那么可以直接用 create table if not exists tablename 这样的指令来建立，不需要先去查询表是否存在。<br />
<br />
4. 从模板表创建表：create table if not exists like old_table_name; <br />
<br />
文章出处：DIY部落(http://www.diybl.com/course/7_databases/mysql/Mysqljs/20090313/161045.html)
<img src ="http://www.blogjava.net/SINOJAVA/aggbug/308767.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SINOJAVA/" target="_blank">SINOJAVA</a> 2010-01-08 20:22 <a href="http://www.blogjava.net/SINOJAVA/archive/2010/01/08/308767.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[ 原创--置顶] JDBC 如何连接 SQL SERVER 2000 的默认实例和命名实例</title><link>http://www.blogjava.net/SINOJAVA/archive/2006/04/10/40155.html</link><dc:creator>SINOJAVA</dc:creator><author>SINOJAVA</author><pubDate>Sun, 09 Apr 2006 23:24:00 GMT</pubDate><guid>http://www.blogjava.net/SINOJAVA/archive/2006/04/10/40155.html</guid><wfw:comment>http://www.blogjava.net/SINOJAVA/comments/40155.html</wfw:comment><comments>http://www.blogjava.net/SINOJAVA/archive/2006/04/10/40155.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/SINOJAVA/comments/commentRss/40155.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SINOJAVA/services/trackbacks/40155.html</trackback:ping><description><![CDATA[
		<div class="postTitle" align="center"> </div>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 14pt; COLOR: blue">[</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原创</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 14pt; COLOR: blue">]</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 14pt; COLOR: red">JDBC</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 14pt; COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如何连接</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 14pt; COLOR: red">SQL SERVER 2000</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 14pt; COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的默认实例和命名实例</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 14pt; COLOR: red">
								<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 5cm; mso-char-indent-count: 13.5">
				<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 94.5pt; mso-char-indent-count: 9.0">
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">引用请注明出处</span>
				<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">:http//www.blogjava.net/SINOJAVA<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: red">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">(</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一</span>
				<span lang="EN-US" style="COLOR: blue">)</span>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">下载</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">Microsoft SQL Server 2000 Service Pack 3a</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">并安装</span>
				</b>
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: #333333">
						<br />
				</span>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=90DCD52C-0488-4E46-AFBF-ACACE5369FA3&amp;displaylang=zh-cn">
										<font color="#4371a6">http://www.microsoft.com/downloads/details.aspx?FamilyId=90DCD52C-0488-4E46-AFBF-ACACE5369FA3&amp;displaylang=zh-cn</font>
								</a>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">(</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">二</span>
				<span lang="EN-US" style="COLOR: blue">)</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下载并安装</span>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">SQL SERVER 2000</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">得</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">JDBC</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">驱动</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">(</span>
				</b>
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue">SQL Server 2000 Driver for JDBC Service Pack 3</span>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">)<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&amp;displaylang=en">
										<font color="#4371a6">http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&amp;displaylang=en</font>
								</a>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">(</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三</span>
				<span lang="EN-US" style="COLOR: blue">)</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置</span>
				<span lang="EN-US" style="COLOR: blue">JDBC</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">驱动</span>
				<span lang="EN-US" style="COLOR: blue">classpath</span>
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">环境变量</span>
				<span lang="EN-US" style="COLOR: blue">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法</span>
				<span lang="EN-US" style="COLOR: blue">1:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">填加</span>
				<span lang="EN-US" style="COLOR: blue">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注</span>
						<span lang="EN-US" style="COLOR: black">: C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为我</span>
						<span lang="EN-US" style="COLOR: black">JDBC</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">得安装路径</span>
						<span lang="EN-US" style="COLOR: black">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法</span>
				<span lang="EN-US" style="COLOR: blue">2:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<span lang="EN-US" style="COLOR: blue">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将</span>
						<span lang="EN-US" style="COLOR: black">mssqlserver.jar; msutil.jar; msbase.jar</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">拷贝到</span>
						<span lang="EN-US" style="COLOR: black">JDK</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">得</span>
						<span lang="EN-US" style="COLOR: black">lib</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">目录下</span>
						<span lang="EN-US" style="COLOR: black">,</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后设置</span>
						<span lang="EN-US" style="COLOR: black">classpath<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">D:\Java\jdk1.5.0_05\lib\sqlserver\msutil.jar;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">D:\Java\jdk1.5.0_05\lib\sqlserver\msbase.jar;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black">D:\Java\jdk1.5.0_05\lib\sqlserver\mssqlserver.jar;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">(</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">四</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">)</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">创建连接数据库默认实例得连接代码</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">:<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">import java.sql.*;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">public class ConSqlserver {<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>Connection con=null;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>//Statement st=null;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>//ResultSet re=null;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>public ConSqlserver()<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>try<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>String driver="com.microsoft.jdbc.sqlserver.SqlServerDriver";<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind";<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>Class.forName(driver).newInstance(); <o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>con =DriverManager.getConnection(url,"sa","zhaopf");<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>System.out.println("</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">连接成功</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">!");<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>con.close();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>catch(Exception e)<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 3">                   </span>e.printStackTrace();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">       </span>public static void main(String[] args) <o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>// TODO </span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">自动生成方法存根</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>ConSqlserver con=new ConSqlserver();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<b style="mso-bidi-font-weight: normal">
				<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">
						<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
								<b style="mso-bidi-font-weight: normal">
										<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">(</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">五</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">)</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">创建连接数据库命名实例的连接代码</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">(</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">实例名为</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">SINOIT\SINOSERVER)</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span lang="EN-US" style="COLOR: blue; FONT-FAMILY: Wingdings; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-char-type: symbol; mso-symbol-font-family: Wingdings">
												<span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">L</span>
										</span>
								</b>
								<b style="mso-bidi-font-weight: normal">
										<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">
												<o:p>
												</o:p>
										</span>
								</b>
						</p>
				</span>
		</b>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: blue; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">import java.sql.*;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">public class ConSqlserverppp {<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>Connection con=null;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>//Statement st=null;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>//ResultSet re=null;<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>public ConSqlserverppp()<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>try<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>//String driver="com.microsoft.jdbc.sqlserver.SqlServerDriver";<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>
								<span style="mso-tab-count: 1">       </span>
								<span style="mso-spacerun: yes">    </span>String url="jdbc:microsoft:sqlserver://SINOIT\\SINOSERVER;DatabaseName=Northwind";<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); <o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 3">                   </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>//Class.forName(driver);//.newInstance();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>con =DriverManager.getConnection(url,"sa","zse");<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>//st=con.createStatement();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>System.out.println("</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt">连接成功</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">!");<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<span style="mso-spacerun: yes">    </span>con.close();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>catch(Exception e)<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 3">                   </span>e.printStackTrace();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>public static void main(String[] args) <o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>{<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 2">            </span>ConSqlserverppp con=new ConSqlserverppp();<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<span style="mso-tab-count: 1">     </span>}<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 6pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="COLOR: black; mso-bidi-font-size: 10.5pt">}<o:p></o:p></span>
				</b>
		</p>
<img src ="http://www.blogjava.net/SINOJAVA/aggbug/40155.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SINOJAVA/" target="_blank">SINOJAVA</a> 2006-04-10 07:24 <a href="http://www.blogjava.net/SINOJAVA/archive/2006/04/10/40155.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>致开幕词</title><link>http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39943.html</link><dc:creator>SINOJAVA</dc:creator><author>SINOJAVA</author><pubDate>Fri, 07 Apr 2006 23:58:00 GMT</pubDate><guid>http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39943.html</guid><wfw:comment>http://www.blogjava.net/SINOJAVA/comments/39943.html</wfw:comment><comments>http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39943.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/SINOJAVA/comments/commentRss/39943.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SINOJAVA/services/trackbacks/39943.html</trackback:ping><description><![CDATA[
		<img height="20" src="http://www.blogjava.net/Emoticons/QQ/15.gif" width="20" border="0" />我的blog开业了,欢迎大家前来支持,谢谢!!<img height="20" src="http://www.blogjava.net/Emoticons/QQ/15.gif" width="20" border="0" /><img src ="http://www.blogjava.net/SINOJAVA/aggbug/39943.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SINOJAVA/" target="_blank">SINOJAVA</a> 2006-04-08 07:58 <a href="http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39943.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA与数据库连接方法(1.2.3) </title><link>http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39942.html</link><dc:creator>SINOJAVA</dc:creator><author>SINOJAVA</author><pubDate>Fri, 07 Apr 2006 23:46:00 GMT</pubDate><guid>http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39942.html</guid><wfw:comment>http://www.blogjava.net/SINOJAVA/comments/39942.html</wfw:comment><comments>http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39942.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/SINOJAVA/comments/commentRss/39942.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SINOJAVA/services/trackbacks/39942.html</trackback:ping><description><![CDATA[
		<div class="postTitle" align="center">
				<strong> JAVA与数据库连接方法（一）<img height="19" src="http://www.blogjava.net/Emoticons/thumbs_down.gif" width="19" border="0" /> <br /></strong> </div>
		<p>用JAVA连接数据库主要有两种方式，<font color="#0000ff">一是用JDBC-ODBC桥来连接</font>，<font color="#0000ff">二是用相关厂商提供的相应驱动程序来连接，首先谈谈第一种连接。</font></p>
		<p>JDBC-ODBC桥接器是用JdbcOdbc.Class和一个用于访问ODBC驱动程序的本地库实现的。对于WINDOWS平台，该本地库是一个动态连接库DLL</p>
		<p>(JDBCODBC.DLL)。 </p>
		<p>由于JDBC在设计上与ODBC很接近。在内部，这个驱动程序把JDBC的方法映射到ODBC调用上，这样，JDBC就可以和任何可用的ODBC驱动程序进行</p>
		<p>交互了。这种桥接器的优点是，它使JDBC目前有能力访问几乎所有的数据库。通行方式如图所示： </p>
		<p>应用程序---JDBC API---JDBC-ODBC---ODBC API---ODBC层---数据源 </p>
		<p>具体操作方法为： </p>
		<p>首先打开控制面板的管理工具，打开数据源（ODBC），在用户DSN里面添加数据源（即你要连接的数据库的名字），在这里假定连接SQL SERVER </p>
		<p>2000的GoodsSupply数据库。名称填写你要连接的数据库的名称（GoodsSupply），然后逐步设置，如果选用了使用SQL-SERVER密码认证的话，</p>
		<p>就要输入相应的用户名及密码连接到数据库。一路下一步设置完成。 </p>
		<p>在JAVA里面编写程序进行测试，在这里我的程序是让用户输入任意的表名与与列名，把该列的所有数据输出。源代码如下： </p>
		<p>import java.io.BufferedReader; <br />import java.io.InputStreamReader; <br />import java.sql.*; </p>
		<p>public class ODBCBridge { </p>
		<p>public static void main(String[] args) { <br />String url="jdbc:odbc:GoodsSupply"; <br />Statement sm=null; <br />String command=null; <br />ResultSet rs=null; <br />String tableName=null; <br />String cName=null; <br />String result=null; <br />BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); <br />try { <br />try { <br />Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //加载驱动 <br />}catch(ClassNotFoundException e){ <br />System.out.println("Can not load Jdbc-Odbc Bridge Driver"); <br />System.err.print("ClassNotFoundException:"); <br />System.err.println(e.getMessage()); <br />} <br />Connection con=DriverManager.getConnection(url,"USER","PASSWORD"); //使用SQL-SERVER2000认证 <br />DatabaseMetaData dmd=con.getMetaData(); //DMD为连接的相应情况 <br />System.out.println("连接的数据库:"+dmd.getURL()); <br />System.out.println("驱动程序:"+dmd.getDriverName()); <br />sm=con.createStatement(); <br />System.out.println("输入表名"); <br />tableName=input.readLine(); <br />while(true) { <br />System.out.println("输入列名(为空时程序结束):"); <br />cName=input.readLine(); <br />if(cName.equalsIgnoreCase("")) <br />break; <br />command="select "+cName+" from "+tableName; <br />rs=sm.executeQuery(command); //执行查询 <br />if(!rs.next()) <br />System.out.println("表名或列名输入有误"); <br />else { <br />System.out.println("查询结果为:"); <br />do <br />{ <br />result=rs.getString(cName); <br />//数据库语言设置为中文，不用转换编码 <br />//result=new String(result.getBytes("ISO-8859-1"),"GB2312"); <br />System.out.println(result); <br />}while(rs.next()); <br />} <br />} <br />}catch(SQLException ex) { <br />System.out.println("SQLException:"); <br />while(ex!=null) { <br />System.out.println("Message:"+ex.getMessage()); <br />ex=ex.getNextException(); <br />} <br />}catch(Exception e) { <br />System.out.println("IOException"); <br />} <br />} <br />}  </p>
		<p align="center">
				<br />
				<strong>JAVA与数据库连接方法（二）</strong>
				<img height="19" src="http://www.blogjava.net/Emoticons/thumbs_down.gif" width="19" border="0" />
		</p>
		<p>现在介绍第二种方法，用关厂商提供的相应驱动程序来连接。 </p>
		<p>这种实现方法是直接使用数据库厂商提供的用专用的网络协议创建的驱动程序，通过它可以直接将JDBC API调用转换为直接网络调用。这种调</p>
		<p>用方式一般性能比较好，而且也是实用中最简单的方法。因为它步需要安装其他的库或中间件。几乎所有的数据库厂商都为他们的数据库提供</p>
		<p>了这种数据库提供了这种JDBC驱动程序，也可以从第三方厂商获得这些驱动程序。 </p>
		<p>从网址<a href="http://industry.java.sun.com/products/jdbc/drivers/"><font color="#4371a6">http://industry.Java.sun.com/products/jdbc/drivers/</font></a>可以看到所有有用的驱动程序的清单。其结果如图所示： </p>
		<p>应用程序---JDBC API---驱动程序---数据源 </p>
		<p>这里首先要安装JDBC的驱动程序，推荐SP2版本的，可从微软网站上下载 <br /><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9f1874b6-f8e1-4bd6-947c-0fc5bf05bf71&amp;DisplayLang=en"><font color="#4371a6">http://www.microsoft.com/downloads/details.aspx?FamilyID=9f1874b6-f8e1-4bd6-947c-0fc5bf05bf71&amp;DisplayLang=en</font></a> 下载最下面的</p>
		<p>SETUP.EXE </p>
		<p>这个驱动程序要配合SQL SERVER2000 SP3A，相应下载URL为 <br /><a href="http://www.microsoft.com/china/sql/downloads/sp3.asp"><font color="#4371a6">http://www.microsoft.com/china/sql/downloads/sp3.asp</font></a> 下载 chs_sql2ksp3.exe </p>
		<p>如果用JAVA SDK直接编译运行的话需要设置环境变量，将安装好的JDBC驱动里面的LIB三个文件设置为环境变量： <br />classpath： <br />D:\program files\Microsoft SQL Server\jdbc\lib\msbase.jar; <br />D:\program files\Microsoft SQL Server\jdbc\lib\mssqlserver.jar; <br />D:\program files\Microsoft SQL Server\jdbc\lib\msutil.jar; </p>
		<p>安装即可用微软的驱动程序连接数据库了，相应代码与前面基本相同： </p>
		<p>import java.sql.*; <br />import java.io.*; <br />public class DBColumn { </p>
		<p>public static void main(String[] args) { <br />Connection con=null; <br />Statement sm=null; <br />String command=null; <br />ResultSet rs=null; <br />String tableName=null; <br />String cName=null; <br />String result=null; <br />BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); <br />try <br />{ <br />Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); <br />System.out.println("驱动程序已加载"); <br />//SQL SERVER的登陆方式必须为使用SQL SERVER密码登陆认证方式 <br />con=DriverManager.getConnection("jdbc:microsoft:sqlserver://SERVERNAME:1433","USER","PASSWORD"); <br />con.setCatalog("GoodsSupply"); <br />System.out.println("OK,成功连接到数据库"); <br />}catch(Exception ex) { <br />ex.printStackTrace(); <br />} <br />try <br />{ <br />sm=con.createStatement(); <br />System.out.println("输入表名"); <br />tableName=input.readLine(); <br />while(true) { <br />System.out.println("输入列名(为空时程序结束):"); <br />cName=input.readLine(); <br />if(cName.equalsIgnoreCase("")) <br />break; <br />command="select "+cName+" from "+tableName; <br />rs=sm.executeQuery(command); <br />if(!rs.next()) <br />System.out.println("表名或列名输入有误"); <br />else { <br />System.out.println("查询结果为:"); <br />do <br />{ <br />result=rs.getString(cName); <br />//result=new String(result.getBytes("ISO-8859-1"),"GB2312"); <br />System.out.println(result); <br />}while(rs.next()); <br />} <br />} <br />}catch(Exception ex) { <br />ex.printStackTrace(); <br />} <br />} <br />} </p>
		<p> </p>
		<p>
				<br />                                                                 <strong>JAVA与数据库连接方法（三）<img height="19" src="http://www.blogjava.net/Emoticons/thumbs_down.gif" width="19" border="0" /><br /></strong><br />最后给出JAVA连接其他数据库的关键代码：</p>
		<p>1、Oracle8/8i/9i数据库（thin模式）    <br />Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();    <br />String  url="jdbc:oracle:thin:@localhost:1521:orcl";    <br />//orcl为数据库的SID    <br />String  user="test";    <br />String  password="test";    <br />Connection  conn=  DriverManager.getConnection(url,user,password);    <br /> <br />2、DB2数据库    <br />Class.forName("com.ibm.db2.jdbc.app.DB2Driver  ").newInstance();    <br />String  url="jdbc:db2://localhost:5000/sample";    <br />//sample为你的数据库名    <br />String  user="admin";    <br />String  password="";    <br />Connection  conn=DriverManager.getConnection(url,user,password);     <br /> <br />3、Sybase数据库    <br />Class.forName("com.sybase.jdbc.SybDriver").newInstance();    <br />String  url  ="  jdbc:sybase:Tds:localhost:5007/myDB";    <br />//myDB为你的数据库名    <br />Properties  sysProps  =  System.getProperties();    <br />SysProps.put("user","userid");    <br />SysProps.put("password","user_password");    <br />Connection  conn=  DriverManager.getConnection(url,  SysProps);    <br /> <br />4、Informix数据库    <br />Class.forName("com.informix.jdbc.IfxDriver").newInstance();    <br />String  url  =    <br />"jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;    <br />user=testuser;password=testpassword";    <br />//myDB为数据库名    <br />Connection  conn=  DriverManager.getConnection(url);    <br /> <br />5、MySQL数据库    <br />Class.forName("org.gjt.mm.mysql.Driver").newInstance();    <br />String  url  ="jdbc:mysql://localhost/myDB?user=soft&amp;password=soft1234&amp;useUnicode=  <br />true&amp;characterEncoding=8859_1"    <br />//myDB为数据库名    <br />Connection  conn=  DriverManager.getConnection(url);    <br /> <br />6、PostgreSQL数据库    <br />Class.forName("org.postgresql.Driver").newInstance();    <br />String  url  ="jdbc:postgresql://localhost/myDB"    <br />//myDB为数据库名    <br />String  user="myuser";    <br />String  password="mypassword";    <br />Connection  conn=  DriverManager.getConnection(url,user,password); </p>
<img src ="http://www.blogjava.net/SINOJAVA/aggbug/39942.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SINOJAVA/" target="_blank">SINOJAVA</a> 2006-04-08 07:46 <a href="http://www.blogjava.net/SINOJAVA/archive/2006/04/08/39942.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>