Package sun.jdbc.rowset

Examples of sun.jdbc.rowset.CachedRowSet


public class RowSetFactory extends Factory {

        public Object create( String type, Parameter[] parameters )
           throws Throwable {
                Connection conn = null;
                CachedRowSet crs = new CachedRowSet();
                RowSetFactoryMapping factoryMapping= ( RowSetFactoryMapping )getFactoryMapping();
                String dataSourceName = factoryMapping.getDataSource();

                DataSource dataSource = ((ServletServiceManager)getFactoryService().getServiceManager()).getStrutsDataSource( dataSourceName );
                       

                if( dataSource==null )
                        throw new ServletException( "DataSource '" +
                                   dataSourceName + "' not found!");

                try {
                        conn = dataSource.getConnection();

                        crs.setCommand( (String)parameters[0].getValue() );

                        for( int i = 1; i < parameters.length; i++ ) {
                                crs.setObject( i, parameters[i].getValue() );
                        }

                        crs.execute( conn );

                } catch ( SQLException e ) {
                        try {
                                conn.close();
                        } catch ( Exception t ) {
View Full Code Here


                PreparedStatement stmt = null;
                ResultSet rs = null;
                Integer offset = (Integer)parameters[1].getValue();
                Integer length = (Integer)parameters[2].getValue();
                int total = 0;
                CachedRowSet crs = new CachedRowSet();
                Slide slide = new Slide( length.intValue(),
                        offset.intValue(), new RowSetIterator( crs ) );
                RowSetFactoryMapping factoryMapping= ( RowSetFactoryMapping )getFactoryMapping();
                String dataSourceName = factoryMapping.getDataSource();
                DataSource dataSource = ((ServletServiceManager)getFactoryService().getServiceManager()).getStrutsDataSource( dataSourceName );

                if( dataSource==null )
                        throw new ServletException( "DataSource '" +
                                   dataSourceName + "' not found!");

                try {
                        conn = dataSource.getConnection();

                        stmt = conn.prepareStatement( (String)parameters[0].getValue() );

                        stmt.setMaxRows( slide.getOffset() + slide.getSlideLength() );

                        for( int i = 3; i < parameters.length; i++ ) {
                                stmt.setObject( i + 1, parameters[i].getValue() );
                        }

                        rs = stmt.executeQuery();
                       
                        for( int i = 0; i < slide.getOffset() - 1; i++, total++ ) rs.next();

                        crs.populate( rs );

                        rs.close();

                        stmt.close();
View Full Code Here

public class RowSetFactory extends Factory {

        public Object create( String type, Parameter[] parameters )
           throws Throwable {
                Connection conn = null;
                CachedRowSet crs = new CachedRowSet();
                RowSetFactoryMapping factoryMapping= ( RowSetFactoryMapping )getFactoryMapping();
                String dataSourceName = factoryMapping.getDataSource();

                DataSource dataSource = ((ServletServiceManager)getFactoryService().getServiceManager()).getStrutsDataSource( dataSourceName );
                       

                if( dataSource==null )
                        throw new ServletException( "DataSource '" +
                                   dataSourceName + "' not found!");

                try {
                        conn = dataSource.getConnection();

                        crs.setCommand( (String)parameters[0].getValue() );

                        for( int i = 1; i < parameters.length; i++ ) {
                                crs.setObject( i, parameters[i].getValue() );
                        }

                        crs.execute( conn );

                } catch ( SQLException e ) {
                        try {
                                conn.close();
                        } catch ( Exception t ) {
View Full Code Here

                PreparedStatement stmt = null;
                ResultSet rs = null;
                Integer offset = (Integer)parameters[1].getValue();
                Integer length = (Integer)parameters[2].getValue();
                int total = 0;
                CachedRowSet crs = new CachedRowSet();
                Slide slide = new Slide( length.intValue(),
                        offset.intValue(), new RowSetIterator( crs ) );
                RowSetFactoryMapping factoryMapping= ( RowSetFactoryMapping )getFactoryMapping();
                String dataSourceName = factoryMapping.getDataSource();
                DataSource dataSource = ((ServletServiceManager)getFactoryService().getServiceManager()).getStrutsDataSource( dataSourceName );

                if( dataSource==null )
                        throw new ServletException( "DataSource '" +
                                   dataSourceName + "' not found!");

                try {
                        conn = dataSource.getConnection();

                        stmt = conn.prepareStatement( (String)parameters[0].getValue() );

                        stmt.setMaxRows( slide.getOffset() + slide.getSlideLength() );

                        for( int i = 3; i < parameters.length; i++ ) {
                                stmt.setObject( i + 1, parameters[i].getValue() );
                        }

                        rs = stmt.executeQuery();
                       
                        for( int i = 0; i < slide.getOffset() - 1; i++, total++ ) rs.next();

                        crs.populate( rs );

                        rs.close();

                        stmt.close();
View Full Code Here

TOP

Related Classes of sun.jdbc.rowset.CachedRowSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.