﻿<?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笔记-文章分类-数据库访问</title><link>http://www.blogjava.net/EasyLive2006/category/41522.html</link><description>各方面需要，偶尔用到java</description><language>zh-cn</language><lastBuildDate>Sat, 05 Sep 2009 15:32:10 GMT</lastBuildDate><pubDate>Sat, 05 Sep 2009 15:32:10 GMT</pubDate><ttl>60</ttl><item><title>SQLHelper 的 java版本 - 转载</title><link>http://www.blogjava.net/EasyLive2006/articles/293657.html</link><dc:creator>KidYang</dc:creator><author>KidYang</author><pubDate>Wed, 02 Sep 2009 12:39:00 GMT</pubDate><guid>http://www.blogjava.net/EasyLive2006/articles/293657.html</guid><wfw:comment>http://www.blogjava.net/EasyLive2006/comments/293657.html</wfw:comment><comments>http://www.blogjava.net/EasyLive2006/articles/293657.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/EasyLive2006/comments/commentRss/293657.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/EasyLive2006/services/trackbacks/293657.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;Ⅰ.引言&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 使用该类目的就是让使用者更方便、更安全的对数据库的操作，既是除了在SQLHelper类以外的所有类将不用引用对数据库操作的任何类与语句，无须担心数据库的连接与关闭的问题。但是，该类仍然需要大量的调试与修改。故此，请使用者不断完善该类，以至于能与SQLHelper(.NET版)的功能并驾齐驱。Ⅱ...&nbsp;&nbsp;<a href='http://www.blogjava.net/EasyLive2006/articles/293657.html'>阅读全文</a><img src ="http://www.blogjava.net/EasyLive2006/aggbug/293657.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/EasyLive2006/" target="_blank">KidYang</a> 2009-09-02 20:39 <a href="http://www.blogjava.net/EasyLive2006/articles/293657.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java连接主流数据库的方式有哪些？ - 转载</title><link>http://www.blogjava.net/EasyLive2006/articles/293656.html</link><dc:creator>KidYang</dc:creator><author>KidYang</author><pubDate>Wed, 02 Sep 2009 12:34:00 GMT</pubDate><guid>http://www.blogjava.net/EasyLive2006/articles/293656.html</guid><wfw:comment>http://www.blogjava.net/EasyLive2006/comments/293656.html</wfw:comment><comments>http://www.blogjava.net/EasyLive2006/articles/293656.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/EasyLive2006/comments/commentRss/293656.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/EasyLive2006/services/trackbacks/293656.html</trackback:ping><description><![CDATA[<p>java中三种主流数据库数据库（sqlserver，db2,oracle）的jdbc连接总结 其实java开发中连接数据库的主要问题不是如何写代码，</p>
<p>而是找驱动包。因为jdbc的驱动包太多，并且名目繁多，有的还需要安装客户端才能运行。</p>
<p>项目实践中，总结出三种主流数据库中，Java的驱动和连接字符串，均无需安装客户端：</p>
<p>一． Sqlserver：</p>
<p>驱动包：sqljdbc.jar</p>
<p>实例：</p>
<p>String _driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver "; //驱动</p>
<p>String _dbURL = "jdbc:sqlserver://198.9.100.202:1433;DatabaseName=CCTV_JDAN "; //地址</p>
<p>String _userName = "sa"; //用户名</p>
<p>String _userPwd = "1"; //密码</p>
<p>&nbsp;</p>
<p>二． DB2：</p>
<p>驱动包：db2jcc.jar，db2jcc_license_cu.jar </p>
<p>实例：</p>
<p>String _driverName = "com.ibm.db2.jcc.DB2Driver"; //驱动</p>
<p>String _dbURL = "jdbc:db2://198.9.100.202:50000/JDAN"; //地址</p>
<p>String _userName = "dbo"; //用户名</p>
<p>String _userPwd = "password"; //密码</p>
<p><br />
注：DB2这个最烦，因为需要license，找个正版的db2，安装包里会有db2jcc_license_cu.jar 。另外，数据库字符集的问题还会导</p>
<p>致java程序报编码错误："Encoding not supported"</p>
<p><br />
解决办法：</p>
<p>1、把程序的sun的jdk更换为 IBM 的 JDK ； (---当然是强烈不建议---)</p>
<p>2、可以在 DB2 创建数据库的时候将编码设为 UTF-8 ； </p>
<p>3、用最新的 V8 Fixpack12 以上带的 db2jcc.jar 也可以解决。可以去DB2官网下载。</p>
<p>&nbsp;</p>
<p><br />
三． Oracle：</p>
<p>驱动包：ojdbc14.jar</p>
<p>实例：</p>
<p>String _driverName = "oracle.jdbc.driver.OracleDriver"; //驱动</p>
<p>String _dbURL = "jdbc:oracle:thin:@198.9.1.24:1521:mam32"; //地址</p>
<p>String _userName = "mam32sys"; //用户名</p>
<p>String _userPwd = "password"; //密码<br />
</p>
 <img src ="http://www.blogjava.net/EasyLive2006/aggbug/293656.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/EasyLive2006/" target="_blank">KidYang</a> 2009-09-02 20:34 <a href="http://www.blogjava.net/EasyLive2006/articles/293656.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>