Error: COUNT field incorrect in jdbc

hello
please help me out!!!!!! am trying to retrive data (ID) which was updated before in this program. now am getting error:COUNT field incorrect. and can it be displayed by using JOptionPane?
pst=con.prepareStatement("select ID from db1 where NAME=?,EMAIL=?");
ResultSet rs=pst.executeQuery();
while(rs.next()){
  System.out.println(rs.getString(0));

pawankarra wrote:
thnx for ur replay.........This should read:
Thanks for your reply.Notice the corrected spelling of three of the four words in the sentence (you could have misspelled all of them by using "4" instead of "for") and the use of only one period/fullstop at the end of the sentence.
In reply to your original question, the column numbers in JDBC start at 1, not at 0. So this line of code is the problem:
System.out.println(rs.getString(0));It should read:
System.out.println(rs.getString(1));And, being an autogenerated column, isn't it a numeric value? Do you really want to read it as a String?

Similar Messages

  • How can I resolve Exception : "Count Field Incorrect" error

    Hi all,
    I am experiencing with "Count Field incorrect" error. What's wrong with it? How can I resolve it?
    This error is occured at UPDATE function of SQL. My JSP page is to update the old record.
    Sometimes, "Update statement error" message appear. These two problems I always confusing.
    What are the possible point of these error in my Java file and JSP page? I use package import to JSP Page.
    Pls help me.
    With thanks,

    Thanks,
    Your URLs help me exectly. But after I have changed my code, the error is changed to "Too Few Parameters : Expected 35". What's wrong with it? The following is my code.
    try {                                                                                                                                                                                                                
    String DRIVER = ("sun.jdbc.odbc.JdbcOdbcDriver");               
    String URL = "jdbc:odbc:Industrial_One_DSN";
    String sql = "UPDATE BusinessRegistration " +
    "SET [Date] = ?, ISIC = ?, BizName = ?, BizAddress = ?, " +
    "OwnerName = ?, OwnerNRC = ?, Investment = ?, EstablishedYear = ?, " +
    "L_Male = ?, L_Female = ?, F_Male = ?, F_Female = ?, " +
    "OwnershipType = ?, Remarks = ?, IndustialZoneName = ?, Unit = ?, " +
    "Fuel = ?, FactoryType = ?, FactoryName = ?, Township = ? " +
    "MainProductName = ?, MainProductCountType = ?, " +
    "MainProductQuantity = ?, MainProductValue = ?, RMName = ?, " +
    "RMCountType = ?, RMQuantity = ?, RMValue = ?, EnergyName = ?, " +
    "MachinePower = ?, AmountGallon = ?, StateDiv = ?, BizSize = ?  " +
    "WHERE RegistrationID = ?";
    Class.forName(DRIVER);
    Connection con = DriverManager.getConnection(URL);
    PreparedStatement pstmt = con.prepareStatement(sql);
    int ilmale = Integer.parseInt(lmale);
    int ilfemale = Integer.parseInt(lfemale);
    int ifmale = Integer.parseInt(fmale);
    int iffemale = Integer.parseInt(ffemale);
    int impq = Integer.parseInt(mpq);
    int impv = Integer.parseInt(mpv);
    int irmq = Integer.parseInt(rmq);
    int irmv = Integer.parseInt(rmv);
    int iamountgallon = Integer.parseInt(amountgallon);
    pstmt.setString(1, date);
    pstmt.setString(2, isic);
    pstmt.setString(3, bizname);
    pstmt.setString(4, bizaddress);
    pstmt.setString(5, ownername);
    pstmt.setString(6, ownernrc);
    pstmt.setString(7, investment);
    pstmt.setString(8, eyear);
    pstmt.setInt(9, ilmale);
    pstmt.setInt(10, ilfemale);
    pstmt.setInt(11, ifmale);
    pstmt.setInt(12, iffemale);
    pstmt.setString(13, ownershiptype);
    pstmt.setString(14, remark);
    pstmt.setString(15, izn);
    pstmt.setString(16, unit);
    pstmt.setString(17, fuel);
    pstmt.setString(18, ft);
    pstmt.setString(19, fname);
    pstmt.setString(20, township);
    pstmt.setString(21, mpn);
    pstmt.setString(22, mpct);
    pstmt.setInt(23, impq);               
    pstmt.setInt(24, impv);
    pstmt.setString(25, rmname);
    pstmt.setString(26, rmct);
    pstmt.setInt(27, irmq);
    pstmt.setInt(28, irmv);
    pstmt.setString(29, ename);
    pstmt.setString(30, mpower);
    pstmt.setInt(31, iamountgallon);
    pstmt.setString(32, statediv);
    pstmt.setString(33, bizsize);
    pstmt.setInt(34, Integer.parseInt(rid));
    pstmt.executeUpdate();
    }I have got 35 fields in my db. But i wanna edit 34 fields only. I have no primary key in my table. Is't alright?
    pls keep on helping me.
    With thanks,
    WTDAHL

  • [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error

    Hi , i am trying to execute siple SP using JDBC-ODBC Bridge Driver
    Here my code :
    String dsn="Tritek1";
    String user="sa";
    String password="imcindia";
    Connection con1 = null;
    CallableStatement cstmt = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    con1=DriverManager.getConnection("jdbc:odbc:"+dsn,user,password);
    Statement st=con1.createStatement();
    st.execute("use dm0102d");
    st.execute("setuser 'dm01012'");
    cstmt = conObject.connection(" ?=Call dms_ex_get_folder_info(?,?,?)");
    cstmt.setString(1,folderType);
    cstmt.registerOutParameter(2,java.sql.Types.VARCHAR);
    cstmt.registerOutParameter(3,java.sql.Types.VARCHAR);     bFlag=cstmt.execute();
    Here my SP :
         Procedure Name          :     dms_ex_get_folder_info
         Input Parameter(s)          :     a. folder_type char(20)
         Return Parameter(s)     :     a. Recordset consist edit_mask and folder_type_code from folder_reference table / error
         Procedure Type          :     select
         Programmer          :     Prashanth Kumar M.
         Creation Date          :     12/20/2005 (20th Dec, 2005)
         Tables Accessed          :     folder_reference
         Revised               :
              Programmer:     Date:     Description:
              Prashanth Kumar M.      12/21/2005 Modified the script as per the approved program specifications.
         Test Query:
              Declare @edit_mask char(15)
              Declare @folder_type_code char(2)
              execute dms_ex_get_folder_info 'Policy Folder',@edit_mask output,@folder_type_code output
              Print 'Edit Mask : ' + @edit_mask
              Print 'Folder Type Code : ' + @folder_type_code
    CREATE PROCEDURE dms_ex_get_folder_info
         @folder_type char(20),
         @edit_mask char(15) output,
         @folder_type_code char(2) output
    AS
         BEGIN
              -- Check if the record for @folder_type exists or not.
              BEGIN
                   -- return the record from folder_reference
                   SELECT
                        @edit_mask= IsNull(edit_mask,''),
                        @folder_type_code = IsNull(folder_type_code,'')
                   FROM      folder_reference
                   WHERE
                        folder_decode = ltrim(rtrim(@folder_type))
                   -- return the error message
                   IF @@error <> 0
                        BEGIN
                             RAISERROR 100016 'Error in gettting the record from folder_reference table'
                             RETURN (@@error)
                        END
                   IF @edit_mask = '' AND @folder_type_code = ''
                        BEGIN
                             RAISERROR 100017 'No matching details in the folder_reference table'
                        RETURN (@@error)
                        END
              END
         END
    GO
    Here My Exception:
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
         at com.nyl.dms.bl.Folder.createFolder(Folder.java:121)
         at com.nyl.dms.bl.Folder.main(Folder.java:223)
    Any one can help me to overcome this problem . Thanks in advance.
    venkat

    Here's from one of those 10s of books.
    Quoted from JDBC 3.0 by Bernard Van Haecke:
    Stored procedures can return multiple result types because they can be composed of SQL statements that return diverse result types: resultsets and update counts (this includes special error codes).
    Now this doesn't sound very satisfactory. So I use Sybase since I don't have any other database at the moment, and write a simple stored procedure.
    CREATE proc testproc AS
    BEGIN
    -- My return code
    return 7
    END
    goThen a sample patchy buggy code to play around:
    import java.sql.*;
    public class ProcTesting {
        public static void main(String[] args) {
            String connUrl          = "jdbc:sybase:Tds:myserver:5150/dbinst";
            String userName         = "username";
            String password         = "password";
            Connection con          = null;
            CallableStatement stmt  = null;
            ResultSet rs            = null;
            String sql = "{? = call testproc}";
            try {
                Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
                con     = DriverManager.getConnection(connUrl, userName, password);
                stmt    = con.prepareCall(sql);
                stmt.registerOutParameter(1, Types.INTEGER);
                stmt.execute();
                System.out.println(stmt.getInt(1));
            } catch(Exception e) {
                e.printStackTrace();
            } finally {
                closeAll(con, stmt);
        public static void closeAll(Connection con, Statement stmt) {
            try {
                con.close();
            } catch(Exception e) {  }
            try {
                stmt.close();
            } catch(Exception e) {  }
    }Followed by:
    javac ProcTesting.java
    java -cp "%CLASSPATH%;C:\jarutils\jconn2.jar" ProcTesting
    Output:
    7
    Didn't you know this could be done?
    Happy new year, grandpa!

  • COUNT field incorrect or syntax error

    hi,
    PreparedStatement stmt = con.prepareStatement("Insert into uQuestions values(?,?)");
    stmt.setInt(1,2);
    //stmt.setString(2,s.trim());
    Reader rd=new StringReader(s.trim());
    stmt.setCharacterStream(2, rd );
    System.out.println( stmt.executeUpdate() );
    stmt.close();Result
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
    In place of setCharacterStream If I use stmt.setString(2,s.trim()) then it works fine.
    Whats the problem there....

    I am using Java 6 already.That's what I said in my last post.
    setClob() and setCharacterStream() are used for
    NVARCHAR and NTEXT tyesLike I said, the API talks about using setCharacterStream for LONGVARCHAR types, are NVARCHAR and NTEXT LONGVARCHAR types?

  • COUNT field incorrect: error help

    Hi, im quite new to java and im building an application to connect to a database and perfom various searches. the program displays the database data by means of a table.
    I can imagine ive done something wrong with the prepaired statements but i cant see what, Any suggestions would be very helpful. Here is the method that i have a problem with:
    public void test()
    Vector columnNames = new Vector();
    Vector data = new Vector();
         try
    // Connect to the Database
                   String url = "jdbc:odbc:ris1851";
                   Connection con;          
                   //String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
                   Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
                   String querySEARCH = "SELECT * FROM RIS51 WHERE SURNAME = ? order by age";
         String SEARCH = txtUser.getText();
         con = DriverManager.getConnection(url);     
         PreparedStatement search = con.prepareStatement(querySEARCH);      
         Statement stmt = con.createStatement();
         ResultSet rs = search.executeQuery();
    ResultSetMetaData md = rs.getMetaData();
    int columns = md.getColumnCount();
    // Get column names
    for (int i = 0; i < columns; i++)
                        columnNames.addElement( md.getColumnName(i) );
    //Get row data
    while (rs.next())
    Vector row = new Vector(columns);
    for (int i = 0; i < columns; i++)
    row.addElement( rs.getObject(i) );
                        data.addElement( row );
    rs.close();
    search.close();
    catch(Exception e)
    System.out.println(e );
    when i call the method i get:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect

         public void test() {
              Vector columnNames = new Vector();
              Vector data = new Vector();
                   try {
                        // Connect to the Database
                        String url = "jdbc:odbc:ris1851";
                        Connection con;
                        // String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
                        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                        String querySEARCH = "SELECT * FROM RIS51 WHERE SURNAME = "+txtUser.getText()+" order by age";
                        con = DriverManager.getConnection(url);
                        Statement search = con.createStatement();
                        ResultSet rs = search.executeQuery(querySEARCH);
                        ResultSetMetaData md = rs.getMetaData();
                        int columns = md.getColumnCount();
                        // Get column names
                        for (int i = 0; i < columns; i++) {
                             columnNames.addElement(md.getColumnName(i));
                        // Get row data
                        while (rs.next()) {
                             Vector row = new Vector(columns);
                             for (int i = 0; i < columns; i++) {
                                  row.addElement(rs.getObject(i));
                             data.addElement(row);
                        rs.close();
                        search.close();
                   } catch (Exception e) {
                        System.out.println(e);
         }You should learn more JDBC:
    http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html

  • COUNT field incorrect or syntax error while installing BO Xi3

    Hello
    I am trying to install Boxi3. The cms and audit dbs are all in sql database. The dbs and accounts are setup properly. However while installing, after I selected the CMS and Audit DBs, I am getting
    "Database access error. Reason [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error."
    At the details the error is as below.
    Wed Jul 30 03:46:53 2008]     5220     192     trace message: loading libary succeeded
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::Init()
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: initializing subsystem succeeded
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::Connect()
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\DBConnectionManager.cpp:802): trace message: DBConnectionManager - Setting total target number of connections for pool 0 to 1.
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM APPLICATION_TYPE WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM AUDIT_EVENT WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM EVENT_TYPE WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM SERVER_PROCESS WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM AUDIT_DETAIL WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:186): trace message: ExecDirect: SQL: SELECT * FROM DETAIL_TYPE WHERE 0 = 1
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::CheckDBCredentials()
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\AuditDatabaseSubsystem_impl.cpp:1197): trace message: AuditDatabaseSubsystem::CheckDBCredentialsOnTable(AUDIT_EVENT)
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerDatabase.cpp:515). (0 : Unexpected database column type for Duration type is decimal).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerDatabase.cpp:515). (0 : Unexpected database column type for Event_Type_ID type is decimal).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerDatabase.cpp:515). (0 : Unexpected database column type for Error_Code type is decimal).
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:162): trace message: Prepare: SQL: INSERT INTO AUDIT_EVENT (Duration, Error_Code, Event_ID, Event_Type_ID, Object_CUID, Server_CUID, Start_Timestamp, User_Name) VALUES(?, ?, ?, ?, ?, ?, ?, ?)
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerStatement.cpp:699). (0 : Unsupported SQL Server data type for binding.).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerStatement.cpp:699). (0 : Unsupported SQL Server data type for binding.).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\SQLServerStatement.cpp:699). (0 : Unsupported SQL Server data type for binding.).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\AuditDatabaseSubsystem_impl.cpp:1344). (0 : no message).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\AuditDatabaseSubsystem_impl.cpp:1344). (0 : no message).
    [Wed Jul 30 03:46:53 2008]     5220     192     assert failure: (.\AuditDatabaseSubsystem_impl.cpp:1344). (0 : no message).
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerStatement.cpp:171): trace message: Prepared statement Execute
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\SQLServerDatabase.cpp:119): trace message: SQLServer error found:  ErrorMessage([Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error), ErrorCode(0)
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\AuditDatabaseSubsystem_impl.cpp:92): trace message: DBConnectionHolder - (AuditDB) - Caught retryable error with Code 0, Msg: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error  Number of retryable errors on this connection is 1
    [Wed Jul 30 03:46:53 2008]     5220     192     (.\dbutils.cpp:922): trace message: Caught DatabaseSubystem Error: Database access error. Reason [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error.
    [Wed Jul 30 03:46:53 2008]     5220     192     trace message: AuditDatabaseSubsystem::Shutdown()
    This only happens for audit db and not for cms db. May I know what is the reason for this and how to resolve it?
    Thanks

    I am using Java 6 already.That's what I said in my last post.
    setClob() and setCharacterStream() are used for
    NVARCHAR and NTEXT tyesLike I said, the API talks about using setCharacterStream for LONGVARCHAR types, are NVARCHAR and NTEXT LONGVARCHAR types?

  • Database Access in Java (Count field incorrect)

    Was given a stock tracking application to be edited for use as a Student/Admin login application which accesses a database and adds/deletes/edits student information. When I try to login, I get the following error: [Microsoft][OBDC Microsoft Access Driver]Count Field Incorrect
    The driver was set up in the Admin tools in Windows XP.
    The columns exist in the database.
    //makeDB.java
      import java.sql.*;
      import java.io.*;
      public class MakeDB
        public static void main(String[] args) throws Exception
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String url = "jdbc:odbc:saad";
              Connection con = DriverManager.getConnection(url);
             Statement stmt = con.createStatement();
              // The following code deletes each index and table, if they exist.
              // If they do not exist, a message is displayed and execution continues.
              System.out.println("Dropping indexes & tables ...");
            try
                   stmt.executeUpdate("DROP INDEX PK_StudentUserBridge ON StudentUserBridge");
             catch (Exception e)
                   System.out.println("Could not drop primary key on saad table: "
                                     + e.getMessage());
            try
                     stmt.executeUpdate("DROP TABLE Student");
             catch (Exception e)
                   System.out.println("Could not drop Student table: "
                                     + e.getMessage());
            try
                     stmt.executeUpdate("DROP TABLE Users");
             catch (Exception e)
                   System.out.println("Could not drop Users table: "
                                     + e.getMessage());
            try
                     stmt.executeUpdate("DROP TABLE StudentUserBridge");
             catch (Exception e)
                   System.out.println("Could not drop StudentUserBridge table: "
                                     + e.getMessage());
              ///////// Create the database tables /////////////
              System.out.println("\nCreating tables ............");
              // Create Stocks table with primary key index
            try
                   System.out.println("Creating Student table with primary key index...");
                   stmt.executeUpdate("CREATE TABLE Student ("
                                     +"IDNumber TEXT(8) NOT NULL "
                                     +"CONSTRAINT PK_Student PRIMARY KEY, "
                                     +"FirstName TEXT(50), "
                                     +"LastName TEXT(50)"
                                     +")");
             catch (Exception e)
                   System.out.println("Exception creating Student table: "
                                     + e.getMessage());
              // Create Users table with primary key index
            try
                   System.out.println("Creating Users table with primary key index...");
                   stmt.executeUpdate("CREATE TABLE Users ("
                                     +"userID TEXT(20) NOT NULL "
                                    +"CONSTRAINT PK_Users PRIMARY KEY, "
                                    +"FirstName TEXT(30) NOT NULL, "
                                    +"LastName TEXT(30) NOT NULL, "
                                         +"pswd LONGBINARY, "
                                    +"email TEXT(30) NOT NULL, "
                                         +"admin BIT"
                                         +")");
             catch (Exception e)
                   System.out.println("Exception creating Users table: "
                                     + e.getMessage());
              // Create UserStocks table with foreign keys to Users and Stocks tables
            try
                   System.out.println("Creating StudentUserBridge table ...");
                   stmt.executeUpdate("CREATE TABLE StudentUserBridge ("
                                     +"userID TEXT(20) "
                                       +"CONSTRAINT FK1_StudentUserBridge REFERENCES Users (userID), "
                                          +"IDNumber TEXT(8), "
                                       +"CONSTRAINT FK2_StudentUserBridge FOREIGN KEY (IDNumber) "
                                       +"REFERENCES Student (IDNumber)"
                                       +")");
             catch (Exception e)
                   System.out.println("Exception creating StudentUserBridge table: "
                                     + e.getMessage());
              // Create UserStocks table primary key index
            try
                   System.out.println("Creating StudentUserBridge table primary key index...");
                   stmt.executeUpdate("CREATE UNIQUE INDEX PK_StudentUserBridge "
                                        +"ON StudentUserBridge (userID, IDNumber) "
                                        +"WITH PRIMARY DISALLOW NULL");
             catch (Exception e)
                   System.out.println("Exception creating StudentUserBridge index: "
                                     + e.getMessage());
              // Create one administrative user with password as initial data
              String userID = "admin01";
              String FirstName = "Default";
              String LastName = "Admin";
              String initialPswd = "admin01";
              String email = "[email protected]";
              Password pswd = new Password(initialPswd);
              boolean admin = true;
            PreparedStatement pStmt =
                       con.prepareStatement("INSERT INTO Users VALUES (?,?,?,?,?,?)");
            try
                 pStmt.setString(1, userID);
                  pStmt.setString(2, FirstName);
                  pStmt.setString(3, LastName);
                pStmt.setBytes(4, serializeObj(pswd));
                pStmt.setString(5, email);
                  pStmt.setBoolean(6, admin);
                  pStmt.executeUpdate();
              catch (Exception e)
                   System.out.println("Exception inserting user: "
                                     + e.getMessage());
            pStmt.close();
              // Read and display all User data in the database.
            ResultSet rs = stmt.executeQuery("SELECT * FROM Users");
            System.out.println("Database created.\n");
            System.out.println("Displaying data from database...\n");
            System.out.println("Users table contains:");
            Password pswdFromDB;
            byte[] buf = null;
            while(rs.next())
                   System.out.println("Logon ID         = "
                                     + rs.getString("userID"));
                 System.out.println("Last name        = "
                                   + rs.getString("FirstName"));
                 System.out.println("First name       = "+rs.getString("LastName"));
                 System.out.println("E-mail           = "+rs.getString("email"));
                 System.out.println("Administrative   = "+rs.getBoolean("admin"));
                 System.out.println("Initial password = "+initialPswd);
            // Do NOT use with JDK 1.2.2 using JDBC-ODBC bridge as
            // SQL NULL data value is not handled correctly.
                buf = rs.getBytes("pswd");
                if (buf != null)
                      System.out.println("Password Object  = "
                                      + (pswdFromDB=(Password)deserializeObj(buf)));
                      System.out.println("  AutoExpires    = "+ pswdFromDB.getAutoExpires());
                      System.out.println("  Expiring now   = "+ pswdFromDB.isExpiring());
                      System.out.println("  Remaining uses = "
                                        + pswdFromDB.getRemainingUses()+"\n");
                  else
                      System.out.println("Password Object  = NULL!");
            rs = stmt.executeQuery("SELECT * FROM Student");
            if(!rs.next())
                 System.out.println("Student table contains no records.");
              else
                 System.out.println("Student table still contains records!");
            rs = stmt.executeQuery("SELECT * FROM StudentUserBridge");
            if(!rs.next())
                 System.out.println("StudentUserBridge table contains no records.");
              else
                 System.out.println("StudentUserBridge table still contains records!");
             stmt.close(); // closing Statement also closes ResultSet
        } // end of main()
         // Method to write object to byte array and then insert into prepared statement
        public static byte[] serializeObj(Object obj)
                                  throws IOException
              ByteArrayOutputStream baOStream = new ByteArrayOutputStream();
            ObjectOutputStream objOStream = new ObjectOutputStream(baOStream);
            objOStream.writeObject(obj); // object must be Serializable
            objOStream.flush();
            objOStream.close();
            return baOStream.toByteArray(); // returns stream as byte array
         // Method to read bytes from result set into a byte array and then
         // create an input stream and read the data into an object
        public static Object deserializeObj(byte[] buf)
                                      throws IOException, ClassNotFoundException
             Object obj = null;
            if (buf != null)
              ObjectInputStream objIStream =
                new ObjectInputStream(new ByteArrayInputStream(buf));
              obj = objIStream.readObject(); // throws IOException, ClassNotFoundException
            return obj;
      } // end of class
    //STLogon.java
    import javax.swing.*;
    import javax.swing.border.TitledBorder;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import java.sql.*;
    public class STLogon extends JFrame implements ActionListener, Activator
        StudentDB db;
        User user = null;
        String userID;
        String password;
        JTextField userIDField;
        JPasswordField passwordField;
        JButton jbtLogon;
        public STLogon()
            super("Stock Tracker"); // call super (JFrame) constructor
              int width = 300;
              int height = 100;
            try{
                 db = new StudentDB();
            catch(ClassNotFoundException ex){
                        JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "Class not found exception creating database object",
                    JOptionPane.ERROR_MESSAGE);
                           System.exit(0);
            catch(SQLException ex){
                        JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "SQL exception creating database object",
                    JOptionPane.ERROR_MESSAGE);
                           System.exit(0);
              // define GUI components
            JLabel label1 = new JLabel("User ID: ");
            userIDField = new JTextField(20);
            JLabel label2 = new JLabel("Password:   ");
            passwordField = new JPasswordField(20);
            passwordField.setEchoChar('*');
            jbtLogon = new JButton("Log on");
              // set up GUI
            JPanel userPanel= new JPanel(new BorderLayout());
            userPanel.add(label1,BorderLayout.CENTER);
            userPanel.add(userIDField,BorderLayout.EAST);
            JPanel pswdPanel= new JPanel(new BorderLayout());
            pswdPanel.add(label2,BorderLayout.CENTER);
            pswdPanel.add(passwordField,BorderLayout.EAST);
            JPanel buttonPanel= new JPanel(new FlowLayout());
            buttonPanel.add(jbtLogon);
            JPanel contentPanel= new JPanel(new BorderLayout());
            contentPanel.add(userPanel, BorderLayout.NORTH);
            contentPanel.add(pswdPanel, BorderLayout.CENTER);
            contentPanel.add(buttonPanel, BorderLayout.SOUTH);
             contentPanel.setBorder(new TitledBorder("Log on"));
            setContentPane(contentPanel);
            // add listeners
            jbtLogon.addActionListener(this);
            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e)
                                       try {db.close();
                                    catch(Exception ex)
                                    System.exit(0);
              // Enable Enter key for each JButton
              InputMap map;
              map = jbtLogon.getInputMap();
              if (map != null){
                   map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false), "pressed");
                   map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,true), "released");
            pack();
              if( width < getWidth())                    // prevent setting width too small
                 width = getWidth();
              if(height < getHeight())               // prevent setting height too small
                   height = getHeight();
              centerOnScreen(width, height);
           public void centerOnScreen(int width, int height)
             int top, left, x, y;
             // Get the screen dimension
             Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
             // Determine the location for the top left corner of the frame
             x = (screenSize.width - width)/2;
             y = (screenSize.height - height)/2;
             left = (x < 0) ? 0 : x;
             top = (y < 0) ? 0 : y;
             // Set the frame to the specified location & size
           this.setBounds(left, top, width, height);
         private boolean validUser(String userID,String password)
                        throws PasswordException,SQLException,IOException,ClassNotFoundException
              boolean userOK = false;
              user = db.getUser(userID); // get user object from DB for this ID
              if(user != null)
                   user.validate(password); // throws PasswordException
                   userOK = true;
                   if(user.pswdAutoExpires())     // if tracking uses
                        db.updUser(user);          // update DB for this use
             return userOK;
        private void doStockActivity()throws PasswordException,SQLException,
                                                      IOException,ClassNotFoundException
            StockTracker f = new StockTracker(user,this,db);
            f.pack();
            this.setVisible(false);
            f.setVisible(true);
        public void activate()
            this.setVisible(true);
            userIDField.setText("");
            userIDField.requestFocus();
            user = null;
        public void actionPerformed(ActionEvent e)
              try
                   userID = userIDField.getText();
                if(userID.equals(""))
                           JOptionPane.showMessageDialog(this,
                            "Please enter a valid user ID.",
                           "Missing User ID.",
                           JOptionPane.ERROR_MESSAGE);
                       userIDField.requestFocus();
                   else
                        password = new String(passwordField.getPassword());
                     if(password.equals(""))
                                JOptionPane.showMessageDialog(this,
                                 "Please enter a valid password.",
                                "Missing Password.",
                                JOptionPane.ERROR_MESSAGE);
                            passwordField.requestFocus();
                        else
                             try
                                  // See if userID exists and validate password
                                  if(validUser(userID,password))
                                   if(user.pswdIsExpiring())
                                              JOptionPane.showMessageDialog(this,
                                                             user.getUserID()+" logon successful; "
                                                +user.getPswdUses()+" use(s) remaining.");
                                    if(e.getSource() == jbtLogon)
                                               doStockActivity();
                               else
                                    JOptionPane.showMessageDialog(this, "Invalid user.");
                             catch (PasswordExpiredException ex)
                                  JPasswordField pf1 = new JPasswordField();
                                  JPasswordField pf2 = new JPasswordField();
                                  Object[] message1 = new Object[]
                                            {"Password has expired. Please enter a new password.", pf1};
                                  Object[] options = new String[] {"OK", "Cancel"};
                                  JOptionPane op1 = new JOptionPane(message1,
                                                                     JOptionPane.WARNING_MESSAGE,
                                                              JOptionPane.OK_CANCEL_OPTION, null, options);
                                  JDialog dialog1 = op1.createDialog(null, "Change Password");
                                  dialog1.show();
                                  if(op1.getValue() != null && options[0].equals(op1.getValue()))
                                       String pswd1 = new String(pf1.getPassword());
                                       if(pswd1 != null)
                                           Object[] message2 = new Object[]
                                                               {"Please verify new password.", pf2};
                                            JOptionPane op2 = new JOptionPane(message2,
                                                                               JOptionPane.WARNING_MESSAGE,
                                                                       JOptionPane.OK_CANCEL_OPTION,
                                                                       null, options);
                                            JDialog dialog2 = op2.createDialog(null, "Verify Password");
                                            dialog2.show();
                                            if(op2.getValue() != null && options[0].equals(op2.getValue()))
                                                 String pswd2 = new String(pf2.getPassword());
                                                 if(pswd2 != null)
                                                      if(pswd1.equals(pswd2))
                                                        user.changePassword(password, pswd1);
                                                           db.updUser(user);
                                                           doStockActivity();
                                                      else
                                                           JOptionPane.showMessageDialog(this,
                                                          "Both passwords are not identical.",
                                                         "Password not changed",
                                                         JOptionPane.ERROR_MESSAGE);
                 userIDField.setText("");
                passwordField.setText("");
                userIDField.requestFocus();
            }// end of try
            catch (PasswordUsedException ex)
                JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "Password Previously Used. Try again.",
                    JOptionPane.ERROR_MESSAGE);
            catch (PasswordSizeException ex)
                JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "Invalid password size. Try again.",
                    JOptionPane.ERROR_MESSAGE);
            catch (PasswordInvalidFormatException ex)
                if(ex.getCount() > 2) // allows only 3 tries, then exits program
                     System.exit(0);
                else
                     JOptionPane.showMessageDialog(this,ex.getMessage()+", count:"+ex.getCount(),
                                                        "Invalid password format. Try again.",
                                                              JOptionPane.ERROR_MESSAGE);
            catch (PasswordInvalidException ex)
                if(ex.getCount() > 2) // allows only 3 tries, then exits program
                     System.exit(0);
                else
                     JOptionPane.showMessageDialog(this,ex.getMessage()+", count:"+ex.getCount(),
                                                        "Invalid password. Try again.",
                                                              JOptionPane.ERROR_MESSAGE);
            catch (PasswordException ex)
                JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "PasswordException.",
                    JOptionPane.ERROR_MESSAGE);
            catch (IOException ex)
                JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "IOException.",
                    JOptionPane.ERROR_MESSAGE);
            catch (SQLException ex)
                JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "SQLException.",
                    JOptionPane.ERROR_MESSAGE);
            catch (ClassNotFoundException ex)
                JOptionPane.showMessageDialog(this,
                    ex.getMessage(),
                    "ClassNotFoundException.",
                    JOptionPane.ERROR_MESSAGE);
        public static void main(String[] argv)
              final STLogon f = new STLogon();
              f.setVisible(true);
    //StudentDB.java
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class StudentDB
         private Connection con = null;
         // Constructor; makes database connection
        public StudentDB() throws ClassNotFoundException,SQLException
              if(con == null)
                   String url = "jdbc:odbc:saad";
                 try
                      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   catch(ClassNotFoundException ex)
                        throw new ClassNotFoundException(ex.getMessage() +
                                  "\nCannot locate sun.jdbc.odbc.JdbcOdbcDriver");
                 try
                        con = DriverManager.getConnection(url);
                   catch(SQLException ex)
                        throw new SQLException(ex.getMessage()+
                                  "\nCannot open database connection for "+url);
         // Close makes database connection; null reference to connection
         public void close() throws SQLException,IOException,ClassNotFoundException
              con.close();
               con = null;
         // Method to serialize object to byte array
        private byte[] serializeObj(Object obj) throws IOException
              ByteArrayOutputStream baOStream = new ByteArrayOutputStream();
            ObjectOutputStream objOStream = new ObjectOutputStream(baOStream);
            objOStream.writeObject(obj); // object must be Serializable
            objOStream.flush();
            objOStream.close();
            return baOStream.toByteArray(); // returns stream as byte array
         // Method to deserialize bytes from a byte array into an object
        private Object deserializeObj(byte[] buf)
                             throws IOException, ClassNotFoundException
             Object obj = null;
            if (buf != null)
                   ObjectInputStream objIStream =
                      new ObjectInputStream(new ByteArrayInputStream(buf));
                obj = objIStream.readObject(); //IOException, ClassNotFoundException
            return obj;
         // Methods for adding a record to a table
        // add to the Student Table
         public void addStudent(String IDNumber, String FirstName, String LastName)
                     throws SQLException, IOException, ClassNotFoundException
              Statement stmt = con.createStatement();
               stmt.executeUpdate("INSERT INTO Student VALUES ('"
                                 +IDNumber+"'"+",'"+FirstName+"'"+",'"+LastName+"')");
               stmt.close();
         // add to the Users table
         public boolean addUser(User user) throws SQLException,IOException,
                                                  ClassNotFoundException
           boolean result = false;
          String dbUserID;
          String dbLastName;
          String dbFirstName;
          Password dbPswd;
          String dbemail;
          boolean isAdmin;
          dbUserID = user.getUserID();
          if(getUser(dbUserID) == null)
                dbLastName = user.getFirstName();
                dbFirstName = user.getLastName();
              Password pswd = user.getPassword();
    //          dbemail = user.getEmail();
                isAdmin = user.isAdmin();
              PreparedStatement pStmt = con.prepareStatement(
                  "INSERT INTO Users VALUES (?,?,?,?,?,?)");
              pStmt.setString(1, dbUserID);
              pStmt.setString(2, dbFirstName);
              pStmt.setString(3, dbLastName);
              pStmt.setBytes(4, serializeObj(pswd));
    //          pStmt.setString(5, dbemail);
              pStmt.setBoolean(5, isAdmin);
              pStmt.executeUpdate();
              pStmt.close();
              result = true;
           else
                throw new IOException("User exists - cannot add.");
           return result;
         // add to the UserStocks table
         public void addStudentUserBridge(String userID, String IDNumber)
                     throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
               stmt.executeUpdate("INSERT INTO StudentUserBridge VALUES ('"
                                 +userID+"'"
                                 +",'"+IDNumber+"')");
               stmt.close();
         // Methods for updating a record in a table
        // updating the Users Table
         public boolean updUser(User user) throws SQLException,IOException,
                                                  ClassNotFoundException
           boolean result = false;
             String dbUserID;
          String dbLastName;
          String dbFirstName;
          Password dbPswd;
          String dbemail;
          boolean isAdmin;
          dbUserID = user.getUserID();
          if(getUser(dbUserID) != null)
                dbLastName = user.getFirstName();
                dbFirstName = user.getLastName();
              Password pswd = user.getPassword();
    //          dbemail = user.getEmail();
                isAdmin = user.isAdmin();
              PreparedStatement pStmt = con.prepareStatement("UPDATE Users SET FirstName = ?,"
                                           +" LastName = ?, pswd = ?, email = ?, admin = ? WHERE userID = ?");
              pStmt.setString(1, dbFirstName);
              pStmt.setString(2, dbLastName);
              pStmt.setBytes(3, serializeObj(pswd));
    //          pStmt.setString(4, dbemail);
              pStmt.setBoolean(4, isAdmin);
              pStmt.setString(5, dbUserID);
              pStmt.executeUpdate();
              pStmt.close();
              result = true;
           else
                throw new IOException("User does not exist - cannot update.");
           return result;
         // Methods for deleting a record from a table
        // delete a record from the Student Table
         private void delStudent(String IDNumber)
                      throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
               stmt.executeUpdate("DELETE FROM Student WHERE "
                                 +"IDNumber = '"+IDNumber+"'");
            stmt.close();
        // delete a record from the Users Table
         public void delUser(User user) throws SQLException,IOException,
                                                  ClassNotFoundException
               String dbUserID;
            String stockSymbol;
              Statement stmt = con.createStatement();
              try {
                   con.setAutoCommit(false);
                   dbUserID = user.getUserID();
                   if(getUser(dbUserID) != null)  // verify user exists in database
                         ResultSet rs1 = stmt.executeQuery("SELECT userID, IDNumber "
                                           +"FROM StudentUserBridge WHERE userID = '"+dbUserID+"'");
                         while(rs1.next())
                         try
                             stockSymbol = rs1.getString("IDNumber");
                                  delUserStocks(dbUserID, stockSymbol);
                            catch(SQLException ex)
                                  throw new SQLException("Deletion of user student failed: "
                                                        +ex.getMessage());
                          } // end of loop thru UserStocks
                    try
                    {  // holdings deleted, now delete user
                             stmt.executeUpdate("DELETE FROM Users WHERE "
                                           +"userID = '"+dbUserID+"'");
                       catch(SQLException ex)
                             throw new SQLException("User deletion failed: "+ex.getMessage());
                     else
                          throw new IOException("User not found in database - cannot delete.");
                   try
                      con.commit();
                    catch(SQLException ex)
                        throw new SQLException("Transaction commit failed: "+ex.getMessage());
              catch (SQLException ex)
                   try
                        con.rollback();
                   catch (SQLException sqx)
                        throw new SQLException("Transaction failed then rollback failed: "
                                              +sqx.getMessage());
                   // Transaction failed, was rolled back
                   throw new SQLException("Transaction failed; was rolled back: "
                                         +ex.getMessage());
            stmt.close();
        // delete a record from the StudentUserBridge Table
         public void delUserStocks(String userID, String stockSymbol)
                     throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
             ResultSet rs;
               stmt.executeUpdate("DELETE FROM StudentUserBridge WHERE "
                                 +"userID = '"+userID+"'"
                                 +"AND IDNumber = '"+stockSymbol+"'");
               rs = stmt.executeQuery("SELECT IDNumber FROM StudentUserBridge "
                                     +"WHERE IDNumber = '"+stockSymbol+"'");
                 if(!rs.next()) // no users have this stock
    //               delStock(stockSymbol);
               stmt.close();
         // Methods for listing record data from a table
         // Ordered by:
         //           methods that obtain individual field(s),
         //           methods that obtain a complete record, and
         //           methods that obtain multiple records
         // Methods to access one or more individual fields
        // get a stock description from the Stocks Table
         public String getStockDesc(String stockSymbol)
                       throws SQLException, IOException, ClassNotFoundException
              Statement stmt = con.createStatement();
                String stockDesc = null;
               ResultSet rs = stmt.executeQuery("SELECT IDNumber, name FROM Student "
                                               +"WHERE IDNumber = '"+stockSymbol+"'");
               if(rs.next())
                   stockDesc = rs.getString("IDNumber");
               rs.close();
               stmt.close();
                return stockDesc;
         // Methods to access a complete record
        // get User data from the Users Table
         public User getUser(String UserID) throws SQLException, IOException,
                                                   ClassNotFoundException
           Statement stmt = con.createStatement();
             String dbUserID;
          String dbLastName;
          String dbFirstName;
          Password dbPswd;
          String dbemail;
          boolean isAdmin;
          byte[] buf = null;
          User user = null;
          ResultSet rs = stmt.executeQuery("SELECT * FROM Users WHERE userID = '"
                                          +UserID+"'");
          if(rs.next())
                dbUserID = rs.getString("userID");
                 dbFirstName = rs.getString("FirstName");
                 dbLastName = rs.getString("LastName");
                 dbemail = rs.getString("email");
            // Do NOT use with JDK 1.2.2 using JDBC-ODBC bridge as
            // SQL NULL data value is not handled correctly.
              buf = rs.getBytes("pswd");
                 dbPswd = (Password)deserializeObj(buf);
                 isAdmin = rs.getBoolean("admin");
                user = new User(dbUserID,dbFirstName,dbLastName,dbPswd,isAdmin);
          rs.close();
          stmt.close();
           return user; // User object created for userID
         // Methods to access a list of records
        // get list of selected fields for all records from the Users Table
         public ArrayList listUsers() throws SQLException,IOException,
                                             ClassNotFoundException
          ArrayList aList = new ArrayList();
           Statement stmt = con.createStatement();
          ResultSet rs = stmt.executeQuery("SELECT userID, FirstName, LastName, admin "
                                          +"FROM Users ORDER BY userID");
          while(rs.next())
                aList.add(rs.getString("userID"));
                  aList.add(rs.getString("FirstName"));
                  aList.add(rs.getString("LastName"));
                  aList.add(new Boolean(rs.getBoolean("admin")));
          rs.close();
          stmt.close();
          return aList;
        // get all fields in all records for a given user from the Userstocks Table
         public ArrayList listUserStocks(String userID) throws SQLException,IOException,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

    saaddani wrote:
    No information popped up in the console window before, during, or after the error was given. The program compiled and ran and therefore no error information was provided in the complier window either.
    If I am missing what you are asking then please provide instructions as to how to find this error information. You are posting the error message for the exception but not printing the stack trace.
    Far as I can tell you are printing more information with each exception (for example "Exception creating Users table") but you did not post what that was, that info would localize the problem.
    As a guess the problem is when you extract the fields via the query. You are using named values rather than indexes and you use "select *" rather than specifically naming the columns. Some databases (for example Oracle), require that using names must be in exactly the same order as the query returns them. You have no idea what that order is because you use "select *"
    Finally it would be a LOT easier if you wrote classes that did nothing but the database operations. NO GUI CODE. You then test that code to make sure it works. Once that code works then you write gui code which uses those classes. Besides making it easier to understand you are also more likely to get assistance since there is less code to look at.

  • Help me , I got, exception  with message "COUNT field incorrect "

    exception I got
    *java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect*
    my code
    for(i=0;i<5;i++)
    //here title , link,description are strings
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:dbase","","");
    Statement stmt=null;
    String query=null;
    stmt=con.createStatement();
    query="insert into table1 values('"+title+"','"+link+"','"+description+"','nil1','nil2','nil3')";
    int count=stmt.executeUpdate(query);
    stmt.close();
    con.commit();
    con.close();
    }

    I tried with prepared statement and got following exception
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115) at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136) at extractor.doGet(extractor.java:56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:747) at javax.servlet.http.HttpServlet.service(HttpServlet.java:860) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:517) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475) at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371) at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281) at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)

  • MSAccess Count Field incorrect problem

    Hello I am trying an update of Details, I traced the code along to it populated fields and verified values as correct.I am getting an error on the
    int resultCount = stmt.executeUpdate();
                if ( resultCount != 1 ) {Why is this ?
    My error line is :ClubBean: message = Unable to update item Swing
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
    ClubBean: Fatal Error Occurred
    Please tell me if what i am trying to do is wrong.
    * ClubDAO.java
    * Created on 31 March 2004, 14:45
    package com.soundstage;
    * @author  Andrew
    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import javax.sql.*;
    public class ClubDAO implements Serializable, DataAccess {
        private transient TransactionContext globalTran = null;
        private transient ClubValue clubVal   = null;
         *Creates a new instance of DAO
        public ClubDAO(TransactionContext transactionContext) {
            globalTran = transactionContext;
        public Object findByPrimaryKey(Integer memberNumber)
        throws DAOSysException, DAOFinderException {
            if (itemExistsById(memberNumber)) {
                //log("CustomerDAO: returning " + clubVal.getMemberNumber());
                return clubVal;
            throw new DAOFinderException("Club Not Found = "
            + memberNumber);
        public void deleteObject(Integer id) throws DAOSysException,
        DAODBUpdateException{
            String queryStr = "DELETE FROM " + "Club" +
            " WHERE ClubName = "
            + id;
            log("queryString is: "+ queryStr);
            Statement stmt = null;
            try {
                stmt = globalTran.getDBConnection().createStatement();
                int resultCount = stmt.executeUpdate(queryStr);
                if ( resultCount != 1 )
                    throw new DAODBUpdateException("ERROR deleteing Club from" + " Club_TABLE!! resultCount = " + resultCount);
            } catch(SQLException se) {
                throw new DAOSysException("Unable to delete for item " + id + "\n" + se);
            } finally {
                globalTran.closeStatement(stmt);
                log("ClubDAO: closeStatement");
        public void deleteObject(String clubName)
        throws DAOSysException, DAODBUpdateException {
            String queryStr = "DELETE FROM Club WHERE ClubName = " + "'"+clubName+"'";
            log("queryString is: "+ queryStr);
            Statement stmt = null;
            try {
                stmt = globalTran.getDBConnection().createStatement();
                int resultCount = stmt.executeUpdate(queryStr);
                if ( resultCount != 1 )
                    throw new DAODBUpdateException("ERROR deleteing Club from" + " Club_TABLE!! resultCount = " + resultCount);
            } catch(SQLException se) {
                throw new DAOSysException("Unable to delete for item " + clubName + "\n" + se);
            } finally {
                globalTran.closeStatement(stmt);
                log("ClubDAO: closeStatement");
        public void updateObject(Object model) throws
        DAOAppException, DAODBUpdateException,
        DAOSysException{
            ClubValue clubVal = (ClubValue) model;
            PreparedStatement stmt = null;
            try {
                String queryStr = "UPDATE " + "Club" +
                  " SET " + "ClubName = ?, " +
                  "NumberOfMembersEnrolled = ?, " +
                  "NumberOfCancelledYTD = ?, " +
                  "CurrentPromotion = ?, " +
                  "TotalUnitsSoldForClub = ?, " +
                  "MaximumPeriodOfObligation = ?, " +
                  "WHERE ClubName = ?";
                log("ClubDAO: Update String " + queryStr);
                stmt = globalTran.getDBConnection().prepareStatement(queryStr);
                log("ClubDAO: Prepare Worked ");
                stmt.setString(1, clubVal.getClubName());
                stmt.setInt(2, clubVal.getNumberOfMembersEnrolled());
                stmt.setInt(3, clubVal.getNumberOfCancelledYTD());
                stmt.setString(4, clubVal.getCurrentPromotion());
                stmt.setInt(5, clubVal.getTotalUnitsSoldForClub());
                stmt.setInt(6, clubVal.getMaximumPeriodOfObligation());
                log("ClubDAO: done setting items ");
                int resultCount = stmt.executeUpdate();
                if ( resultCount != 1 ) {
                    log("ClubDAO: update failed");
                    throw new DAODBUpdateException ("ERROR updating ClubD in" + " Club!! resultCount = " + resultCount);
                log("ClubDAO: update worked...result count = " + resultCount);
            } catch(SQLException se) {
                throw new DAOSysException("Unable to update item " + clubVal.getClubName() + " \n" + se);
            } finally {
                globalTran.closeStatement(stmt);
                log("ClubDAO: closeStatement");
        public void insertObject(Object model) throws
        DAOAppException, DAODBUpdateException,
        DAOSysException{
            ClubValue clubVal = (ClubValue) model;
            PreparedStatement stmt = null;
            try {
                String queryStr = "INSERT INTO Club (ClubName, NumberOfMembersEnrolled, NumberOfCancelledYTD, CurrentPromotion," +
                "TotalUnitsSoldForClub, MaximumPeriodOfObligation)" +
                "VALUES (?, ?, ?, ?, ?, ?)";
                log("ClubDAO: Insert String " + queryStr);
                stmt = globalTran.getDBConnection().
                prepareStatement(queryStr);
                int i = 1;
                stmt.setString(i++, clubVal.getClubName());
                stmt.setInt(i++, clubVal.getNumberOfMembersEnrolled());
                stmt.setInt(i++, clubVal.getNumberOfCancelledYTD());
                stmt.setString(i++, clubVal.getCurrentPromotion());
                stmt.setInt(i++, clubVal.getTotalUnitsSoldForClub());
                stmt.setInt(i++, clubVal.getMaximumPeriodOfObligation());
                int resultCount = stmt.executeUpdate();
                if ( resultCount != 1 )
                    throw new DAODBUpdateException("ERROR inserting Club in" + " Club!! resultCount = " + resultCount);
            } catch(SQLException se) {
                throw new DAOSysException("Unable to insert item " + clubVal.getClubName() + " \n" + se);
            } finally {
                globalTran.closeStatement(stmt);
                log("ClubDAO: closeStatement");
         * Returns an CustomerValue initialized with the information
         * found in the database for the specified customer, or null if
         * not found.
        public Object findByName(String name)
        throws DAOSysException, DAOFinderException {
            //log("CustomerDAO: start findByCustomerNumber");
            if (itemExistsByName(name)) {
                //  log("ClubDAO: returning " + clubVal.getCustomerId());
                return clubVal;
            throw new DAOFinderException("Club Not Found = "
            + name);
        private boolean itemExistsById(Integer memberNumber) throws DAOSysException {
            String queryStr ="SELECT MemberNumber, MemberName, " +
            "FROM member " +
            "WHERE MemberNumber = " + memberNumber;
            return doQuery(queryStr);
        private boolean itemExistsByName(String clubName) throws DAOSysException {
            //  log("MemberDAO: before query creation");
            String queryStr ="SELECT * FROM Club WHERE ClubName = " + "'"+clubName+"'";
            log(queryStr);
            return doQuery(queryStr);
        private boolean doQuery(String qryString) throws DAOSysException {
            Statement stmt = null;
            ResultSet result = null;
            boolean returnValue = false;
            try {
                //  log("CustomerDAO: before statement creationg");
                stmt = globalTran.getDBConnection().createStatement();
                // log("CustomerDAO: statement created");
                //log("CustomerDAO: query is" + qryString);
                result = stmt.executeQuery(qryString);
                // log("CustomerDAO: statement executed");
                if ( !result.next() ) {
                    //log("CustomerDAO: customer not found");
                    returnValue = false;
                else {
                    // log("CustomerDAO: Club found");
                    clubVal = new ClubValue();
                    int i = 1;
                    clubVal.setClubName(result.getString(i++));
                    clubVal.setNumberOfMembersEnrolled(result.getInt(i++));
                    clubVal.setNumberOfCancelledYTD(result.getInt(i++));
                    clubVal.setCurrentPromotion(result.getString(i++));
                    clubVal.setTotalUnitsSoldForClub(result.getInt(i++));
                    clubVal.setMaximumPeriodOfObligation(result.getInt(i++));
                    returnValue = true;
            } catch(SQLException se) {
                se.printStackTrace();
                throw new DAOSysException("Unable to Query for item " +
                "\n" + se);
            } finally {
                // log("CustomerDAO: prior");
                globalTran.closeResultSet(result);
                // log("CustomerDAO: closeResult");
                globalTran.closeStatement(stmt);
                // log("CustomerDAO: closeStatement");
            return returnValue;
        private void closeResultSet(ResultSet result) throws DAOSysException {
            try {
                if (result != null) {
                    result.close();
            } catch (SQLException se) {
                throw new DAOSysException("SQL Exception while closing " +
                "Result Set : \n" + se);
        private void closeStatement(Statement stmt) throws DAOSysException {
            try {
                if (stmt != null) {
                    stmt.close();
            } catch (SQLException se) {
                throw new DAOSysException("SQL Exception while closing " +
                "Statement : \n" + se);
        private void log(String s) {
            System.out.println(s);
    }Thank You

    Sorry its the UpdateObject.
    public void updateObject(Object model) throws
        DAOAppException, DAODBUpdateException,
        DAOSysException{
            ClubValue clubVal = (ClubValue) model;
            PreparedStatement stmt = null;
            try {
                String queryStr = "UPDATE " + "Club" +
                  " SET " + "ClubName = ?, " +
                  "NumberOfMembersEnrolled = ?, " +
                  "NumberOfCancelledYTD = ?, " +
                  "CurrentPromotion = ?, " +
                  "TotalUnitsSoldForClub = ?, " +
                  "MaximumPeriodOfObligation = ?, " +
                  "WHERE ClubName = ?";
                log("ClubDAO: Update String " + queryStr);
                stmt = globalTran.getDBConnection().prepareStatement(queryStr);
                log("ClubDAO: Prepare Worked ");
                stmt.setString(1, clubVal.getClubName());
                stmt.setInt(2, clubVal.getNumberOfMembersEnrolled());
                stmt.setInt(3, clubVal.getNumberOfCancelledYTD());
                stmt.setString(4, clubVal.getCurrentPromotion());
                stmt.setInt(5, clubVal.getTotalUnitsSoldForClub());
                stmt.setInt(6, clubVal.getMaximumPeriodOfObligation());
                log("ClubDAO: done setting items ");
                int resultCount = stmt.executeUpdate();
                if ( resultCount != 1 ) {
                    log("ClubDAO: update failed");
                    throw new DAODBUpdateException ("ERROR updating ClubD in" + " Club!! resultCount = " + resultCount);
                log("ClubDAO: update worked...result count = " + resultCount);
            } catch(SQLException se) {
                throw new DAOSysException("Unable to update item " + clubVal.getClubName() + " \n" + se);
            } finally {
                globalTran.closeStatement(stmt);
                log("ClubDAO: closeStatement");
        }

  • [Microsoft][ODBC Microsoft Access Driver] COUNT field incorrect

    Hello togehter!
    I get the following error when I try to execute a insert statment in a table:
    [Microsoft][ODBC Microsoft Access Driver] COUNT field incorrect
    I have a table with PictureID (Autowert), Path and Diagnostic (Strings)
    My preparedStatement is:
    INSERT INTO Pictures (Path, Diagnostic) VALUES (?,?)
    Any ideas??

    private static int addPicture(String path, String diagnostic)throws SQLException
              PreparedStatement statement = DataBase.getConnection().prepareStatement("INSERT INTO Pictures (Path, Diagnostic)" +
                   "VALUES (?,?)");
              statement.setString(1,path);
              statement.setString(1,diagnostic);
              statement.executeUpdate();
              statement.close();
    this is the part of my method that is nor working.
    Thanks for your help.

  • COUNT Field incorrect

    I'm trying to create a table in MSAccess jia the JDBC:ODBC bridge, it was working, but now i get the above error.
    Not sure if i've changed anything at all!
    Any ideas?

    I've tried it by giving different column names, and it works, is there a limit on the size of column name you can specify?
    I tried typing the query in access as a SQL query and it worked, even with quite long column names.
    Any ideas?

  • Error in program RFIDESM340. COUNT field

    I have solved the error with BR_BUKRS in the RFIDESM340 setting BFR in u201Clogical databaseu201D in program u201CAttributesu201D.
    But now I have a new error: u201C Field "COUNT" is unknown. It is neither in one of the specified tablesu201D.
    Has anyone had the same problem?
    I don´t found OSS notes or entries in this blog.
    Regards

    Hi FinTore,
    check with your ABAP responsible in your tema about this subject.

  • Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver

    Trying to Install RMS application 13.2.2 and I get past the pre-installation checks and when I get to the Data Source details and enter the data source details with the check box checked to validate the schema/Test Data Source I get the following error:
    Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver. Please check that the library path is set up properly or switch to the JDBC thin client oracle/jdbc/driver/T2CConnection.getLibraryVersioNumber()
    Checks performed:
    RMS Application code location and directory contents:
    [oracle@test-rms-app application]$ pwd
    /binary_files/STAGING_DIR/rms/application
    [oracle@test-rms-app application]$ ls -ltr
    total 144
    -rw-r--r-- 1 oracle oinstall   272 Dec 7  2010 version.properties
    -rw-r--r-- 1 oracle oinstall   405 Jan 16 2011 expected-object-counts.properties
    -rw-r--r-- 1 oracle oinstall   892 May 13 2011 ant.install.properties.sample
    -rw-r--r-- 1 oracle oinstall 64004 Jun  6  2011 build.xml
    drwxr-xr-x 9 oracle oinstall  4096 Jun 16 2011 rms13
    drwxr-xr-x 3 oracle oinstall  4096 Jun 16 2011 installer-resources
    drwxr-xr-x 3 oracle oinstall  4096 Jun 16 2011 antinstall
    drwxr-xr-x 2 oracle oinstall  4096 Jun 16 2011 ant-ext
    drwxr-xr-x 5 oracle oinstall  4096 Jun 16 2011 ant
    -rw-r--r-- 1 oracle oinstall 11324 Dec 18 09:18 antinstall-config.xml.ORIG
    -rwxr-xr-x 1 oracle oinstall  4249 Dec 18 10:01 install.sh
    drwxr-xr-x 4 oracle oinstall  4096 Dec 18 10:06 common
    -rw-r--r-- 1 oracle oinstall 16244 Dec 19 10:37 antinstall-config.xml
    -rw-r--r-- 1 oracle oinstall   689 Dec 19 10:37 ant.install.log
    [oracle@test-rms-app application]$
    Application installation:
    [oracle@test-rms-app application]$ ./install.sh
    THIS IS the driver directory
    Verified $ORACLE_SID.
    Verified SQL*Plus exists.
    Verified write permissions.
    Verified formsweb.cfg read permissions.
    Verified Registry.dat read permissions.
    Verified Java version 1.4.2.x or greater. Java version - 1.6.0
    Verified Tk2Motif.rgb settings.
    Verified frmcmp_batch.sh status.
    WARNING: Oracle Enterprise Linux not detected.  Some components may not install properly.
    Verified $DISPLAY - 172.16.129.82:0.0.
    This installer will ask for your "My Oracle Support" credentials.
    Preparing installer. This may take a few moments.
    Your internet connection type is: NONE
    Integrating My Oracle Support into the product installer workflow...
         [move] Moving 1 file to /binary_files/STAGING_DIR/rms/application
    Installer preparation complete.
    MW_HOME=/u01/app/oracle/Middleware/NewMiddleware1034
    ORACLE_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/as_1
    ORACLE_INSTANCE=/u01/app/oracle/Middleware/NewMiddleware1034/asinst_1
    DOMAIN_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/user_projects/domains/rmsClassDomain
    WLS_INSTANCE=WLS_FORMS
    ORACLE_SID=rmsdbtst
    JAVA_HOME=/u01/app/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0
    Launching installer...
    To make sure I have connectivity from the app server to the database (on a database server) here are the steps followed:
    [oracle@test-rms-app application]$ tnsping rmsdbtst
    TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 19-DEC-2013 10:41:40
    Copyright (c) 1997, 2008, Oracle.  All rights reserved.
    Used parameter files:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test-rms-db.vonmaur.vmc)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = rmsdbtst)))
    OK (0 msec)
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ sqlplus rms13@rmsdbtst
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Dec 19 10:46:18 2013
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ ping test-rms-db
    PING test-rms-db.vonmaur.vmc (192.168.1.140) 56(84) bytes of data.
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=1 ttl=64 time=0.599 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=2 ttl=64 time=0.168 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=3 ttl=64 time=0.132 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=4 ttl=64 time=0.158 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=5 ttl=64 time=0.135 ms
    --- test-rms-db.vonmaur.vmc ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4001ms
    rtt min/avg/max/mdev = 0.132/0.238/0.599/0.181 ms
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ uname -a
    Linux test-rms-app.vonmaur.vmc 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ cat /etc/*-release
    Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)
    Red Hat Enterprise Linux Server release 5.3 (Tikanga)
    [oracle@test-rms-app application]$
    The database is created and all the batch file scripts have been successfully deployed.  Now working on the application server.  The  Weblogic server is installed and 11g forms and reports are installed successfully.
    Any help would be helpful.
    Thanks,
    Ram.

    Please check MOS Notes:
    FAQ: RWMS 13.2 Installation and Configuration (Doc ID 1307639.1)

  • Syntax error in field definition

    Hello,
    Does java sun default driver support data type BLOB? I need create a table name PERSONS, and then store it to Access Database. But, every time when I run the program, it shows the following message:
    SQLException: [Microsoft] [ODBC Microsoft Access Driver]
    Syntax error in field definition.
    Below are the code, does any one have any idea about the problem?
    import java.sql.*;
    public class CreatePersons {
         public static void main(String args[]) {
              String url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=Database\\DB1.mdb";
              Connection con;
              String createString;
              Statement stmt = null;
              createString = "create table PERSONS " +
                                       "(PersonName VARCHAR (20) NOT NULL, " +
                                       "PersonPicture BLOB (64K) NOT NULL," +
                                       "PRIMARY KEY( PersonName )" +
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              } catch(java.lang.ClassNotFoundException e) {
                   System.err.print("ClassNotFoundException: ");
                   System.err.println(e.getMessage());
              try {
         con = DriverManager.getConnection(url,
                   stmt = con.createStatement();                                   
                   stmt.executeUpdate(createString);
                   stmt.close();
                   con.close();
              } catch(SQLException ex) {
                   System.err.println("SQLException: " + ex.getMessage());
    Thanks,
    Daniel

    It doesn't have anything to do with the java driver.
    You are passing DDL. That goes directly to the MS Access interface (the ODBC driver and the supporting dlls.)
    There are two possibilities.
    - The ODBC driver (and support) does not allow you to create blobs.
    - The syntax you are using is wrong (this would be my guess.)
    For the second case you might try creating the table in Acces, then use tools->analyze->documentor to produce the SQL description for that table. Whatever it produces is probably the output that it expects.

  • "[Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition

    I am creating a program in Java which has a Database reference application.The Database I am using is MS Access.But whenever I am trying to run the program from DOS Prompt(ie executing the program:java <program name>) I am unable to connenct to the database.The compiling of the program doesn't show any error(ie javac <program name>) The following error is displayed at the DOS Prompt:
    "[Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition."
    Pls give me a detailed help report.If it is a Machine side problem do help me to solve it.Mine is a Compaq Presario Machine,OS:Windows 98,Database:MS Access(Office XP)
    I request you to help me in this matter.Pls email ur responses to:
    [email protected]
    [email protected]

    hi there
    did u configure ur ODBC setting if no then try these steps
    ================== ODBC Settings ========================
    step 1 : go to control panel
    step 2 : ODBC Data Sources
    step 3 : click UserDSN Tab
    step 4 : click ADD Button , Select Microsoft Access Driver , Finish
    step 5 : Give Datasource Name as "DATABASE_NAMEXXX" , no double quotes
    step 6 : use Select and select Database_NAME.mdb from <INSTALL DIRECTORY>\DATABASE_NAME.mdb
    click ok , ok finish
    <INSTALL DIRECTORY> is where yr database is
    =========================================================
    then in yr program
    URL for yr database
    "jdbc:odbc:DATABASE_NAMEXXX" // as name in step 5
    and Driver is
    "sun.jdbc.odbc.JdbcOdbcDriver"
    if u done all these steps then check yr spelling of table and tabel field in yr program
    hope this works for u
    regards
    Satinderjit

Maybe you are looking for

  • XI 3.1 Upgrade

    After I completed the from XI R2 SP4 to XI R3.1  the only service that I have running is Apache Tomcat 5.5.20 and nothing else.  I can't sign on to the Central Management Console.  Can someone please help? One issue that I had during the install was

  • Change of Output

    Hi..I have the query, While running the transaction Mb5T, I  want to display the output of MB5T default in the detail list. But As of now it is showing the output with header and Item level detail. there is a  field Layout in the Selction screen of M

  • Flashing Border in Java ...

    I've spent about three days looking for a way to make a flashing border in Java. I want to be able to play the game while this border flashes around the title. What is the best recommended method to do this .. and why .. and how? .. Swing timers ? ba

  • Feature request: Replaygain support for FLAC files

    Hi guys, When converting some of my mp3's to FLAC, I noticed that the REPLAY_GAIN_TRACK tags are not used by the Walkman app on my Z3C. It works perfectly for mp3 files though. This is a real obstacle for me as I do not like having to change the volu

  • Is cs3 Extended compatible with Windows 7?

    Before installing cs3 extended onto my new computer, I was needing to know if it is compatible with Windows 7. I see that cs3 is compatible but what about the extended version? It is a Windows Home Premium 64 bit version Thank you for your help, Crys