Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 什么方法可以测试已经连接的数据库中有某个表啊?
我所爱

人啊!真累。



发贴: 24
积分: 0
于 2006-04-23 13:27 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
与数据库的连接已经成功.
什么方法可以测试已经连接的数据库中有某个表啊?



[img]http://list.mp3.baidu.com/list/images/tupic/funny_egaosucai01.jpg[/img]
********************
**** 我思故我在****
*******************

作者 Re:什么方法可以测试已经连接的数据库中有某个表啊? [Re:我所爱]
jiyunang





发贴: 18
积分: 11
于 2006-04-23 23:10 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
查询一下数据库系统表中的TABLES视图


作者 Re:什么方法可以测试已经连接的数据库中有某个表啊? [Re:我所爱]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-04-24 00:44 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Which database?


作者 Re:什么方法可以测试已经连接的数据库中有某个表啊? [Re:why]
bluepure

pureblue



发贴: 509
积分: 85
于 2006-04-24 08:59 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list


java.sql.Connection conn = null;//自己替换成泥已经获得的连接
java.sql.DatabaseMetaData dbmd=conn.getMetaData();//获取数据库相关信息
java.sql.ResultSet rs= dbmd.getTables(null,null,"yourtablename",new String[]{"TABLE"});//查询指定表名的表信息
while (rs.next()) {
System.out.println("表yourtablename存在!");
}



bluepure edited on 2006-04-24 09:21

作者 Re:什么方法可以测试已经连接的数据库中有某个表啊? [Re:why]
我所爱

人啊!真累。



发贴: 24
积分: 0
于 2006-04-24 09:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
why wrote:
Which database?


不好意思,数据库是mysql

谢谢楼上啊,我先试试去````````ing



[img]http://list.mp3.baidu.com/list/images/tupic/funny_egaosucai01.jpg[/img]
********************
**** 我思故我在****
*******************


flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923