File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
JDBC and Relational Databases
Joined: Aug 19, 2007
Aug 27, 2007 02:22:00
First of all thanking you to all of members to sending response to
my previous doubts.
I have some problem with the following code.
Though it is compiling and running, it gives false results.
First of all CODE is:
public class sample
rs=st.executeQuery("select * from uin where NUM='"+ UIN +"'");
System.out.println("Record is already exist");
ps=con.prepareStatement("insert into uin values(?)");
System.out.println("Number inserted Successfully:");
public static void main(String args)
sample s=new sample();
The above code is working.It always displays "Record is already exist".
If i doesn't have any records in my database it always dispalys the above code.
But i doesn't know wheter it is coding problem or driver problem.
programs are working properly in my system.
please clarify my doubt.
Joined: Nov 29, 2005
Aug 27, 2007 03:56:00
resultset would never be null , even if it doesn't have any record in it.
For more information related to this check javadoc.
It is sorta covered in the
JavaRanch Style Guide
subject: JDBC Doubt
Doubt in the following code
Database access, potential threading problem?
doubt in update
Doubt in JDBC
Runtime.exec() in Java not working in Oracle 10 Application Server
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015