Casting a JDBC resultSet to VO RowSet?

Is it possible to somehow transform a plain vanilla jdbc ResultSet to a VO RowSet? (Of course without iterating!) Either by passing the entire object (with all rows intact) or by casting?
Thanks
-Nat
PS. Rob, you know why I want to do this, right<g>?

We use JDBC to access the database internally. BC4J automates a best-practice use of JDBC PreparedStatements and ResultSet's for you without your having to worry about remembering the low-level details.
Our generic JDBC-interaction code worries about consistently applying the best-practice and highest-performance JDBC techniques for you. When we discover a further improvement and implement it, all of your view objects immediately benefit in the next release.
We had a team in Oracle Applications who claimed they could read large amounts of data faster with hand-coded JDBC than with BC4J. They weren't using BC4J in the optimal way and I illustrated by modifying their benchmark how to make BC4J be faster than hand-coded raw use of JDBC.
Their benchmark wasn't really comparing apples to apples, so I made sure they were comparing roughly equivalent amounts of work before we could conclude what was better.

Similar Messages

  • BUG JSF h:dataTable with JDBC ResultSet - only last column is updated

    I tried to create updatable h:dataTable tag with three h:inputText columns with JDBC ResultSet as data source. But what ever I did I have seceded to update only the last column in h:dataTable tag.
    My JSF page is:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1250"/>
    <title>Stevan</title>
    </head>
    <body><h:form>
    <p>
    <h:messages/>
    </p>
    <p>
    <h:dataTable value="#{tabela.people}" var = "record">
    <h:column>
    <f:facet name="header">
    <h:outputText value="PIN"/>
    </f:facet>
    <h:inputText value="#{record.PIN}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Surname"/>
    </f:facet>
    <h:inputText value="#{record.SURNAME}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:inputText value="#{record.NAME}"/>
    </h:column>
    </h:dataTable>
    </p>
    <h:commandButton value="Submit"/>
    </h:form></body>
    </html>
    </f:view>
    My java been is:
    package com.steva;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class tabela {
    private Connection conn;
    private ResultSet resultSet;
    public tabela() throws SQLException, ClassNotFoundException {
    Statement stmt;
    Class.forName("oracle.jdbc.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    resultSet = stmt.executeQuery("SELECT PIN, SURNAME, NAME FROM PERSON");
    public ResultSet getPeople() {
    return resultSet;
    I have instaled “Oracle Database 10g Express Edition Release 10.2.0.1.0” – product on my PC localy. I have enabled HR schema and I have instaled and pupulated with sample data folloving table:
    CREATE TABLE "PERSON"
    (     "PIN" VARCHAR2(20) NOT NULL ENABLE,
         "SURNAME" VARCHAR2(30),
         "NAME" VARCHAR2(30),
         CONSTRAINT "PERSON_PK" PRIMARY KEY ("PIN") ENABLE
    I have:
    Windows XP SP2
    Oracle JDeveloper Studio Edition Version 10.1.3.1.0.3894
    I am not shure why this works in that way, but I think that this is a BUG
    Thanks in advance.

    Hi,
    I am sorry because of formatting but while I am entering text looks fine but in preview it is all scrambled. I was looking on the Web for similar problems and I did not find anything similar. Its very simple sample and I could not believe that the problem is in SUN JSF library. I was thinking that problem is in some ResultSet parameter or in some specific Oracle implementation of JDBC thin driver. I did not try this sample on any other platform, database or programming tool. I am new in Java and JSF and I have some experience only with JDeveloper.
    Java been(session scope):
    package com.steva;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class tabela {
    private Connection conn;
    private ResultSet resultSet;
    public tabela() throws SQLException, ClassNotFoundException {
    Statement stmt;
    Class.forName("oracle.jdbc.OracleDriver");
    conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");
    stmt = conn.createStatement
    (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    resultSet = stmt.executeQuery("SELECT PIN, SURNAME, NAME FROM PERSON");
    public ResultSet getZaposleni() {
    return resultSet;
    JSF Page:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1250"/>
    <title>Stevan</title>
    </head>
    <body><h:form>
    <p>
    <h:messages/>
    </p>
    <p>
    <h:dataTable value="#{tabela.zaposleni}" var = "record">
    <h:column>
    <f:facet name="header">
    <h:outputText value="PIN"/>
    </f:facet>
    <h:inputText value="#{record.PIN}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Surname"/>
    </f:facet>
    <h:inputText value="#{record.SURNAME}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:inputText value="#{record.NAME}"/>
    </h:column>
    </h:dataTable>
    </p>
    <h:commandButton value="Submit"/>
    </h:form></body>
    </html>
    </f:view>

  • How to implement paging on SQLSERVER JDBC ResultSet?

    Dear experts,
    Please show me somre tips to implement paging on an JDBC resultset?
    Thanks in advanced.

    JSP pagination ? how many records per page ?

  • Using objects rather than jdbc resultset to fill reports

    Hi buddies!
    I�m developing a small sample of application that generates reports using values retrieved from objects.
    The idea is simple, I have an arraylist of objects and want to fill my report which these objects atributes.
    Jasper Project API has a class called JasperFillManager which is used to fill reports and takes 3 arguments, for instance:
    JasperFillManager.fillReport(JasperReport reporttofill,HashMap parameters, JRDataSource dataSource)
    I�ve created a custom JRDataSource named fonteDadosJasperCustomizada
    This class implements an arraylist of objects and two methods from the interface JRDataSource which are responsible for giving the values to fill the report. This class doesn�t take values from a resultset! ;)
    but for some reason nothing appears to me after executing the application... everything is alright I think the might be a mistake in the interface methods, the report also is alright.
    All sugestions are welcome
    thanks
    import java.sql.*;
    import java.util.HashMap;
    import java.util.Map;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.view.JasperViewer;
    public class relatorioteste1{
         public relatorioteste1(){
         try{     
              fonteDadosJasperCustomizada fonte = new fonteDadosJasperCustomizada();
              JasperDesign relatoriocarregado = JRXmlLoader.load("c:/relatorioteste1.jrxml");          
              JasperReport relatoriocompilado = JasperCompileManager.compileReport(relatoriocarregado);
              /*the parameter fonte being passed to fillManager is a custom JRDataSource.
              * The default JRResultSetDataSource only receives a JDBC ResultSet and
              * extracts Data from it to fill the Report, such Object is implements
              * the JRDataSource interface which defines methods that are used by
              * fillManager to obtain data from the ResultSet.
              * My intention is to create my own JRDataSource class which should
              * be able to retrieve data from objects instead of ResultSet
              * See class fonteDadosJasperCustomizada for details
              JasperPrint relatorioimpresso = JasperFillManager.fillReport(relatoriocompilado,new HashMap(),fonte);
              JasperViewer.viewReport(relatorioimpresso);
         catch(Exception e){
              javax.swing.JOptionPane.showMessageDialog(null, e.getMessage());
         public static void main(String args[]){
              new relatorioteste1();
    import net.sf.jasperreports.engine.JRDataSource;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.JRField;
    import java.util.ArrayList;
    public class fonteDadosJasperCustomizada implements JRDataSource {
         public Object getFieldValue(JRField arg0) throws JRException{
         /*The following line returns the next object(aluno) from
         * the arraylist collection
              Aluno aluno = (Aluno) dados.listIterator().next();
         /*This block verifies which column value(field) is being
         * requested by the jasperFillManager.fillReport and returns
         * an object value corresponding to the field
              if ("codigo".equals(arg0.getName()))
                   return Integer.valueOf(aluno.getCodigo());
              else if ("nome".equals(arg0.getName()))
                   return aluno.getNome();
              else
                   return Integer.valueOf(aluno.getIdade());     
              public boolean next() throws JRException{
              /*this decision verifies if there�re more elements in
              * the arraylist collection if so returns true... else returns
              * false
              if (dados.listIterator().hasNext())
                   return true;
              else
                   return false;
         public fonteDadosJasperCustomizada(){
              /*The constructor of my custom JRResulSetDataSource should receive
              * a JDBC ResultSet in place of an Arraylist of Objects
              * The atributes of each object is mapped to a field in
              * jasperreports template
              dados = new ArrayList();
              dados.add(new Aluno(1,"charlles cuba",25));
              dados.add(new Aluno(2,"Maicom napolle",25));
              dados.add(new Aluno(3,"Gustavo castro",21));          
         public static void main(String args[]){
              new fonteDadosJasperCustomizada();
         ArrayList dados;     
    }

    Buddies thansk everyone
    I�m really grateful... the previous post in here was very useful to me. I
    was wrong about ArrayList.listIterator.
    I finnaly generated a report from an arraylist of objects.
    Here�s the code... I made some changes the first one was wrong
    HERE IS MY MAIN CLASS RESPONSIBLE FOR GENERATING THE REPORT
    public class relatorioteste1{     
         public relatorioteste1(){
              try{     
                   fonteDadosJasperCustomizada fonte = new fonteDadosJasperCustomizada();
                   JasperDesign relatoriocarregado = JRXmlLoader.load("c:/relatorioteste1.jrxml");          
                   JasperReport relatoriocompilado = JasperCompileManager.compileReport(relatoriocarregado);                    
                   JasperPrint relatorioimpresso = JasperFillManager.fillReport(relatoriocompilado,new HashMap(),fonte);
                   JasperViewer.viewReport(relatorioimpresso);
              catch(Exception e){
                   javax.swing.JOptionPane.showMessageDialog(null, e.getMessage());
         public static void main(String args[]){
              new relatorioteste1();
    HERE IS MY CUSTOM JRDATASOURCE
    public class fonteDadosJasperCustomizada implements JRDataSource {
         public Object getFieldValue(JRField arg0) throws JRException{     
              if ("codigo".equals(arg0.getName()))
                   return Integer.valueOf(aluno.getCodigo());
              else if ("nome".equals(arg0.getName()))
                   return aluno.getNome();
              else
                   return Integer.valueOf(aluno.getIdade());
         public boolean next() throws JRException{
              if (iterator.hasNext()){
                   aluno = (Aluno) iterator.next();                    
                   return true;
              else
                   return false;          
         public fonteDadosJasperCustomizada(){          
              dados = new ArrayList();
              dados.add(new Aluno(1,"charlles cuba",25));
              dados.add(new Aluno(2,"Maicom napolle",25));
              dados.add(new Aluno(3,"Gustavo castro",21));
              iterator = dados.listIterator();
         public static void main(String args[]){
              new fonteDadosJasperCustomizada();
         ArrayList dados;
         Iterator iterator;
         Aluno aluno;
    }

  • Pass a jdbc resultset in to a Stored Procedure

    Any answer to the following question would be highly appreciated:
    How can we pass a jdbc resultset in to a Stored Procedure?
    Thanks.

    You could use Oracle's ANYDATASET type or declare schema TYPEs to support passing the data in a known structure. See "Working with Oracle Collections" in the "JDBC Developer's Guide and Reference" on technet.

  • NPE in com.mysql.jdbc.ResultSet

    hi guys,
    config: Connector/J 3.1.11 - mysql 5.0 - java 1.5
    is anybody has ever seen this exception??
    Caused by: java.lang.NullPointerException
            at com.mysql.jdbc.ResultSet.buildIndexMapping(ResultSet.java:597)
            at com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:905)
            at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4977)we've got this exception and we can't understand why!!
    the ResultSet class fragment...
    for (int i = numFields - 1; i >= 0; i--) {
              Integer index = new Integer(i);
              String columnName = this.fields.getName();
              String fullColumnName = this.fields[i].getFullName();
              if (columnName != null) {
                   this.columnNameToIndex.put(columnName, index);
                   this.columnNameToIndex.put(columnName.toUpperCase(), index);
                   this.columnNameToIndex.put(columnName.toLowerCase(), index); // <--- this line caused the exception
              if (fullColumnName != null) {
                   this.fullColumnNameToIndex.put(fullColumnName, index);
                   this.fullColumnNameToIndex.put(fullColumnName.toUpperCase(),
                             index);
                   this.fullColumnNameToIndex.put(fullColumnName.toLowerCase(),
                             index);
    i don't understand why it is possible. columnNameToIndex is protected and only accessed by the ResultSet class. it is in the buildIndexMapping() method and this method is called only in a synchronized method so ???
    any ideas??
    sup@reno

    Caused by: java.lang.NullPointerException
    at com.mysql.jdbc.ResultSet.buildIndexMapping(ResultSet.java:597)It's an open-source jdbc driver, which maintainted by Mysql. You can try to fix it, and recompile your Connector/J, or report simply Mysql that issue.

  • Creating XML from JDBC resultset

    Can anyone give me a pointer as the best way to create XML from a JDBC resultset. I have told that XSU cannot be used as it is vendor specific and ties us to Oracle (yawn, yawn).
    Any ideas welcomed.

    import javax.xml.parsers.*;
    import org.w3.dom.*;
    import javax.xml.dom.*;
    import javax.xml.dom.source.*;
    import javax.xml.dom.stream.*;
    import java.sql.*;
    public class CreateXML{
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db=dbf.newDocumentBuilder();
    Document doc=db.newDocument();
    Element root=doc.createElement("root_element");
    // coonect to database
    //get resultset metadata rsmd
    while(rs.next()){
    Element row=doc.createElement("row");
    for(int j=1;j<=rsmd.getColumnCount();j++){
    String colName=rsmd.getCoulmName(j);
    String colValue=rs.getString(j);
    Element e=doc.createElement(colName);
    e.appendChild(doc.createTextNode(colValue));
    row.appendChild(e);
    root.appendChild(row);
    doc.appendChild(root);
    //You can now use XSLT to generate xml file thus:
    TransformerFactory tmf=TransformerFactory.newInstance();
    Transformer tf=tmf.newTransformer();
    DOMSource source=new DOMSource(doc);
    StreamResult result=new StreamResult("name of file for output");
    tf.transform(source,result);
    // of course exceptions will have to be caught in this code.

  • Type cast weblogic.jdbc.wrapper.ResultSet to OracleResultSet

    Hello, I have a application using Spring 3.5 , Hibernate 3.6 and deployed over weblogic 10.3.4.
    This application running fine when i was using the c3po connection pooling, but when i switch to use the weblogic connection pooling, I started getting issues while retriving the XMLTYPE object from database.
    This issue what i am facing is when i am trying to type cast the weblogic wrapper resultset to Oracleresultset i am getting a type casting issue.
    Below is the code...
    Can anyone please help me to find out how to type cast the weblogic wrapper objects. I am stuck on this issue for more thn a week now.. Please help me..
    public Object nullSafeGet( ResultSet rs, String [ ] names, Object arg2 )
    throws HibernateException, SQLException
         System.out.println("rs ========= "+rs.getClass());
    System.out.println("rs ========= "+rs.getClass().getName());
    weblogic.jdbc.wrapper.ResultSet wlsResultSet = (weblogic.jdbc.wrapper.ResultSet) rs;
    System.out.println("wlsResultSet ========= "+wlsResultSet.getClass().getName());
    OracleResultSet oracleResultSet = (OracleResultSet) wlsResultSet.getVendorObj();
    System.out.println("ors ========= "+oracleResultSet.getClass().getName());
    XMLType xmlType = XMLType.createXML(oracleResultSet.getOPAQUE(names[0]));
         //XMLType xmlType = (XMLType)rs.getObject(names[0]);
    return (xmlType != null)?xmlType.getDOM():null;
    }

    Wrong forum, try WebLogic Server - General
    Frank

  • Problem with JDBC resultset

    Hello everyone:
    I'm using JDBC to connect to SQL Server, normally after executeQuery();, it should return me a opened BaseResultSet in order that i can read datas by stream(next(), getColumn(),etc...) but sometimes it returns a BaseResultSet closed. (I detected it during the debugging by checking the value of the property "closed" in the object returned ), in this case it refused all the following operations with the exceptions "ResultSet has been closed".
    Does that sound normal? How to solve it ?
    Thanks a lot!!!!

    Did you close the underlying Statement or Connection objects? It might come back empty (e.g., next() returns false), but it should not come back already closed.
    - Saish

  • RMI & JDBC ResultSet

    I am developing a project
    The basic archeiecture is like this:
    a reporting tool
    a virtualDB
    a real DB
    the reporting tool request for data from virtualDB, the virtualDB actually fetch the result for it.
    The virtualDB is a remote object using RMI which can be called in the reporting tool(stub)
    the virtualDB is connecting to the real DB through JDBC-ODBC driver.
    Now comes the problem, when the virtualDB has the ResultSet which is return by JDBC-ODBC. I cannot pass the ResultSet from remote site to my reporting tool, at run time, it will throw NotSerializable Exception, I guess this is because the JDBC-ODBC ResultSet does not implement that interface.
    So is there any way I can solve this problem to allow the reporting tool(client) receive the ResultSet that VirtualDB has got???
    Thanks in advance, any comment would be a great help for me!!!

    I can think of two ways:
    I can unpack the resultset at the remote site, and repack them into a new ResultSet which implements the Serializble interface. However, in the case I still dont know how to let me client receive the new ResultSet, quite lost...
    Another way, write all datas into XML, and pass the XML from remote site to reporting tool. It can work, but I want it to be efficient. This way is not efficient enough for me, I guess, and I do not want the overhead of creating XML.

  • JDBC ResultSet and direct D/B access are returning different no. of rows

    I am testing a JDBC application, which is using a DataSource definition configured in Visual Admin under JDBC Connector node.
    This program gets the JDBC Connection via lookup thro' JNDIContext.
    What is interesting is I am getting different no. of rows from ResultSet compared to direct execution in the Query Analyser.
    SELECT DISTINCT IC.ship_to_num, IC.policy_type, IC.exp_date, IC.insurance_cert_id
    FROM site_user SU
    INNER JOIN user_bill_to UB ON SU.user_id = UB.user_id
    INNER JOIN insurance_cert IC ON UB.ship_to_num = IC.ship_to_num
    WHERE (DATEDIFF(dd, GETDATE(), IC.exp_date) <= 14)
    AND (DATEDIFF(dd, GETDATE(), IC.exp_date) > 5)
    AND IC.breaking_14_day_alert_date IS NULL
    AND (SU.customer_id = 'dealer') AND (SU.is_owner = '1')
    (3 in Qu.Analyser Vs. 0 from JDBC)
    Or
    SELECT * FROM message_target
    (405 in Qu.Analyser Vs. 380 from JDBC)
    I compared the JDBC program code results Vs. "DB Initialisation" tab result in Visual Admin tool Vs. Direct 'Query Analyser' of SQL Server results.
    The programmatic JDBC results are equal to "DB Initialisation" tab results !
    What is wrong here ?
    Any help is greately appreciated.
    Thanks,
    Prasad Nutalapati

    Hi Prasad,
    I have never experienced this problem, but after taking a quick look at the javadoc for some JDBC classes, I found something that may help. 
    Try looking into the <i>setMaxRows</i> method on the <i>Statement</i> class.  The URL below will take you to the complete javadoc for this class, however, here is the part that I believe relates to your problem:
    "...If the limit is exceeded, the excess rows are silently dropped." 
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html
    If you are not setting this limit explicitly in your code, the JDBC driver implementation may be using some default value. 
    Setting this value to zero means that there is no limit, so you may want to try that. 
    Kind regards,
    Mike

  • JDBC Resultset Problem with ORACLE 10.1.0.2

    Hello
    I have a problem with Petstore GenericCatalogDAO. java. The problem is the behaviour of the resultset object when retrieving data from the database.Below are two synareos one that
    works (when) hard coded and one that does not work when parameter values passed into the the result set.
    1. The code the WORKS.
    statement = connection.prepareStatement("select name from employee where a.name ='SMITH' order by name"
    ,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    resultSet = statement.executeQuery();
    resultSet.absolute(1);
    String s = resultSet.getString(1);
    The code that gives me a 'exhausted resultset' error which I think means no results
    String[] parameterValues = new String[] { "SMITH" };
    statement = connection.prepareStatement("select name from employee where a.name =? order by name ",
    ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    for (int i = 0; i < parameterValues.length; i++) {
    statement.setString(i + 1, parameterValues);
    resultSet = statement.executeQuery();
    resultSet.absolute(1);
    String s = resultSet.getString(1);
    There is obviously a problem using these named parametevalues with these preparedstatement resultset, Does anybody know anything about this and a fix for it????
    Cheers. Roger

    Roger,
    It's probably a mistake you made when posting your code, but your query string is incorrect it should be either:
    select name from employee where name = 'SMITH' order by nameor
    select a.name from employee a where a.name = 'SMITH' order by a.nameIn other words you have prefixed a column with a table alias but have not indicated a table alias in the query.
    Also, shouldn't your code be:
    for (int i = 0; i < parameterValues.length; i++) {
        statement.setString(i + 1, parameterValues[ i ]);
    }Or was the "[ i ]" part giving you trouble? (Since "[ i ]" -- without the spaces -- is treated as a text-formatting tag.)
    While I didn't try your specific query, I have no problem using "PreparedStatment"s with parameters.
    What is your environment? Mine is:
    Oracle 10g (10.1.0.4) database on Linux (Red Hat)
    JDK 1.4.2
    ojdbc14.jar JDBC driver (latest version)
    Good Luck,
    Avi.

  • Jdbc resultset problem

    Hi all
    i'm gtting a problem with the action listener event of my "Next" and "Previous" Jbuttons. The code that i have written makes the program search only for the next record and not further...and sameproblem for previous button.
    That is: If originally i'm on the 3rd record, when i press next it goes to 4th record and when i press next again nothing happens. The same applies to my previous event.
    Can anyone give me a hint on how to solve this problem?
    i post my code below:
    next.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt)
                        try{
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con = DriverManager.getConnection("jdbc:mysql:///Super","root","");
    Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    s.execute("SELECT * FROM tblcustomer");
         ResultSet rs = s.getResultSet();
         rs.next();
              cus.setText(rs.getString(1));
              fname.setText(rs.getString(2));
              lname.setText(rs.getString(3));
              txtadd.setText(rs.getString(4));
              txtcity.setText(rs.getString(5));
              txtcountry.setText(rs.getString(6));
              catch (Exception e)
              JOptionPane.showMessageDialog(null,"No further record available!");
    });

    thanx for your help but i still can't access the second record
    here is my code below, have a look at it:
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    final Connection conn=DriverManager.getConnection("jdbc:mysql:///Super", "root","");
    previous.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent evt)
                        try
                             final Statement s= conn.createStatement();
                        s.execute("SELECT * FROM tblcustomer");
              ResultSet rs = s.getResultSet();
                        if (!rs.isFirst())
                        while ( rs.previous() ){
                        rs.relative(-1);
                        cus.setText(rs.getString("Customer_ID"));
                        fname.setText(rs.getString("First_Name"));
                        lname.setText(rs.getString("Last_Name"));
                        txtadd.setText(rs.getString("Address"));
                        txtcity.setText(rs.getString("City"));
                        txtcountry.setText(rs.getString("Country"));
                        catch (Exception e)
              JOptionPane.showMessageDialog(null,"No further record available!");
              );

  • Looking for oracle JDBC driver that support Rowset

    I am using oracle driver "oracle.jdbc.OracleDriver" downloaded from oracle.com and i am using cached rowset in my program but my program gave me runtime error :
    Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.locatorsUpdateCopy()Z
    at com.sun.rowset.CachedRowSetImpl.execute(CachedRowSetImpl.java:757)
    at com.sun.rowset.CachedRowSetImpl.execute(CachedRowSetImpl.java:1385)
    at WebRowSetSample.main(WebRowSetSample.java:73)
    but if i used data driver provided by Data Direct "com.ddtek.jdbc.oracle.OracleDriver" then it is working fine but the problem is data direct driver is not free and cant be used in production server, so if anyone know any free driver that support oracle and rowset implementation or able to correct problem then plz help me out.
    thanks...

    Hi I am using latest driver from oracle site, but the problem is when i fire execute method of cahed rowset i throws error that i mentioned above, if you have any other driver than mail me on [email protected]

  • JDBC resultSet

    Hi,
    I have a resultSet and want to know how many rows there are. Is there a special command for this???

    Hi,
    I have the mySQL JDBC Driver 2.0.4 in my classpath. But the line
    ... connection.createStatement
    (ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY)
    causes a AbstractMethodError at runtime. I thought that JDBC2.0 is supported by this driver.
    What could be wrong???

Maybe you are looking for