By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,116 Members | 1,319 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,116 IT Pros & Developers. It's quick & easy.

hai i am new here.i have question,please give me reply as soon as possible

P: 1
i am working on java
this my code.i want to get the no.of records from database.

class Model{
public int records{
int count=0;
try{
Class.forName("org.postgresql.Driver");
con=DriverManager.getConnection("jdbc:postgresql://localhost:5432/samyu","samyu","samyu");
}catch(Exception e){
System.out.println(e.getMessage());
}//catch
try{
st=con.createStatement();
query="select count(*) from mail_details";
count=st.executeQuery(query); //here giving error
}catch(Exception e){
System.out.println(e.getMessage());
}
return count;
}
}//class

what is the solution for this.give reply.
May 8 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 534
Please read the Posting Guidelines at the top of the forum.
May 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.