jdbc inserting row ----java.lang.ArrayIndexOutOfBoundsException ---with resultset (TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE)
here is my bean code i want that when user user submit the form all data should be inserted and the id which is autonumber wiil be displayed to user. my database is like this id ---autoincriment name-text age number date -date/time all going right but when the save method is called the exception ArryOutOfBoundException is generated why ??? please help my bean is like this import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class Bean1 extends JFrame { Connection con; Statement stat; ResultSet rs; String Name; int age; java.sql.Date date; public Bean1() { try { Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) ; con = DriverManager.getConnection(jdbc:odbc:data,,) ; stat = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATAB LE) ; rs = stat.executeQuery(select * from data); rs.beforeFirst() ; } catch(Exception e) { e.printStackTrace(); } } public new(){ this.rs.moveToInsertRow(); } public save(){ rs.updateString(Name,this.Name ) ; rs.updateInt(Age,age ) ; rs.updateString(Date,date) ; this.rs.insertRow() ; } } the exception is java.lang.ArrayIndexOutOfBoundsException at sun.jdbc.odbc.JdbcOdbcResultSet.bindCol(JdbcOdbcResultSet.java:4485) at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:3941) === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: jdbc inserting row ----java.lang.ArrayIndexOutOfBoundsException ---with resultset (TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE)
You'll probably find that the JdbcOdbcDriver isn't going to be JDBC 2.0 compliant in that it more than likely won't support scrollable cursors. I suggest you stay far away from this driver. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Niraj Soni Sent: Thursday, April 19, 2001 4:49 AM To: [EMAIL PROTECTED] Subject: jdbc inserting row java.lang.ArrayIndexOutOfBoundsException ---with resultset (TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE) here is my bean code i want that when user user submit the form all data should be inserted and the id which is autonumber wiil be displayed to user. my database is like this id ---autoincriment name-text age number date -date/time all going right but when the save method is called the exception ArryOutOfBoundException is generated why ??? please help my bean is like this import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class Bean1 extends JFrame { Connection con; Statement stat; ResultSet rs; String Name; int age; java.sql.Date date; public Bean1() { try { Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) ; con = DriverManager.getConnection(jdbc:odbc:data,,) ; stat = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONC UR_UPDATAB LE) ; rs = stat.executeQuery(select * from data); rs.beforeFirst() ; } catch(Exception e) { e.printStackTrace(); } } public new(){ this.rs.moveToInsertRow(); } public save(){ rs.updateString(Name,this.Name ) ; rs.updateInt(Age,age ) ; rs.updateString(Date,date) ; this.rs.insertRow() ; } } the exception is java.lang.ArrayIndexOutOfBoundsException at sun.jdbc.odbc.JdbcOdbcResultSet.bindCol(JdbcOdbcResultSet.java:4485) at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:3941) == = To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
Re: jdbc inserting row ----java.lang.ArrayIndexOutOfBoundsException ---with resultset (TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE)
Agreedit's horribleand will drive you crazy with all of the thrown exceptions .. Get the improved version from JDataConnect it's great ! -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Robert Nicholson Sent: Tuesday, April 24, 2001 4:07 PM To: [EMAIL PROTECTED] Subject: Re: jdbc inserting row java.lang.ArrayIndexOutOfBoundsException ---with resultset (TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE) You'll probably find that the JdbcOdbcDriver isn't going to be JDBC 2.0 compliant in that it more than likely won't support scrollable cursors. I suggest you stay far away from this driver. -Original Message- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Niraj Soni Sent: Thursday, April 19, 2001 4:49 AM To: [EMAIL PROTECTED] Subject: jdbc inserting row java.lang.ArrayIndexOutOfBoundsException ---with resultset (TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE) here is my bean code i want that when user user submit the form all data should be inserted and the id which is autonumber wiil be displayed to user. my database is like this id ---autoincriment name-text age number date -date/time all going right but when the save method is called the exception ArryOutOfBoundException is generated why ??? please help my bean is like this import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class Bean1 extends JFrame { Connection con; Statement stat; ResultSet rs; String Name; int age; java.sql.Date date; public Bean1() { try { Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) ; con = DriverManager.getConnection(jdbc:odbc:data,,) ; stat = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONC UR_UPDATAB LE) ; rs = stat.executeQuery(select * from data); rs.beforeFirst() ; } catch(Exception e) { e.printStackTrace(); } } public new(){ this.rs.moveToInsertRow(); } public save(){ rs.updateString(Name,this.Name ) ; rs.updateInt(Age,age ) ; rs.updateString(Date,date) ; this.rs.insertRow() ; } } the exception is java.lang.ArrayIndexOutOfBoundsException at sun.jdbc.odbc.JdbcOdbcResultSet.bindCol(JdbcOdbcResultSet.java:4485) at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:3941) == = To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets == = To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets === To unsubscribe: mailto [EMAIL PROTECTED] with body: signoff JSP-INTEREST. For digest: mailto [EMAIL PROTECTED] with body: set JSP-INTEREST DIGEST. Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets