tailieunhanh - Java Database Programming Bible- P10

Java Database Programming Bible- P10: Welcome to Java Database Programming Bible. This book is for readers who are already familiar with Java, and who want to know more about working with databases. The JDBC Application Programming Interface has made database programming an important aspect of Java development, particularly where Web applications are concerned. | Chapter i8 Using Rowsets to Display Data when the method is called. A RowSet is made updatable by setting its concurrency property to . Once you have an updatable RowSet you can insert a new row delete an existing row or modify one or more column values. Since requesting an updatable Rowset does not guarantee that you will actually get one you should check whether the Rowset is updatable by using . Listing 18-3 illustrates the use of the method to make a RowSet updatable and the use of to ensure that the RowSet actually is updatable. Listing 18-3 Making a RowSet updatable package import . import public class JDBCUpdatableRowSet public static void main String argv String url jdbc inetdae7 localhost 1433 database LEDES String login jod . String password jod try .newInstance JDBCRowSet rowSet new JDBCRowSet set url login and password url login password make the rowset scrollable and updatable set the sql command SELECT ID FName LName EMail FROM CONTACTS WHERE FName Ichabod execute the command -451- Team-Fly Please purchase PDF Split-Merge on to remove this watermark. Chapter i8 Using Rowsets to Display Data check whether the RowSet can be updated if Rowset is UPDATABLE else Rowset is READ_ONLY update the record and output it to the console while FName Igor for int j 1 j .getColumnCount j j t catch Exception e .

TỪ KHÓA LIÊN QUAN