Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to chech result set is null or not
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sakthi
how to chech result set is null or not
1 Answer(s)      5 years and 11 months ago
Posted in : Java Beginners



Advertisement
View Answers

November 28, 2008 at 3:22 AM


Hi friend,

Code to help in solving the problem :

import java.sql.*;
public class CheckResultSet {
public static void main(String[] args) throws Exception {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/";;
String username = "root";
String password = "root";
String dbName= "dbName";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url+dbName, username, password);
System.out.println("Connected");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM table");
if(rs!=null)
{
System.out.println("ResultSet is not null");
}
st.close();
conn.close();
}
}

For more information on JDBC visit to :

http://www.roseindia.net/jdbc/

Thanks


Related Tutorials/Questions & Answers:
how to chech result set is null or not - Java Beginners
how to chech result set is null or not  Hi, really very thanks for fast reply.I want to know how to check whether the result set is null...("SELECT * FROM table"); if(rs!=null) { System.out.println
How to add a columns with a button set to a Jtable built with database result set
How to add a columns with a button set to a Jtable built with database result set  hi, i have to build a gui to display account numbers and account... that button column to the table which is built with database result set. i would thank
Advertisements
How can we find the number of rows in a result set using PHP?
How can we find the number of rows in a result set using PHP?   How can we find the number of rows in a result set using PHP
how to store the REsult Set values in array and loop through it in java?
how to store the REsult Set values in array and loop through it in java?  I have two tables Slink and Locate Slink has column name Slinkid ,locate.... how can i do
how to store the REsult Set values in array and loop through it in java?
how to store the REsult Set values in array and loop through it in java?  I have two tables Slink and Locate Slink has column name Slinkid ,locate.... how can i do
Sort Result set
Sort Result set   I build a connect for my page with the database... name is a hyperlink. also how to delete a row from the table? if I have... but please I need the easer one. for the both I don't know how to connect
Result=Set - Java Beginners
Result=Set  Hi Friend, Can u tell how to get the count of records... result set, first move the pointer from first record to last record and get... visible='v';"; rs=stmt.executeQuery(sqlstmt); How can i get the number of record
Hibernate Narrowing Criteria Result Set
Hibernate Narrowing Criteria Result Set In this tutorial you will learn how to narrow the Criteria result set. In Hibernate result set can be narrowed... how can you narrow the result set. For creating this example at first I have
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
Result Set one to many mapping
Result Set one to many mapping  Suppose there are 5 tables... Suppose result contains single entry of One record for A, Two records for B , three records for C , Four records for D and two records for E. Then how should
Spring Null value, Set null value in Springs configuration file
Spring Null value, Set null value in Springs configuration file In this example you will see how to set null value in the Spring configuration file... it will display output as shown below:     null Download
java.sql.SQLExceptioan: Before start of result set - JDBC
java.sql.SQLExceptioan: Before start of result set   java.sql.SQLException: Before start of result set?what do i do?   Hi Friend... accessing the result like the following: while(resultSet.next()){ String st
Null value when i set interface object in form controller - Spring
Null value when i set interface object in form controller   Hi all, i am very new about spring and hibernate. i got null value when i set... got NULL pointer exception ... please guide me if any one know ...it is very
how can i display a editable result of form?
how can i display a editable result of form?  how can i display a editable result of form? i know how to display form result but the result... show the result but i can not modify the result. how can i display modifyable
how to set class path
how to set class path  how to set class path in java
How to set the cursor to wait?
How to set the cursor to wait?  How to set the cursor to wait
How to set cookies?
How to set cookies?  How to set cookies
how to set image - EJB
how to set image   public ActionForward execute(ActionMapping mapping... in this pdf, how can i set pls help me sir, my image in E:/rose.jpg,how can... contains # report after result filling * process */ JasperPrint
how to set the values in jsp
how to set the values in jsp  how to set the values text boxs in jsp frm dbase via servlet
how to set background image
how to set background image  how to set image in background in that image i want over lay text how it possible in jsp? using flash image how it is overlayed in jsp page? thanks
how to sort the result of this 2 class program in java.....????
how to sort the result of this 2 class program in java.....????  package setget1_method; import java.util.Scanner; public class Main { { { Scanner input = new Scanner(System.in); LBook[] book = new LBook[5]; String
how set data in a dialog
how set data in a dialog  Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener...(instruction,BufferType.NORMAL); builder.setPositiveButton("pay", null
How to set NSZombieEnabled iPhone
How to set NSZombieEnabled iPhone  Hi, In my application I have to find and fix the object release issue. How to set NSZombieEnabled iPhone to find the bugs? Thanks   Hi, Please see the thread NSZombieEnabled iPhone
How to set target to videos??
How to set target to videos??  Hi, i am developing project in HTML 5 with videos so, i am dispalaing videos in two table coloumn,if the video in one coloumn is clicked,it should be played in another coloumn. plzz suggest any idea
how to set value of dropdown list
how to set value of dropdown list  Hello Sir, I'd solved the earlier... the value from a link to a dropdown list. I want to set the dropdown list selected...!=null && min1!=null && am1!=null) { str= "TIME
Advertisements
 

 

 

DMCA.com