由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Quick jdbc question, help needed, thx!
相关主题
MySQL JDBC 问题java后端开发
JDBC如何获取新加入的记录的索引JDBC/stored procedure读取性能问题
Java调用Oracle存储过程的问题Re: Desperately need help on DB2 connection through jdbc in jsp page
用jdbc从oracle pull out的row data怎么分页显示Re: 怎样才支持JDBC2.0?
How to get all tables in a schema in Oracle 9i using its JDBC driver?Re: Entity EJB: anyone with real experience
Java笔试题分享-Database巨量数据读取问题求助
newbie question发现weblogic 8.1 workshop一个bug
Java GC 为什么不能自动释放jdbc connection?How to connect to SQL2000?
相关话题的讨论汇总
话题: ibm话题: quick话题: table话题: question话题: empty
进入Java版参与讨论
1 (共1页)
s****e
发帖数: 68
1
hi, i want to first check whether the table in Access
is empty. if empty, create it, not, delete the data
and add new data. my code is like:
ResultSet rs = stmt.executeQuery("Select * from IBM");
//assume IBM is the table name in database
if(rs.next())
{...delete and add...}
else
{...create...}
My question is: the database is an empty one and when run
the program, java always complain that can not find table
IBM in the 1st sentence. How can i do about it? thanks a lot!!
z****g
发帖数: 2497
2
add a try catch block.
like this
try
{
// select * from IBM
if(rs.next())
{
//delete and add
}
}
catch()
{
//create table
}

【在 s****e 的大作中提到】
: hi, i want to first check whether the table in Access
: is empty. if empty, create it, not, delete the data
: and add new data. my code is like:
: ResultSet rs = stmt.executeQuery("Select * from IBM");
: //assume IBM is the table name in database
: if(rs.next())
: {...delete and add...}
: else
: {...create...}
: My question is: the database is an empty one and when run

N***m
发帖数: 4460
3
that's why we use hibernate.

【在 s****e 的大作中提到】
: hi, i want to first check whether the table in Access
: is empty. if empty, create it, not, delete the data
: and add new data. my code is like:
: ResultSet rs = stmt.executeQuery("Select * from IBM");
: //assume IBM is the table name in database
: if(rs.next())
: {...delete and add...}
: else
: {...create...}
: My question is: the database is an empty one and when run

1 (共1页)
进入Java版参与讨论
相关主题
How to connect to SQL2000?How to get all tables in a schema in Oracle 9i using its JDBC driver?
请问JSP/SERVLET和MYSQL如何实现照片上载和调用Java笔试题分享-Database
关于Exception,Catchnewbie question
关于java执行SQL之后的内存问题?Java GC 为什么不能自动释放jdbc connection?
MySQL JDBC 问题java后端开发
JDBC如何获取新加入的记录的索引JDBC/stored procedure读取性能问题
Java调用Oracle存储过程的问题Re: Desperately need help on DB2 connection through jdbc in jsp page
用jdbc从oracle pull out的row data怎么分页显示Re: 怎样才支持JDBC2.0?
相关话题的讨论汇总
话题: ibm话题: quick话题: table话题: question话题: empty