蝦米爬啊爬
-xiami's blog
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆檔案
(16)
2007年7月 (1)
2007年5月 (1)
2007年4月 (1)
2007年3月 (2)
2006年11月 (11)
相冊
xiami's photo
最新隨筆
1.?where 1=1(摘)
2.?String 轉 Date
3.?命名規(guī)則
4.?ajax(百度百科)
5.?名詞解釋(來源于百度百科)
6.?使用netbeans開發(fā)一個javabean程序
7.?建立一個螺旋形矩陣A[n][n]
8.?servlet-api的基本類和其接口介紹
9.?使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
10.?JAVA連接MYSQL
11.?管道流通信
12.?用File類來列出和篩選所有文件
13.?java.util下的Class Collections的兩種sort方法使用
14.?靜態(tài)內部類
15.?1.5容器note問題
積分與排名
積分 - 17991
排名 - 1849
最新評論
1.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
評論內容較長,點擊標題查看
--rel
2.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
多半是只讀,改下子文件屬性,把只讀去掉
--老左zuoge85@gmail.com
3.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
看看你們那個文件目錄是不是只讀的
--老左zuoge85@gmail.com
4.?re: servlet-api的基本類和其接口介紹
東西很多但是很抽象,迷糊中...
--sophia
5.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
謝謝謝謝 我也這樣 終于找到答案了
--amber
閱讀排行榜
1.?使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory(5501)
2.?String 轉 Date(2687)
3.?java.util下的Class Collections的兩種sort方法使用(2179)
4.?使用netbeans開發(fā)一個javabean程序(1956)
5.?使用commons-fileupload包進行文件上傳(1003)
評論排行榜
1.?使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory(4)
2.?servlet-api的基本類和其接口介紹(1)
3.?where 1=1(摘)(0)
4.?String 轉 Date(0)
5.?命名規(guī)則(0)
Powered by:
博客園
模板提供:
滬江博客
BlogJava
|
首頁
|
發(fā)新隨筆
|
發(fā)新文章
|
聯系
|
聚合
|
管理
JAVA連接MYSQL
首先當然要下載驅動,我用的是mysql-connector-java-5.0.4-bin.jar
public
?
class
?ConnectionFactory?
{????
????
public
?
static
?Connection?getConnection()
{
????????Connection?conn?
=
null
;????????
????????
try
?
{
????????????Class.forName(
"
com.mysql.jdbc.Driver
"
);
????????????conn?
=
DriverManager.getConnection(
"
jdbc:mysql://127.0.0.1:3306/st_storm?useUnicode=true&characterEncoding=utf-8
"
,
"
root
"
,?
""
);
????????}
?
catch
?(ClassNotFoundException?e)?
{
????????????System.out.println(
"
?No?class?
"
?
+
?
"
?found?error
"
);?e.printStackTrace();
????????}
?
catch
?(SQLException?e)?
{
????????????System.out.println(
"
Failed?to?get?connection?:
"
?
+
e.getMessage());?e.printStackTrace();
????????}
????????System.out.println(
"
conn==
"
+
conn);
????????
return
?conn;
????}
st_storm是我要連接的庫名
發(fā)表于 2006-11-27 01:29
蝦米
閱讀(432)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
主站蜘蛛池模板:
和政县
|
夏河县
|
大方县
|
高密市
|
盘山县
|
方城县
|
沙雅县
|
育儿
|
宣武区
|
定远县
|
夏津县
|
崇仁县
|
京山县
|
华池县
|
化德县
|
体育
|
松桃
|
镇坪县
|
许昌县
|
杨浦区
|
应用必备
|
亚东县
|
鹤山市
|
余姚市
|
民乐县
|
昭通市
|
瑞安市
|
绿春县
|
上虞市
|
宜宾县
|
徐水县
|
商河县
|
金沙县
|
彩票
|
寻乌县
|
衡阳县
|
大英县
|
独山县
|
兴化市
|
任丘市
|
乌兰察布市
|