GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  JDBC
Go To First  |  Previous Question  |  Next Question 
 JDBC  |  Question 130 of 135    Print  
wasNull() method to handle null database fields
which of the following methods eliminates the need to call wasNull() method to handle null database fields?

a)getObject()
b)getInt()
c)getString()
d)getFloat()
e)getNull()



  
Total Answers and Comments: 2 Last Update: April 11, 2008     Asked by: ravikumar3 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 10, 2008 09:48:50   #1  
kittupeddi Member Since: April 2008   Contribution: 3    

RE: wasNull() method to handle null database fields
There are two ways you can do this:

1> wasNull() method, which indicates the last column read was null or not.
ex: if(rs.wasNull()) { ... }

2> Use the getObject(xx); and compare the values:
   Object o = rs.getObject("xxx");
   if(o == null) { ... }

 
Is this answer useful? Yes | No
April 10, 2008 09:53:19   #2  
kittupeddi Member Since: April 2008   Contribution: 3    

RE: wasNull() method to handle null database fields
Two Ways:

1> Use the wasNull() method on the ResultSet.

2> Use the getObject() method on the ResultSet and do the Comparision.

 
Is this answer useful? Yes | No

 Related Questions

Answered by Jey on 2005-05-10 06:01:10: Here are the steps.  Using DriverManager: 1. Load the driver class using class.forName(driverclass) and class.forName() loads the driver class and 
Latest Answer : First we register the connection and after that we connect the database, in that we give to which database is connecting giving that  ipaddress ,port number,username and password . ...

Answered by Jey Ramasamy on 2005-05-10 05:50:07: Class.forName() is used to load the Driver class which is used to connect the application with Database. Here Driver class is a Java class provided by Database 
Latest Answer : Class.forName is used to create an instance of the driver and register with the DriverManager. ...

JDBC is a layer of abstraction that allows users to choose between databases. It allows you to change to a different database engine and to write to a single API. JDBC allows you to write database applications 
Latest Answer : JDBC is a core API of Java 1.1 and later which provides a standard set of interfaces to SQL-compliant databases. ...

One implementation interface for database manufacturers, the other implementation interface for application and applet writers. 
Latest Answer : JDBC has four major components:1.The JDBC API2.The JDBC Driver Manager3.The JDBC Test Suite4.The JDBC-ODBC Bridge      The first two components of JDBC,the JDBC API and the JDBC Driver Managermanages to connect to the database ...

Create an instance of a JDBC driver or load JDBC drivers through jdbc.driversRegister a driverSpecify a databaseOpen a database connectionSubmit a queryReceive results 
Latest Answer : import java.sql.*;class Type1 { public static void main(String[] args)throws Exception {  Connection c=null;  try  {    Driver d=new Driver("sun.jdbc.odbc.JdbcOdbc");     //or  ...

A Statement object is what sends your SQL statement to the DBMS. You simply create a Statement object and then execute it, supplying the appropriate execute method with the SQL statement you want to send. 
Latest Answer : Using Statement interface we can create JDBC statements as follows  Statement stmt=con.createStatement();here con is the connection object reference Different types of statements are Prepared Statement - whenever we want to execute single ...

First JDBC returns results in a ResultSet object, so we need to declare an instance of the class ResultSet to hold our results. The following code demonstrates declaring the ResultSet object rs.E.g.ResultSet 
Latest Answer : import java.sql.*;class JDBCtableread{ public static void main(String args[])throws Exception { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:dsn2";//dsn name Connection con=DriverManager.getConnection(url); ...

1.Statement (use createStatement method) 2. Prepared Statement (Use prepareStatement method) and 3. Callable Statement (Use prepareCall) 
Latest Answer : try {  Connection conn = DriverManager.getConnection("URL",'USER"."PWD");  //For Simple statement used for static query. Statement stmt = conn.createStatement();   //For a runtime / dynamic query .Where String is ...

SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something 

Another new feature in the JDBC 2.0 API is the ability to update rows in a result set using methods in the Java programming language rather than having to send an SQL command. But before you can take advantage 
Latest Answer : New Features of JDBC2.0To make a updateble resultset use,Resultset.CONCUR_UPDATABLE  ...


 Sponsored Links

 
Related Articles

Using XMLType for Handling XML Data in the Database

Using XMLType for Handling XML Data in the Database Being an object type XMLType can not only be used to store XML data in the database but also to operate on that data via its built in methods Regardless of the storage model you choose XMLType provides a set of XML specific methods to operate on XM
 

Using Oracle Database for Storing, Modifying, and Retrieving XML Data

Using Oracle Database for Storing Modifying and Retrieving XML Data With Oracle XML DB you have various XML storage and XML processing options allowing you to achieve the required level of performance and scalability One of the most interesting things about Oracle XML DB is that it allows you to per
 

Performing XSLT Transformations inside the Database

Performing XSLT Transformations inside the Database Now that you have the employees XSL stylesheet stored in the database and the xmlusr schema is permitted to access the hr employees table you can create a script that will instruct the database to build an HTML page based on the data stored in hr e
 

Moving All the XML Processing into the Database

Moving All the XML Processing into the Database In the preceding example the database server performs only a part of the XML processing while the rest is still performed by the PHP engine Specifically the database server generates an employees XML document based on the records from the hr employees
 

Performing XML Processing inside the Database

Performing XML Processing inside the Database When building XML enabled applications on top of Oracle there are many advantages to performing the XML processing inside the database when compared to performing it on the client The key advantages to perform XML processing inside the database are as fo
 

What is Common Data Modeling Method

Common Data Modeling is one of the core considerations when setting up a business data warehouse. Any serious company wanting to have a data warehouse will have to be first serious about data models. Building a data model takes time and it is not unusual for companies to spend two to five years just
 

What is Operational Database

Operational Database is the database-of-record, consisting of system-specific reference data and event data belonging to a transaction-update system. It may also contain system control data such as indicators, flags, and counters. The operational database is the source of data for the data warehouse
 

Evolution of database systems

The Evolution of Database systems File Management System Hierarchical database System  Network Database System  Relational Database System File Management System: The file management system also called as FMS in short is one in which all data is stored on a singl
 

Database Concurrency and Reliability

Database Concurrency and Reliability Overview Concurrency and reliability have long been “hot topics” of discussion among developers and users of distributed systems. The fundamental problem can be seen in a simple example, as follows. Suppose two users are working on the same
 

Database Interaction

Database Interaction Efficient interaction, efficient storage, and efficient processing are the three key properties of a successful database platform. In this article, we explore the first: efficient interaction. Interaction Category 1: Command Line Clients Many database platforms are shipped with
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape