ROWSET ERROR

View: New views
1 Messages — Rating Filter:   Alert me  

ROWSET ERROR

by dacarr25 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

soy nuevo usando rowset aqui mi error y codigo alguna idea comunidad
****************ERROR**************************
>javac JdbcRowSetTest.java
JdbcRowSetTest.java:6: warning: com.sun.rowset.JdbcRowSetImpl is Sun proprietary API and may be removed in a future release
  import com.sun.rowset.JdbcRowSetImpl; // Sun's JdbcRowSet implementation
                       ^
JdbcRowSetTest.java:26: warning: com.sun.rowset.JdbcRowSetImpl is Sun proprietary API and may be removed in a future release
           JdbcRowSet rowSet = new JdbcRowSetImpl();  
***************CODIGO****************************
import java.sql.ResultSetMetaData;
  import java.sql.SQLException;
  import javax.sql.rowset.JdbcRowSet;  
  import com.sun.rowset.JdbcRowSetImpl;

  public class JdbcRowSetTest
  {
     // JDBC driver name and database URL
     static final String JDBC_DRIVER = "org.hsqldb.jdbcDriver";
     static final String DATABASE_URL = "jdbc:hsqldb:file:F:/texvo.0/dat/books";
     static final String USERNAME = "jhtp6";
     static final String PASSWORD = "jhtp6";

     public JdbcRowSetTest()
     {
        try
        {
           Class.forName( JDBC_DRIVER ); // load database driver class
 
           JdbcRowSet rowSet = new JdbcRowSetImpl();                
           rowSet.setUrl( DATABASE_URL ); // set database URL        
           rowSet.setUsername( USERNAME ); // set username          
           rowSet.setPassword( PASSWORD ); // set password          
           rowSet.setCommand( "create table survey (id int,name varchar(30))" ); // set query
           rowSet.setCommand( "insert into survey (id,name ) values (1,'valor1')" );
           rowSet.setCommand( "SELECT * FROM survey" );  
           rowSet.execute(); // execute query                        
 
           // process query results
           ResultSetMetaData metaData = rowSet.getMetaData();
           int numberOfColumns = metaData.getColumnCount();
           System.out.println( "survey .. . . ... :" );
 
           // display rowset header
           for ( int i = 1; i <= numberOfColumns; i++ )
              System.out.printf( "%-8s\t", metaData.getColumnName( i ) );
           System.out.println();
 
           // display each row
           while ( rowSet.next() )
           {
              for ( int i = 1; i <= numberOfColumns; i++ )
                 System.out.printf( "%-8s\t", rowSet.getObject( i ) );
              System.out.println();
           } // end while
        } // end try
        catch ( SQLException sqlException )
        {
           sqlException.printStackTrace();
           System.exit( 1 );
        } // end catch
        catch ( ClassNotFoundException classNotFound )
        {
           classNotFound.printStackTrace();
           System.exit( 1 );
        } // end catch
     } // end DisplayAuthors constructor
 
     // launch the application
     public static void main( String args[] )
     {
        JdbcRowSetTest window = new JdbcRowSetTest();
     } // end main
  } // end class JdbcRowSetTest