PLEASE help me with this error java.sql.SQLException

The code
public void getInitialQuery() {         try {             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");             con = DriverManager.getConnection("jdbc:odbc:PDefApp1");             sta = con.createStatement();             System.out.println(SQLQuery);             res = setupSQLConnection(SQLQuery);             getRecordSet(res);
private void getRecordSet(ResultSet r) {                try {             jTextRecordNumberField.setText(String.valueOf(r.getInt("id")));             jTextFirstNameField.setText(r.getString(2));             jTextMiddleNameField.setText(r.getString(3));             jTextLastNameField.setText(r.getString(4));             jTextDateOfBirthField.setText(r.getString(5));             jTextAKAField.setText(r.getString(6));             jComboBoxChargingDocument.setSelectedItem(r.getString(7));             jTextAreaChargingNumber.setText(r.getString(8));             jComboBoxDecision.setSelectedItem(r.getString(9));             jComboBoxDefendentStatus.setSelectedItem(r.getString(10));             jComboBoxOriginatingUnit.setSelectedItem(r.getString(11));             jTextFieldApplicationDate.setText(r.getString(12));             jTextFieldDecisionDate.setText(r.getString(13));             jTextFieldDeliveryDate.setText(r.getString(14));             jTextAreaComments.setText(r.getString(15));         } catch (Exception e) {             System.err.println("getRecordSet Exception: " + e.getMessage());             e.printStackTrace();         }             }
The crash occurs in getRecordSet(ResultSet r) method and it occurs on ANY line. I've commented each line to see where it occurs.
The crash says the following
run: SELECT * FROM Table1 ORDER BY id ASC setupSQLQuery: SELECT * FROM Table1 ORDER BY id ASC getRecordSet Exception: [Microsoft][ODBC Driver Manager] Invalid cursor state java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)         at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)         at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5698)         at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:354)         at publicdesktopapplication.PublicDesktopView.getRecordSet(PublicDesktopView.java:1411)         at publicdesktopapplication.PublicDesktopView.getInitialQuery(PublicDesktopView.java:1377)         at publicdesktopapplication.PublicDesktopView.<init>(PublicDefenderView.java:89)         at publicdesktopapplication.PublicDesktopApplication.startup(PublicDesktopApplication.java:19)         at org.jdesktop.application.Application$1.run(Application.java:171)         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
I am very confused why this is crashing on me. It didnt crash in the older version of this application.
Please help!

Don't do this either
SELECT * FROM Table1 Explictly name the columns in the order that you are going to fetch them. This makes your code easier to follow later and as side benefit prevents any changes in the column ordering from blowing your code to smitheens.
And I do hope your table is not in fact called Table1.

