Java JDBC-ODBC GROUP BY (aggregate function) error

I get the error
"java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that does not include the specified expression 'CUSTOMER_ID' as part of an aggregate function."
when I try to execute the following query:
PreparedStatement stmt = connection.prepareStatement(
"SELECT Customers.customer_id, Customers.customer_name, SUM(Transactions.surcharge) AS surcharge, SUM(Transactions.interchange) AS interchange, SUM(Transactions.approved) AS transactions " +
"FROM (Customers INNER JOIN Terminals ON Customers.customer_id = Terminals.customer_id) " +
"INNER JOIN Transactions ON Terminals.terminal_id = Transactions.terminal_id " +
"WHERE Transactions.transaction_date=#12/8/2003# " +
"GROUP BY Customers.customer_id, Customers.customer_name",
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY
Funny thing is this query works fine when I execute it in Microsoft Access directly. I can't figure out what's causing the problem. Any help?

Have you tried:
PreparedStatement stmt = connection.prepareStatement(
"SELECT Customers.customer_id, Customers.customer_name, SUM(Transactions.surcharge) AS surcharge, SUM(Transactions.interchange) AS interchange, SUM(Transactions.approved) AS transactions " +
"FROM (Customers INNER JOIN Terminals ON Customers.customer_id = Terminals.customer_id) " +
"INNER JOIN Transactions ON Terminals.terminal_id = Transactions.terminal_id " +
"WHERE Transactions.transaction_date=#12/8/2003# " +
"GROUP BY customer_id, customer_name",
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY
(Who knows ?... Sometimes SQL engines are very strangely built!)

Similar Messages

  • Group By Select Statement aggregate function error.

    I am using Dreamweaver MX4 and have an ASP web page. I can easily do this in Access 2007 a simple "group by" sum totals statement.
    Why can I not get this to work on a web page? Are the "#" signs messing this up in the Code2 Select Statement?
    How can I get Code2 to work correctly? Code1 works fine. A user enters the customer and a date range on a form and submits request. I get error message in Dreamweaver. You tried to execute a query where the specified expression field3 is not part of an aggregate function
    Code1. This works fine SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #1/2/09# AND Field6 <= #1/30/09#  GROUP BY Field3, Field10
    Code2. I get error message SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #Date1# AND Field6 <= #Date2#  GROUP BY Field3, Field10

    I am using Dreamweaver MX4 and have an ASP web page. I can easily do this in Access 2007 a simple "group by" sum totals statement.
    Why can I not get this to work on a web page? Are the "#" signs messing this up in the Code2 Select Statement?
    How can I get Code2 to work correctly? Code1 works fine. A user enters the customer and a date range on a form and submits request. I get error message in Dreamweaver. You tried to execute a query where the specified expression field3 is not part of an aggregate function
    Code1. This works fine SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #1/2/09# AND Field6 <= #1/30/09#  GROUP BY Field3, Field10
    Code2. I get error message SELECT Field3, Field10, SUM(Field16) as SumofField16 FROM CustomerHistory_CP WHERE Field3 LIKE '%Search_Criteria%' AND Field6 >= #Date1# AND Field6 <= #Date2#  GROUP BY Field3, Field10

  • Java JDBC:ODBC self Register

    Hi,
    I have an application that uses Microsoft Access data base. I am connecting to the data base using jdbc:odbc bridge. I want to know if it is possible to register the data base DNS automatically, not manually(Control Panel-> Administrative Tools -> Data Source Name (ODBC) on Windows OS) to connect to it.
    Thanks.

    No, goodieguy is incorrect.
    It's easy to connect to M$ Access without having to set up a DSN. Your database URL looks like this:
    String url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\full\\path\\to\\your\\AccessDatabase.mdb";You can even change the database at runtime with this. - MOD

  • How good is the java jdbc-odbc bridge in 1.4.0?

    Hi,
    Can anybody tell me whether this bridge (in the latest SE, 1.4.0) does things like ResultSet.UpdateRow()...
    i.e. jdbc 2.0 functionality? I keep getting an ArrayOutOfBounds exceptoin...
    if not, can anyone recommend a good, free driver for use with MS Access?
    Thanks,
    Mike

    And as I suggested...
    http://forum.java.sun.com/thread.jsp?thread=256557&forum=48&message=957478

  • Group by + aggregate function / report

    Helloo,
    we have a report with following sql statment
    SELECT
    "SPREEDSHEET_TABLE"."SCHEMA_NAME" "SCHEMA_NAME",
    "SPREEDSHEET_TABLE"."DATABASE_NAME" "DATABASE_NAME",
    "SPREEDSHEET_TABLE"."SERVER_NAME" "SERVER_NAME"
    ,max(CURRENT_DATE)
    FROM
    pritesh.SPREEDSHEET_TABLE
    group by SCHEMA_NAME, DATABASE_NAME, SERVER_NAME
    We would like the report to also show Patch_number field but every time we add the field name
    to the report sql fails unless we also add it to the group by function too,
    is there anyway around this ?

    select <br>
         schema_name<br>
         ,database_name<br>
         ,server_name<br>
         ,current_date<br>
         ,patch_number<br>
    from<br>
         spreadsheet_table a<br>
    where current_date=<br>
         (<br>
              select max(current_date) from spreadsheet_table<br>
              where schema_name=a.schema_name and database_name=a.database_name and server_name=a.server_name<br>
         )<br><br>
    Dave<br>
    lehr.servehttp.com

  • BI Java JDBC connector problem

    Hi friends,
          Our BW 3.5 system is working on win2003 with ms-sql db with sp10/J2EE 6.40 with SP8. When try to configure BI java jdbc driver it is giving following error in IE
    java.lang.ClassFormatError: com/sap/ip/bi/sdk/trialarea/connector/servlet/TestJdbc630 (Bad magic number)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at com.sap.engine.services.deploy.server.ApplicationLoader.defineClassWithInterception(ApplicationLoader.java:168)
         at com.sap.engine.services.deploy.server.ApplicationLoader.loadLocalClass(ApplicationLoader.java:140)
         at com.sap.engine.frame.core.load.ResourceLoader.loadClass(ResourceLoader.java:143)
         at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:303)
         at com.sap.engine.services.servlets_jsp.server.runtime.context.WebComponents.getServlet(WebComponents.java:306)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:121)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    anybody could help me resolving this?
    Thanks,
    Krishna

    Scott,
           Thanks for your prompt reply. I done the configuration based on doc u refered to me. But still getting the same error in browser. This is the link
    https://qbiwd1:50200/tjdbc/servlet/testjdbc I am entering into the brower. Following error persisting
    java.lang.classformaterror: com/sap/ip/bi/sdk/trialarea/connector/servlet/TestJdbc630 (Bad magic number)
    For your information I upgraded J2EE engine from 6.30 sp3 to 6.40 sp8
    Is error might be related with "TestJdbc630" file?
    Your help would be greatly appreciated
    Thanks,
    Krishna

  • Jdbc-odbc java error using SQL adapter in o9iASWireless

    I've used the SQL adapter in the previous releases of wireless without any problem. Most of the time I would use it for all the wireless PLSQL applications in the Oracle database and it works very OK.
    I have also used it to connect with a SQLserver database to try out some queries. In this case I would use the standard JDBC/ODBC bridge driver from SUN.
    In release 2.0 I can't connect with this SQL Server database anymore.
    I've added a system DSN to the ODBC configuration of the Windows 2000 server. This will give access to a internal SQL server database via TCP. A password username is required.
    When I try to add a SQLservice in the service designer using the SQL adapter I will use the following parameters:
    JDBC connect string: JDBC:ODBC:<DSNNAME>
    JDBC driver: sun.jdbc.odbc.JdbcOdbcDriver
    un: <username>
    pw: password>
    Query (without ';'): select count(*) from <tablename>
    Minimum number of Database connections in the pool 5
    Maximum number of Database connections in the pool 100
    Increment size for the connection pool 1
    Idle Timeout (in minutes) 30
    Now I get the following error:
    2/8/03 2:27:59 PM ERROR : [ApplicationServerThread] webtool.common.PtgErrorLog.outputError(PtgErrorLog.java:28)
    oracle.cabo.servlet.event.PageEventException: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcConnection,page=Page[name=designer/MasterServiceInitCreate],event=PageEvent[name=goto,source=wizardNav,fromPage=designer/MasterServiceInitCreate,JDBC_DRIVER=sun.jdbc.odbc.JdbcOdbcDriver,JDBC_CONNECT_STRING=jdbc:odbc:<DSNNAME>,CONNPOOL_INC=1,CONNPOOL_MIN=5,CONNPOOL_IDLETIMEOUT=30,USERNAME=<USERNAME>,value=4,SQLTYPE=QUERY,CONNPOOL_MAX=100,STATEMENT=select count(*) from bedrijven,PASSWORD=<PASSWORD>],rootCause=oracle.panama.adapter.AdapterException: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcConnection
    at oracle.cabo.servlet.event.BasePageFlowEngine.handleRequest(Unknown Source)
    at oracle.cabo.servlet.AbstractPageBroker.handleRequest(Unknown Source)
    at oracle.panama.webtool.common.PtgPageBroker.handleRequest(PtgPageBroker.java:152)
    at oracle.cabo.servlet.PageBrokerHandler.handleRequest(Unknown Source)
    at oracle.cabo.servlet.BajaServlet.doGet(Unknown Source)
    at oracle.cabo.servlet.BajaServlet.doPost(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:633)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:235)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:695)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:248)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    I got the error 'java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcConnection' in my log and tried to find out the meaning of this error at java.sun.com. It's stil not clear what exactly causes the error but it looks like a data formatting error.
    java.lang.ClassCastException
    (Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example, the following code generates a ClassCastException:
    Object x = new Integer(0);
    System.out.println((String)x); )
    Is it just a data formatting problem or has it something to do with the JDBC/ODBC driver version of the JDK from the appliction server release 2.0.
    I remember that I was always able to connect to the SQL server database with previous releases also with a count query. I've also used JDK 1.3.1 with o9iAS release 1.0.2.1.
    Any suggestions for a solution?
    Thanks in advance for your help.

    try this link:
    http://community.eapps.com/showthread.php?p=8

  • Jdbc:odbc:MSAccess Error

    Hi All,
    I am trying to establish a link to my access database (easy enough u would think!!!) via sun.jdbc.odbc.JdbcOdbcDriver and i get this really horrible error message :-
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D36
    Function=[Unknown.]
    Library=C:\Program Files\Java\j2re1.4.0\bin\client\jvm.dll
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possi
    reason and solutions.
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.setStmtAttrPtr(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLSetStmtAttrPtr(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.setRowStatusPtr(Unknown S
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(Unknown Source
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(Unknown Sour
    - locked <02A7D658> (a sun.jdbc.odbc.JdbcOdbcStatement)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Sour
    at testPSConnection.main(testPSConnection.java:47)
    Dynamic libraries:
    0x00400000 - 0x00406000 C:\WINNT\system32\java.exe
    0x77F80000 - 0x77FFB000 C:\WINNT\System32\ntdll.dll
    0x77DB0000 - 0x77E0B000 C:\WINNT\system32\ADVAPI32.dll
    0x77E80000 - 0x77F35000 C:\WINNT\system32\KERNEL32.DLL
    0x77D40000 - 0x77DB0000 C:\WINNT\system32\RPCRT4.DLL
    0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
    0x6D330000 - 0x6D445000 C:\Program Files\Java\j2re1.4.0\bin\
    ll
    0x77E10000 - 0x77E74000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
    0x77570000 - 0x775A0000 C:\WINNT\system32\WINMM.dll
    0x6D1D0000 - 0x6D1D7000 C:\Program Files\Java\j2re1.4.0\bin\
    0x6D300000 - 0x6D30D000 C:\Program Files\Java\j2re1.4.0\bin\
    0x6D210000 - 0x6D228000 C:\Program Files\Java\j2re1.4.0\bin\
    0x6D320000 - 0x6D32D000 C:\Program Files\Java\j2re1.4.0\bin\
    0x6D250000 - 0x6D25A000 C:\Program Files\Java\j2re1.4.0\bin\
    0x1F7B0000 - 0x1F7E1000 C:\WINNT\system32\ODBC32.dll
    0x71780000 - 0x7180A000 C:\WINNT\system32\COMCTL32.dll
    0x76B30000 - 0x76B6E000 C:\WINNT\system32\comdlg32.dll
    0x70BD0000 - 0x70C34000 C:\WINNT\system32\SHLWAPI.DLL
    0x782F0000 - 0x78532000 C:\WINNT\system32\SHELL32.DLL
    0x1F850000 - 0x1F866000 C:\WINNT\system32\odbcint.dll
    0x1F8F0000 - 0x1F932000 C:\WINNT\System32\odbcjt32.dll
    0x1B000000 - 0x1B16F000 C:\WINNT\System32\msjet40.dll
    0x1B5C0000 - 0x1B655000 C:\WINNT\System32\mswstr10.dll
    0x77A50000 - 0x77B46000 C:\WINNT\system32\ole32.dll
    0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.dll
    0x1F8E0000 - 0x1F8EE000 C:\WINNT\System32\odbcji32.dll
    0x1B2C0000 - 0x1B2CD000 C:\WINNT\System32\msjter40.dll
    0x1B2D0000 - 0x1B2F6000 C:\WINNT\System32\MSJINT40.DLL
    0x775A0000 - 0x77625000 C:\WINNT\system32\CLBCATQ.DLL
    0x1B7F0000 - 0x1B82A000 C:\WINNT\System32\msjtes40.dll
    0x10750000 - 0x1075B000 C:\WINNT\system32\VBAJET32.DLL
    0x10B70000 - 0x10BD2000 C:\WINNT\system32\expsrv.dll
    0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
    0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
    0x690A0000 - 0x690AB000 C:\WINNT\system32\PSAPI.DLL
    Local Time = Tue Feb 18 04:29:58 2003
    Elapsed Time = 0
    # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
    # Error ID : 4F530E43505002D5
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode)
    # An error report file has been saved as hs_err_pid1380.log.
    # Please refer to the file for further information.
    I know the code is ok,
    i am running this on win2k with java 1.3 and java1.4.0_01 run time,
    Any ideas would be very gratefully recieved.
    Thanks in advance..
    Sajid

    actually i got this working by downloading the latest sdk for java
    j2se 4.01.
    So if anyone has a similar problem, thats what you should do!!!
    I think there was a problem with the hotspot runtime environment before, but its all sorted now.

  • Error in using aggregate function in Outer Query in Siebel Analytics

    Hi,
    When I am using aggregate function in outer query in Siebel Analytics I am facing error.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 59111] The SQL statement must include a GROUP BY clause. (HY000)
    Bellow is the code.
    SELECT test1.username saw_0, test1.desg saw_1,COUNT (test2.querydate) saw_2
    FROM (SELECT POSITION.CBL username,
    POSITION.CBP desg
    FROM "CM"
    WHERE (POSITION.BPTCD = 'Marketing')
    AND (POSITION.EDate =TIMESTAMP '1899-01-01 00:00:00'
    ) test1,
    (SELECT users.UN username,
    measures."Query Count" querycount,
    measures."Max Total Time" secs,
    topic.db dashboardname,
    "Query Time".DATE querydate
    FROM "Plan"
    WHERE (topic."Dashboard Name" IN ('DS'))) test2
    WHERE test2.username = LOWER (test1.username)
    AND test2.dashboardname = 'DS'
    GROUP BY test1.username, test1.desg

    Should your query be a valid SQL query?
    I can't think that the query you have would be valid in a SQL plus window.
    Chris

  • Aggregate functions cannot be used in group expressions

    Hi have report showing sales by Vendor. I need to list all the vendors with Monthly Total>5000 and combine the rest as "OTHER VENDORS"
    Vendor is a Group in my report, so I tried to put an expression as a Group on:
    =IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
    I've got an error: "aggregate functions cannot be used in group expressions"
    How do I get Vendors with Sales < 5000 into  "OTHER VENDORS" ?

    Hi,
    You need to group by Month on group expression,
    And you can use the same expression in the report column as 
    =IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
    Many Thanks
    ..................................................................................................................................................................Please
    mark the post as Please mark the post as answered if this post helps to solve the post.

  • SQLAllocHandle on SQL_HANDLE_ENV failed - JDBC-ODBC Error

    Hai,
    i am connecting the Oracle 8i by using the JDBC-ODBC Driver. When i get connection by using the DriverManager, it throws the following Error.
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed
    Please advise me
    Thanks in Advance
    Regards
    sankarjune14

    Respected Sir/Madam,
    i am connecting the Oracle 8i by using the JDBC-ODBC
    Driver. When i get connection by using the
    DriverManager, it throws the following Error.
    Driver's SQLAllocHandle on SQL_HANDLE_ENV failed.
    the dsn name already created succeesfully. then also i am
    getting this run time error
    plz give me a solution.

  • Stored Procedure error with JDBC:ODBC

    Hi,
    I am trying to run a stored procedure on RDMS (Uniaccess ODBC). This has 2 input parameters and returns a resultset of 3 columns. The following is the error I am getting and am stumped. Please help..
    (similar call statement works with VB and ADO)
    --------output ---------------
    Calling MGC005
    inside resultset sun.jdbc.odbc.JdbcOdbcCallableStatement@129206
    row 1
    get string 0004
    get string 00000
    get string
    SQLEcception : java.sql.SQLException: [AIS][UniAccess ODBC Driver]Invalid Column Number//Specified column is before the column specified in the previous call
    ----------------------source code ------------------
    import java.awt.Graphics;
    import java.sql.*;
    public class JdbcTest {
    public JdbcTest() {
         Connection con;
         CallableStatement stmt;
    try {
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
    catch (Exception ex) {
    System.out.println ("Database Driver not found");
    System.exit(0);
    try {
    String msDbUrl = "jdbc:odbc:CMS_TEST_ODBC";
    con = DriverManager.getConnection(msDbUrl, user, password );
    stmt = con.prepareCall("{ call MGC005(?, ?)}");
              stmt.setString( 1, "CH" );
              stmt.setString( 2, "ARRINGTON0909170320010615" );
    //          stmt.registerOutParameter( 1, java.sql.Types.VARCHAR);
    //          stmt.registerOutParameter( 2, java.sql.Types.VARCHAR );
    //           stmt.registerOutParameter( 3, java.sql.Types.VARCHAR );
              System.out.println( "Calling MGC005 " );
         ResultSet rs = stmt.executeQuery();
              while (rs.next()) {
    System.out.println( " inside resultset " + rs.getStatement() );
    System.out.println( " row " + rs.getRow() );
    System.out.println( " get string " + rs.getString(1) );
    System.out.println( " get string " + rs.getString(2) );
    System.out.println( " get string " + rs.getString(3) );
              String i = rs.getString (1);
              String s = rs.getString (2);
              String t = rs.getString (3);
    String text = i + " " + s ;
    System.out.println ( " Output " + text);
         stmt.close();
    con.close();
    } catch( SQLException ex ) {
    System.out.println ("SQLEcception : " + ex);
    public static void main(String[] args) {
    new JdbcTest();
    }

    Hi,
    The error seems to occur on the line:
    String i = rs.getString (1);
    The error exactly states what is occuring: "Specified column is before the column specified in the previous call". Try limiting the call to getString() to one for each column for each row.
    Try replacing these lines:
    System.out.println( " get string " + rs.getString(1) );
    System.out.println( " get string " + rs.getString(2) );
    System.out.println( " get string " + rs.getString(3) );
    String i = rs.getString (1);
    String s = rs.getString (2);
    String t = rs.getString (3);
    with something like:
    String i = rs.getString (1);
    System.out.println( " get string " + i);
    String s = rs.getString (2);
    System.out.println( " get string " + s);
    String t = rs.getString (3);
    System.out.println( " get string " + t);
    Hope this works,
    Kurt.

  • JDBC/ODBC Error

    Hello,
    I'm testing the following code that contects to an Access Database
    import java.sql.*;
    public class AccessTest
    public static void main(String[] args)
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String dataSourceName = "scan";
    String dbURL = "jdbc:odbc:" + dataSourceName;
    Connection con = DriverManager.getConnection(dbURL, "","");
    Statement s = con.createStatement
    ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    s.execute("select * from test");
    ResultSet rs = s.getResultSet();
    if (rs != null) // if rs == null, then there is no ResultSet to view
    while ( rs.next() ) // this will step through our data row-by-row
    /* the next line will get the first column in our current row's ResultSet
    as a String ( getString( columnNumber) ) and output it to the screen */
    // System.out.println(rs.getString("f_name")+"\t\t");
    rs.updateString("l_name","Welcomer ");
    rs.updateRow();
    // System.out.println("Last Name: "+rs.getString(2));
    System.out.println("Number: "+rs.getString(3));
    System.out.println("Age: "+rs.getString(4));
    //System.out.println("Date: "+rs.getDate(5));
    //Date tmp = rs.getDate(5);
    System.out.println();
    s.close(); // close the Statement to let the database know we're done with it
    con.close(); // close the Connection to let the database know we're done with it
    catch (Exception err) {
    System.out.println("ERROR: " + err);
    the code that is commented out, was done so as I tried to debug this. What I'm trying to do is update the field l_name in a record. Yes I know using SQL update will do it, but I need to it this way for my application that I'm designing. The error I get is
    java.sql.SQLException :[Microsoft][ODBC Microsoft Access Driver] Error in row.
    the table in question only has 3 entries. The last name is updated for the first only, thus the error is coming up before the result set is moved by one. Please advise.
    Thanks in advance

    Instead of multi-posting, why don't you just post a link to your other one(s), like this:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=337252
    Anyway, my guess is that maybe the MS Access driver doesn't allow updateable resultsets.

  • Java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error

    Hi all,
    I am able to INSERT and SELECT records from FoxPRo database successfully.
    The driver is Sun JDBC-ODBC bridge
    The DELETE statement throws no exception.
    I've tried to execute PACK after the DELETE call and got following exception:
    java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.So I tried USE MYTABLE EXCLUSIVE in a Statement before calling PACK and got the exception:
    java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error or access violationI've also tried inserting the USE MYTABLE EXCLUSIVE before calling DELETE but got the same exception above.
    The ODBC DSN for MYTABLE is setup as:
    - Free Tables (not database)
    - Null (checked)
    - Deleted (checked)
    - Fetch data in background (checked)
    I am not able to issue any of the following commands to FoxPro using java
    OPEN - To open a table
    CLOSE - To close a table
    USE - To open a table for uer either in exclusive mode or shared mode
    The exception being generated is :
    java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Syntax error or access violationThe help file of the Microsoft Visual Foxpro Driver states that the driver has support for the above commands.I a not able to get the way to issue the above commands to the driver using java.
    In setting up the ODBC DSN I saw no "read only" setting.
    In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are no delete permission grants and there is no user database sesssion concept.
    I've tried all of the above with DSN mapped to a database(NOT free tables) and setting AUTO-COMMIT OFF and AUTO-COMMIT ON.But in vain. The same exceptions as those stated above persisted.
    Environment:
    Microsoft Windows XP Professional
    JDK version "1.4.2_09"
    Microsoft Visual Foxpro 06.00.8167
    Microsoft Visual Foxpro Driver 6.01.8629.01
    Don't know what else to try.
    Can anybody please help me.
    Thanks in advance
    Archana

    java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]File must be opened exclusively.
    In the Visual Foxpro table, I saw no READ ONLY settings.And also, there are
    no delete permission grants and there is no user database sesssion concept.
    The ODBC DSN for MYTABLE is setup as:
    - Free Tables (not database)
    - Null (checked)
    - Deleted (checked)If you're using Visual Foxpro database(.DBC), you should see "Exclusive" option too. You can try check it, but I don't know whether your issue will disappear.

  • Access database/ java application/ jdbc odbc

    i am building an access database with a java application and get the following error message when i try to run the application. the log in window that i have does not have a password text field, only a field for the odbc name.
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Not a valid password.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:2488)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:317)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:160)

    User/password are usually necessary to set up the ODBC source. So you may need find out who set up your ODBC source. Or you need find the correct user/password and reset the ODBC source.
    PC

Maybe you are looking for

  • Error while creating a overwrite method in class

    Hello. I'm trying to create an overwrite method in the class CL_HREIC_EECONTACT2SRCHV_IMPL but it just won't let me. Every time I try I get the message "The class has not yet been converted to the new class-local types" and I cannot create it.The thi

  • Oracle upgrade problem from 8.1.6.2.0 to 9.2.0.3.0

    We have upgraded our database to version 9.2.0.3.0 from version 8.1.6.2.0. Everything is fine accept a proprietory encryption package that utilises the UTL_RAW package and stores working variables in a PL/SQL Record structure consisting of 6 RAW(4) f

  • Syncing Contacts between iPad2 and MobileMe

    Every iPad sync overrides the data on the MobileMe server. Thus, I can not update Contacts neither on any PC (Outlook) nor on the MacBook, as the updates would disappear after the next sync with MobileMe. As a workaound, I currently update contacts o

  • FSG Percent Sign

    1. FSG report that I created has Variance % column. How do i append percent (%) sign to all the values under this column. Is there a option in FSG that i can make use of for this? for e.g 10% instead of just 10. 2. Row set in the FSG report has multi

  • Safari 8.0 forgets website setting

    Safari 8.0.2 forgets website setting after a few days or a week. My issue is the stock chart. Browser remembers (i think) my favorite setting of graph, but after a few days to a week, it all resets. This is annoying. I've never had issue with Chrome