惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Webroot Blog
Webroot Blog
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
Y
Y Combinator Blog
F
Fortinet All Blogs
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
博客园 - 【当耐特】
V
V2EX
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
GbyAI
GbyAI
美团技术团队
Jina AI
Jina AI
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
The GitHub Blog
The GitHub Blog
NISL@THU
NISL@THU
D
Docker
MyScale Blog
MyScale Blog
V
Vulnerabilities – Threatpost
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Schneier on Security
K
Kaspersky official blog
AWS News Blog
AWS News Blog
The Hacker News
The Hacker News
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Know Your Adversary
Know Your Adversary
L
LINUX DO - 热门话题
P
Privacy & Cybersecurity Law Blog
L
Lohrmann on Cybersecurity
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog

博客园 - 空空色色

转一篇,CentOS后台服务配置 linux kernel 2.6.36 编译升级 linux的UPNP支持(转) UPNP协议细节(转) UPnp协议 from wikipedia 考察智力zz JScollPane以及JPanel相关 bmp文件格式 java中对图象文件的处理(读写以及转换) Java媒体框架(JMF),个人很欣赏.... 常用颜色对照表 YUV/YIQ色彩空间的转换 关于Swing实现透明窗体的。我也很喜欢,收藏! A*以及迭代加深的A*算法(IDA*) 我的兄弟们之袋鼠篇 深度优先状态搜索法 我的兄弟们之温J篇 java中的图象处理技术基础 经典搜索算实现之一,广度优先.
java中的数据库程序应用
空空色色 · 2006-12-01 · via 博客园 - 空空色色

      简单的,分两步讨论。
(一)
      1.数据的准备,比较常用的是windows下的Acess工具,首先建立一个你自己的数据库文件,例如我们取名为datebase.mdb,打开后在里面创建表,一个或者多个(具体如何创建依自己喜好)。
      2.加载数据源,表建好之后,并不意味着一切已经完事,下面,打开我的电脑,控制面板,管理工具。数据源(ODBC),单击添加按钮,选择Microsoft Acess Driver(*mdb),单击完成。在弹出的对话框中键入你的数据源名mydata(可以任意)以及说明,然后单击选择按钮,找到你所创建的datebase.mdb文件并单击确定。并一路确定下去。这样。一个数据源就配置好了。
(二)
      java的连接数据库操作(以下为程序片段):
String str;
try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}//生成odbc数据库驱动实例
 catch(ClassNotFoundException e){}//捕捉异常
 Connection  con=DriverManager.getConnection("jdbc:odbc:mydata");//连接数据库
 Statement sql=con.createStatement();//生成操作对象
 ResultSet rs=sql.executeQuery(str);//数据库查询语句
 while(rs.next())//移动浮标
 {
    String id=rs.getString(3);//取当前浮标项的第三属性值并保存在id中 
   //添加其他代码………………
}
rs.close();//关闭浮标
值得注意之处在于,getConnection(datasource,user,passwords)如果有需要,我们要在参数中加入用户和密码两个值。

posted on 2006-12-01 22:12  空空色色  阅读(241)  评论()    收藏  举报