Similar Messages

  • Could someone help me with this error: java.sql.SQLException: Closed Connec

    My code:
    <%@ include file="../setupcache.jsp"%>
    <%
    if(connectionPool_dig==null){
    %>
    <p>Could not connect to database. Please try again, thank!</p>
    <%          
         return ;
    Connection con = connectionPool_dig.getConnection();
    if(con==null){
    %>
    <p>Could not connect to database. Please try again, thank!</p>
    <%          
         return;
         String file = request.getParameter("m_FILE");
              file = "a";
         String sql = " SELECT *"+
              " FROM "+
              " FILEUPLOAD, SUBJECT"+
              " WHERE "+
              " FILEUPLOAD.SUBJECTCODE = SUBJECT.CODE AND UPPER(FILEUPLOAD.FILENAME) LIKE(UPPER(?))";
         PreparedStatement stmt = con.prepareStatement(sql);
         stmt.setString(1,"%"+file+"%");
         ResultSet rs = stmt.executeQuery();
         while(rs.next()){
              out.println("<br>"+rs.getString(1));
              out.println("<br>"+rs.getString(2));
              out.println("<br>"+rs.getString(3));
              out.println("<br>"+rs.getString(4));
         rs.close();
         stmt.close();
    try{
         con.close();
    }catch(SQLException e){}
    %>
    it usualy generate that error (once wrong then right then wrong....), but if I don't close connection (con.close), it work well. Could some one help me!

    Hi,
    I think that it should be better that returning the Connection
    instance back to the Connection Pool. The connection
    should not be close by you. it should controlled by the
    connection pool mechanism. So I think that you should
    check out your connection pool usage document for the
    right usage.
    If your code is the case, the connection in connection
    pool will get less and your connection pool mechanism
    may need to reallocate a new one for application. I
    don't think that it is right.
    good luck,
    Alfred Wu

  • Please help me with this error: "Apple application support was not found... Error 2"

    Can anyone please help me with this error: "Apple application support was not found... Error 2"
    I've followed the instructions by removing all Apple files from my laptop, but when I reinstall the iTunes software it still comes up with this message:
    "Apple application support is required to run iTunesHelper. Please uninstall iTunes, then install iTunes again. Error 2"
    Thank you

    iTunes "Apple Application Support is required... Error 2" and possible fix.
    I know this is a bit late but I came accross this thread trying to resolve this same problem and came up with a solution that worked for me, so thought I would share it here too. I hope it helps someone else.
    I just resolved this on Win Vista (should apply equally for Win7 too). Please uninstall iTunes before proceeding though. I'll walk you through the process I followed, if you like you can jump straight to the Solution section.
    Problems:
    The initial error during the installation of iTunes was:
    An error occurred during the installation of assembly 'Microsoft.VC80.CRT,version="8.0.50727.4053",type="win32",publicKeyToken='1fc8b 3b9a1e18e3b",processorarchitecture="x86". Please refer to Help and Support for more information. HRESULT:0x8007054F
    The error (after installing iTunes) when trying to run iTunes was:
    Apple Application Support is required to run iTunes. Please uninstall iTunes, then install iTunes again. Error 2 (Windows error 2).
    After trying various fixes around the forums I came across this MSKB article, which relates to the first installation error:
    http://support.microsoft.com/kb/2688946
    This lead me to trying to install MS Visual C++ but I received the following error trying to install that:
    Error 1935.An error occurred during the installation of assembly ‘Microsoft.VC80.ATL,type=”win32”,version=”8.0.50727.762”,publicKeyToken=”1fc8b3 b9a1e18e3b”,processorArchitecture=”amd64”’. Please refer to Help and Support for more information. HRESULT: 0x80070BC9. Assembly interface: IassemblyCacheItem, function: Commit, component: {837BF1EB-D770-94EB-A01F-C8B3B9A1E18E}
    Note: The installation of VC++ rolls back when it fails.
    Solution:
    Through this error I found this MSKB article:
    http://support.microsoft.com/kb/946414
    The Automated MS "Fix It" msi package didn’t work.
    Note: Please backup your registry first (see the above MSKB article for instructions).
    I opened the registry and (as instructed in the MSKB article) deleted the following keys:
    HKEY_LOCAL_MACHINE\COMPONENTS\
    PendingXmlIdentifier
    NextQueueEntryIndex
    AdvancedInstallersNeedResolving
    Reboot and reinstall iTunes.
    If it helps you please like this so others can find it.

  • Itunes could not connect to the iphone an unknown error occurred 0xE8000003 please help me with this error any one have idea ?

    itunes could not connect to the iphone an unknown error occurred 0xE8000003 please help me with this error any one have idea ?

    http://support.apple.com/kb/ts3221

  • What may be the cause of this error java.sql.SQLException: invalid sql type passed to callable statement in iplanet ussing JNDI

     

    Hi,
    The possibilities can be of various reasons, with the sql statements,
    xml descriptors, data sources, improper drivers anything. To crack down
    the solution, kindly let me know the error messages and what exactly are
    you trying to accomplish.
    Thanks & Regards
    Raj
    manimaran t wrote:
    what may be the cause of this error java.sql.SQLException: invalid sql
    type passed to callable statement in iplanet ussing JNDI
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Please help me with this error I keep getting for attachments

    please help me with my error message as I can't download attachments

    Some information would be helpful...  operating system, email client, Reader version, error message, ...

  • What is this error java.sql.SQLException: Bad format for number ?

    Dear All,
    I am reading few values from database. Then I get this error "MyError:Error : java.sql.SQLException: Bad format for number 'Sarawak' in column 6. " So what is this error referring to. I have checked the database column and its value fits according the data type. Any hints please?

    I have checked the database column and its value fits according the data type.Check again. Then check again. Keep checking until you find your error. You are trying to read a string containing "Sarawak" as a number. You have "getInt(6)" or other numeric type, and the 6th column in the select statement is not numeric.

  • Pleasse help me with this error in SQL statement

    Please tell me the error in this query:
    the Error given is
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
    given :
    Databse is MS Access
    In the databse :
    account - text
    number - text
    date - date/time
    vendor - text
    Connection connection = t.getConnection();
    /* t - some object containing a connection*/
    Statement stmt = connection.createStatement();
    stmt.executeUpdate("INSERT INTO Bills (account, number, date, vendor)
    VALUES ('vai', '23', 10/12/2006, 'jaadya')");

    I would imagine the problem is with the date. Different DBs have different date formats. To avoid that problem, use a PreparedStatement.
    java.sql.Date date = ...;
    PreparedStatement ps = con.prepareStatement("INSERT INTO Bills (account, number, date, vendor) VALUES (?, ?, ?, ?)");
    ps.setString(1, "vai");
    ps.setString(2, "23);
    ps.setDate(3, date);
    ps.setString(4, "jaadya");
    ps.executeUpdate();This saves you from having to deal with vendors' various date formats, keeps you from having to escape special characters in strings, and prevents SQL injection.

  • Please help me with this error message on my lost Crashed Thread:  1  Dispatch queue: NSOperationQueue Serial Queue  Exception Type:  EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000

    I was organizing my contatcs when suddenly it disappeared and got this error message.

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    For this step, the title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    In the top right corner of the Console window, there's a search box labeled Filter. Initially the words "String Matching" are shown in that box. Enter the name of the crashed application or process. For example, if iTunes crashed, you would enter "iTunes" (without the quotes.)
    Each message in the log begins with the date and time when it was entered. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    ☞ The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    ☞ Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ User Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of crash reports. The name of each report starts with the name of the process, and ends with ".crash". Select the most recent report related to the process in question. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.
    If you don't see any reports listed, but you know there was a crash, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report—they're very long and rarely helpful.

  • Please Help Me with this error

    It only works if the button is presses once. if you try to add other data to be shown under the first data that you inputted. the program crash and gives and error  
    This is my code for the Class:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace WpfApplication3
        class Person
            private Queue<string> Name = new Queue<string>();
            private Queue<string> Surname = new Queue<string>();
            private Queue<string> Course = new Queue<string>();
            private Queue<int> CRNumber = new Queue<int>();
            public string name
                get
                    return Name.Peek();
                set
                    Name.Enqueue(value);
            public string surname
                get
                    return Surname.Peek();
                set
                    Surname.Enqueue(value);
            public string course
                get
                    return Course.Peek();
                set
                    Course.Enqueue(value);
            public int crnumber
                get
                    return CRNumber.Peek();
                set
                    CRNumber.Enqueue(value);
            public void Constructor()
                Name.Enqueue("default");
                Surname.Enqueue("default");
                Course.Enqueue("default");
                CRNumber.Enqueue(0);
            public void Constructor(string name, string surname, string course, int crnumber)
                Name.Enqueue(name);
                Surname.Enqueue(surname);
                Course.Enqueue(course);
                CRNumber.Enqueue(crnumber);
            public String View(int Count)
                int i = 0;
                string Output = "";
                while (i <= Count)
                    Output += "Student Info : " + "\n" + "Name : " + Name.Dequeue() + "\n" + "Surname : " + Surname.Dequeue() + "\n"
    + "Course : " + Course.Dequeue() + "\n" + "Class room number : " + Convert.ToString(CRNumber.Dequeue()) + "\n";
                    i++;
                return Output;
    And this is my MainWindow code where i try to call the class:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    namespace WpfApplication3
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            public MainWindow()
                InitializeComponent();
            int Count = 0;
            private void AddButton_Click(object sender, RoutedEventArgs e)
                Person Student = new Person();
                Student.Constructor(txtBox1.Text, txtBox2.Text, txtBox3.Text, Convert.ToInt32(txtBox4.Text));
                TextBlock1.Text = Student.View(Count);
                //TextBlock.Text = Student.View(Count);
                Count++;
    Please Help as soon as possible.

    Hi Joubert,
    The problem is clear. In this piece of code:
    while (i <= Count)
    Output += "Student Info : " + "\n" + "Name : " + Name.Dequeue() + "\n" + "Surname : " + Surname.Dequeue() + "\n" + "Course : " + Course.Dequeue() + "\n" + "Class room number : " + Convert.ToString(CRNumber.Dequeue()) + "\n";
    i++;
    You are calling the Dequeue() operation from the queues. Dequeue() will remove the next element and return it.
    When you click the button the second time, the while loop will be carried out two times. The second time, it tries to dequeue but there is nothing in the queue. That is why you get the exception.
    Also, your code looks very messy to me. I do not think the queues are appropriate collections for what you are trying to do. There are a couple of things wrong here.
    If you provide some info on what your goals is, I could give you some pointers on what to fix.
    Rgds MM
    PS: Pls mark as answer if helpful. Thanks!

  • Please help me with this error i see when i open firefox on my android phone after installation !

    after i install any version of firefox on my htc chacha (android 2.3),when i open firefox,in some versions of firefox i get this error: "the application firefox (process org.mozilla.firefox) has stopped unexpectedly.please try again."
    and when i try again i get the same error again and again
    in some other versions i get this error: " this device does not meet the minimum system requirements for firefox"
    btw i can not install any program from android market so i have to download files through my pc and install them on my phone

    The reason why your phone will not install Firefox from Market is because it has a older ARMv6 cpu when ARMv7 is required.
    The good news is that Mozilla is looking to try and have ARMv6 builds of mobile Firefox releases in future. Your phone looks to have reasonable specs to run it then.
    Another option is to try the third-party builds from http://forum.xda-developers.com/showthread.php?p=25855563

  • Please help me with this error message

    when I try to restore/update my iPod I get this error message:
    "There was a problem downloading the iPod software for the iPod "_______". You do not have enough access priviledges for this operation.
    Make sure your network settings are correct and your netwrok conection is active, or try again later."

    when I try to restore/update my iPod I get this error message:
    "There was a problem downloading the iPod software for the iPod "_______". You do not have enough access priviledges for this operation.
    Make sure your network settings are correct and your netwrok conection is active, or try again later."

  • Please help me with this error in this code snippet!

    Code Snippet:
    REPORT  ZMKTEST6.
    data : f1(2) type c,
           f2(2) type c,
           f3(10) type n value '12345'.
      clear: f1 with 'X',
             f2 with f1,
             f3 with '3'.
    write :/ f1 ,f2, f3.
    Process Error:
    The field "F1" must have the length 1.

    hi ,
    ther is not syntax with clear with 'X".
    but you can do one thing to get the one character.
    REPORT ZMKTEST6.
    data : f1(2) type c,
    f2(2) type c,
    f3(10) type n value '12345'.
    clear: f1 with 'X',  "Comment this
    f1 = f1+0(1).        "write this
    f2 with f1,
    f3 with '3'.
    write :/ f1 ,f2, f3.
    now f1 containd one charater instead of 2.
    now you can display as usuall

  • Can anyone please help me with this error I am getting from my application

    javax.servlet.ServletException: Index: 0, Size: 0
         at com.evermind.server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:595)
         at com.evermind.server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:537)
         at jsp.edit__service._jspService(edit_service.jsp:117)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:356)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:847)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:229)
         at mil.usmc.m4l.servlets.M4LServlet.forward(M4LServlet.java:34)
         at mil.usmc.m4l.servlets.EditService.doGet(EditService.java:175)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at mil.usmc.m4l.filters.M4LCMSFilter.doFilter(M4LCMSFilter.java:150)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:673)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)

    user,
    my computer doesn't work, can you fix it?
    You've not provided any information whatsoever that would help someone help you solve your problem. What version of JDeveloper are you using? What technologies? What are you trying to do that is not working? You really need to be a bit more explicit with your questions.
    John

  • Please Help me with the error P6

    I recently installed the Primavera P6 but when I started
    using it for the first time I get the following error
    message :
    C:\Program files\Primavera\Project
    Management\Languages\comCaptions.en-us
    <br
    />Please help me with this error ;
    Thanks

    Hi,
    This sounds like an issue
    that might best be handled by support. You can find
    information on contacting support here:<br
    /><br
    />http://www.primavera.com/customer/support.asp<br
    />
    Thanks,
    Sean

Maybe you are looking for

  • Camera Raw 5.7/Lightroom 2.7 question

    Does Lightroom use the Camera Raw that's in Library>Application Support>Adobe>Plugins>CS4?  What I mean is, is that one Camera Raw plugin used both by Photoshop CS4 and Lightroom 2.7, or does Lightroom install another copy somewhere else for its own

  • Mac Mini Media Centre query

    Hi all... just have 1 simple question to ask. If i was to use a Mac Mini purely as a media centre to my Sony Bravia, would the basic spec from the store be sufficient (excluding hard drive space - which i will buy external)? i only plan to watch movi

  • Travel Advance

    Dear All I have a requirement. In SAP Travel Management, the standard setting for travel advance is that the amount is an offset to the receipts. For example lets assume that an employee takes an advance of 5000 before travelling. After travelling, w

  • Why does it: resize containers

    Some containers resize to accommodate different sized content and some do not.  For example, a canvas in a panel will get larger if the content gets larger (due to a larger font).  But at other times it doesn't. Can anyone please explain what will ge

  • Looking to Hire As3 / Java Programmer for Game Startup in NJ

    This is a great opportunity for a skilled actionscript 3 coder to create great games in a startup backed by Kickstarter in Hackensack, NJ. Position is on-site. Some with online multiplayer experience preferred (specifically Electroserver 5). http://w