JDBC-ODBC sql update

Hi, Could any kind souls please enlighten me as to how can I update a group of objects store on the same table ?? For example, I wanted to add int 10 to existing value in every row under column5.
I've tried this but JVM returns NullPointerExp during runtime.
while(result_set()){
account = result_set.getInt(5);
account += 5;
result_set.updateInt(5,account); //JVM returns exception at this point
result_set.updateRow;

Hey, "hambone2", you are really an a**hole, no doubt. Don't you have anything to do at all beside posting some rude comments on other people's questions? You are stupid, rude, and uneducated. Get a life man! You bullsh*iting too much in this forum. An advice for you: treat other people with respect. What goes around comes around. May be you retard havent' noticed this old saying yet. Have a nice life, you dumb f*ck.

Similar Messages

  • Microsoft][ODBC SQL Server Driver]Optional feature not implemented

    this is my program code for java jdbc:odbc SQL connectivity
    but iam getting the error as
    *java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented*
    package desktopapplication2;
    import java.sql.*;
    * @author Bharat Raj Verma
    public class db {
        void get(String gr,String fn,String ln,String job ,Integer rate,Integer ot,String att,long amt,String cmt)
          try
             Connection con=null,con1=null;
            Statement stmt2;
            String query = "Update dbo.attend SET Gr = ? , fn = ? ,ln = ?, job = ? , rate = ? , ot = ? , att = ? ,amt = ? , comment = ?";
           // String query1 = "Select accnum rom dbo.newacc where accnum= ?";
            String url = "jdbc:odbc:bharat";
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            con = DriverManager.getConnection(url,"","");
            con1 = DriverManager.getConnection(url,"","");
            System.out.println("connection Established");
            stmt2 = con.createStatement();
            Statement stmt = con1.createStatement();
            ResultSet rs;
            rs=stmt.executeQuery("select * from dbo.attend");
            while(rs.next())
                String cmp1= rs.getString("gr");
                if(cmp1.equalsIgnoreCase(gr))
                        PreparedStatement ps1 = con.prepareStatement(query);
                        System.out.println("Insisde RS");
                        ps1.setString(1,gr);
                        ps1.setString(2,fn);
                        ps1.setString(3,ln);
                        ps1.setString(4,job);
                        ps1.setInt(5,rate);
                        ps1.setInt(6,ot);
                        ps1.setString(7,att);
                        ps1.setLong(8,amt);
                        ps1.setString(9,cmt);
                        System.out.println("SSS");
                      //  ps1.setString(1,gr);
                        ps1.executeUpdate();
                       System.out.println("Success");
          catch(Exception e1)
              System.err.println(e1);
    }This is the SQL table in which iam trying to insert the value
    SET ANSI_PADDING OFF
    create table attend
    Gr VARCHAR(20) primary key,
    fn VARCHAR (25),
    ln VARCHAR(25),
    job VARCHAR(25),
    rate integer,
    ot integer,
    att varchar(10),
    amt varchar (10),
    comment varchar(70)
    )the complete output is
    init:
    deps-jar:
    Compiling 1 source file to C:\Documents and Settings\Bharat Raj Verma\My Documents\NetBeansProjects\DesktopApplication2\build\classes
    compile:
    run:
    connection Established
    Insisde RS
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    BUILD SUCCESSFUL (total time: 29 seconds)
    here is the stack trace
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
    at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(JdbcOdbc.java:1225)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(JdbcOdbcPreparedStatement.java:592)
    at desktopapplication2.db.get(db.java:47)
    at desktopapplication2.DesktopApplication2View.jButton1ActionPerformed(DesktopApplication2View.java:394)
    at desktopapplication2.DesktopApplication2View.access$800(DesktopApplication2View.java:22)
    at desktopapplication2.DesktopApplication2View$4.actionPerformed(DesktopApplication2View.java:183)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:5517)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5282)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3984)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1791)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Plz can anyone help ???

    and what was the solution?
    thanks in advance
    brindy

  • SQL Developer 2.1.1 : JDBC/ODBC Bridge

    Hi, I am running SQL Developer 2.1.1 and would like to to access databases other than those formally supported.
    I am happy to use the JDBC/ODBC Bridge - although additional JDBC connectivity would be ideal, I gather that it is not supported.
    Googling, and searching on this forum, implies that I should install the appropriate JDBC driver for the Bridge, list it on the third party JDBC drivers Preferences page, and that a 'Create Connection' dialog JDBC tab would then appear on restarting SQL Developer, as happens when you install the supported MySQL JDBC driver, for example.
    I am sorry to be dim, but I cannot track down a jar file containing the JDBC/ODBC Bridge that is supported by SQL Developer to the extent of enabling the JDBC tab. The rt.jar shipped in SQL Developer's JRE does not do the job. Checking for updates from the Help menu lists nothing that looks even remotely relevant. Where should I be looking?
    Thanks a lot
    Mandy Shaw
    Edited by: 845622 on Mar 18, 2011 10:59 AM - Clarified - sorry

    The additional connection types only appear for supported databases.
    I haven't tried this, but I vaguely remember some discussions from a long time ago.
    Make sure the jar file (and any supporting DLLs) are on your classpath (probably dropping them in the extensions directory will do it) and then in the new connection dialog select 'Advanced' connection type. This lets you enter a JDBC URL in any format so you can enter what is required for your additional databases.
    If this works, the most it will get you is a SQL Worksheet with no completion insight or syntax checking. Because SQL Developer doesn't know how to use the database catalogue, the object navigator won't work.

  • Limitations of Statement.addBatch() jdbc:odbc bridge to SQL Server 2K

    Hi all,
    I was attempting some performance tuning in my applications and I attempted to use the addBatch method in a statement during a loop and the corresponding executeBatch when the loop is complete. For some reason all my inserts were not sent to the database. So I did a test. I wrote some code that would allow me to create 'X' amount of sql statements and add them to batch and execute. Here's a sample of my code:
    void jButton7_actionPerformed(ActionEvent e)
    try
    if(connect == null)
    String url = "jdbc:odbc:someDataSourceName";
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    connect =
    DriverManager.getConnection( url, "****", "****");
    System.out.println("Connection supports batch updates T/F = " + connect.getMetaData().supportsBatchUpdates());
    int x = new Integer(fldNumOfLoops.getText()).intValue();
    java.sql.Statement stat = connect.createStatement();
    stat.addBatch("create table stutemp (somecolumn varchar(200)); ");
    for(int i = 0; i < x; i++)
    stat.addBatch("insert into stutemp (somecolumn) values('This is a test of inserting row Number " + i + "'); ");
    java.sql.Timestamp tsNow = new java.sql.Timestamp(new java.util.Date().getTime());
    stat.executeBatch();
    System.out.println("Batching " + x + " rows started " + tsNow + " ended " + new java.sql.Timestamp(new java.util.Date().getTime()));
    stat.close();
    stat = null;
    stat = connect.createStatement();
    java.sql.ResultSet rs = stat.executeQuery("select count(*) from stutemp");
    while(rs.next())
    System.out.println("Results returned from sb batching = " + rs.getString(1));
    stat.close();
    stat = null;
    stat = connect.createStatement();
    stat.execute("drop table stutemp");
    connect.close();
    connect = null;
    catch(Exception ex)
    ex.printStackTrace();
    For some reason, I'm only safe inserting 455 records along with the table create. sometimes it will allow me to insert 456, or 457, but never any more than that. And it fluctuates. Does anyone know why this is? Is there a size limit on adding statements to batch? For giggles, I created a String Buffer version where I'm adding statements to a stringbuffer and doing an execute on the statement. I'm getting the same results.
    Thanks,
    Stu

    Sorry, One more thing. If I put a Thread.Sleep(); after the execute batch I get more inserts depending on the amount of time I tell my thread to sleep.........
    What's up with this. Shouldn't this be a Sync process where the calling thread should wait until the statement executes????????????????

  • JDBC:ODBC Crashes in driver when doing update

    I am getting a crash in the native code when trying to update a record through an updateable record set using the JDBC:ODBC bridge. I have appended the crash information at the bottom of this message gotten from the Forte output window. This is going to SQL Server 2000. Through the Beta JDBC driver everything works fine, but through ODBC it always crashes no matter what columns I pick so it doesn't seem to be data type related. I would just use the JDBC driver, but that is not a option for some of our clients. I have used Insert statements without a problem, but one of the fields in one table is a BLOB field and I don't know of any way to access it except through an updatable record set.
    Does anyone have any ideas about how I might get around this?
    Thanks
    Scott Herter
    Napersoft, Inc.
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x411611BD
    Function=Ordinal78+0x11BD
    Library=C:\WINNT\System32\SQLSRV32.dll
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.setPos(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLSetPos(JdbcOdbc.java:4709)
    at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5019)
    at sun.jdbc.odbc.JdbcOdbcResultSet.updateRow(JdbcOdbcResultSet.java:4053)
    at DBTest.UpdateBlob(DBTest.java:445)
    at DBTest.main(DBTest.java:64)
    Dynamic libraries:
    0x00400000 - 0x00406000 G:\Forte\JDK14~1.0\bin\java.exe
    0x77F80000 - 0x77FFB000 C:\WINNT\System32\ntdll.dll
    0x77DB0000 - 0x77E0C000 C:\WINNT\system32\ADVAPI32.dll
    0x77E80000 - 0x77F35000 C:\WINNT\system32\KERNEL32.DLL
    0x77D40000 - 0x77DAD000 C:\WINNT\system32\RPCRT4.DLL
    0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
    0x6D330000 - 0x6D442000 G:\Forte\JDK14~1.0\jre\bin\client\jvm.dll
    0x77E10000 - 0x77E74000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
    0x77570000 - 0x775A0000 C:\WINNT\System32\WINMM.dll
    0x6D1D0000 - 0x6D1D7000 G:\Forte\JDK14~1.0\jre\bin\hpi.dll
    0x6D300000 - 0x6D30D000 G:\Forte\JDK14~1.0\jre\bin\verify.dll
    0x6D210000 - 0x6D228000 G:\Forte\JDK14~1.0\jre\bin\java.dll
    0x6D320000 - 0x6D32D000 G:\Forte\JDK14~1.0\jre\bin\zip.dll
    0x6D260000 - 0x6D27C000 G:\Forte\JDK14~1.0\jre\bin\jdwp.dll
    0x6D160000 - 0x6D166000 G:\Forte\jdk1.4.0\jre\bin\dt_shmem.dll
    0x6D2D0000 - 0x6D2DD000 G:\Forte\jdk1.4.0\jre\bin\net.dll
    0x75050000 - 0x75058000 C:\WINNT\System32\WSOCK32.dll
    0x75030000 - 0x75043000 C:\WINNT\System32\WS2_32.DLL
    0x75020000 - 0x75028000 C:\WINNT\System32\WS2HELP.DLL
    0x785C0000 - 0x785CC000 C:\WINNT\System32\rnr20.dll
    0x77980000 - 0x779A4000 C:\WINNT\System32\DNSAPI.DLL
    0x77340000 - 0x77353000 C:\WINNT\System32\iphlpapi.dll
    0x77520000 - 0x77525000 C:\WINNT\System32\ICMP.DLL
    0x77320000 - 0x77337000 C:\WINNT\System32\MPRAPI.DLL
    0x75150000 - 0x75160000 C:\WINNT\System32\SAMLIB.DLL
    0x75170000 - 0x751BF000 C:\WINNT\System32\NETAPI32.DLL
    0x77BE0000 - 0x77BEF000 C:\WINNT\System32\SECUR32.DLL
    0x751C0000 - 0x751C6000 C:\WINNT\System32\NETRAP.DLL
    0x77950000 - 0x7797A000 C:\WINNT\system32\WLDAP32.DLL
    0x77A50000 - 0x77B3A000 C:\WINNT\system32\OLE32.DLL
    0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.DLL
    0x773B0000 - 0x773DE000 C:\WINNT\System32\ACTIVEDS.DLL
    0x77380000 - 0x773A2000 C:\WINNT\System32\ADSLDPC.DLL
    0x77830000 - 0x7783E000 C:\WINNT\System32\RTUTILS.DLL
    0x77880000 - 0x7790D000 C:\WINNT\System32\SETUPAPI.DLL
    0x77C10000 - 0x77C6E000 C:\WINNT\System32\USERENV.DLL
    0x774E0000 - 0x77512000 C:\WINNT\System32\RASAPI32.DLL
    0x774C0000 - 0x774D1000 C:\WINNT\System32\RASMAN.DLL
    0x77530000 - 0x77552000 C:\WINNT\system32\TAPI32.DLL
    0x716F0000 - 0x7177A000 C:\WINNT\system32\COMCTL32.DLL
    0x70BD0000 - 0x70C1C000 C:\WINNT\system32\SHLWAPI.DLL
    0x77360000 - 0x77379000 C:\WINNT\System32\DHCPCSVC.DLL
    0x775A0000 - 0x77625000 C:\WINNT\System32\CLBCATQ.DLL
    0x777E0000 - 0x777E8000 C:\WINNT\System32\winrnr.dll
    0x777F0000 - 0x777F5000 C:\WINNT\System32\rasadhlp.dll
    0x74FD0000 - 0x74FEF000 C:\WINNT\system32\msafd.dll
    0x75010000 - 0x75017000 C:\WINNT\System32\wshtcpip.dll
    0x6D250000 - 0x6D25A000 G:\Forte\jdk1.4.0\jre\bin\JdbcOdbc.dll
    0x1F7F0000 - 0x1F825000 C:\WINNT\System32\ODBC32.dll
    0x76B30000 - 0x76B6E000 C:\WINNT\system32\comdlg32.dll
    0x782F0000 - 0x7852F000 C:\WINNT\system32\SHELL32.DLL
    0x1F8E0000 - 0x1F8F6000 C:\WINNT\System32\odbcint.dll
    0x41160000 - 0x411D3000 C:\WINNT\System32\SQLSRV32.dll
    0x41090000 - 0x410BD000 C:\WINNT\System32\SQLUNIRL.DLL
    0x77800000 - 0x7781D000 C:\WINNT\System32\WINSPOOL.DRV
    0x77820000 - 0x77827000 C:\WINNT\system32\VERSION.dll
    0x759B0000 - 0x759B6000 C:\WINNT\system32\LZ32.DLL
    0x769A0000 - 0x769A7000 C:\WINNT\System32\NDDEAPI.DLL
    0x0F470000 - 0x0F486000 C:\WINNT\System32\sqlsrv32.rll
    0x0F4A0000 - 0x0F4BA000 C:\WINNT\System32\odbccp32.dll
    0x74CB0000 - 0x74CC7000 C:\WINNT\System32\DBNETLIB.DLL
    0x75500000 - 0x75504000 C:\WINNT\System32\security.dll
    0x77440000 - 0x774B5000 C:\WINNT\System32\crypt32.dll
    0x77430000 - 0x77440000 C:\WINNT\System32\MSASN1.DLL
    0x782D0000 - 0x782EE000 C:\WINNT\system32\msv1_0.dll
    0x77BF0000 - 0x77C01000 C:\WINNT\System32\ntdsapi.dll
    0x74CD0000 - 0x74CD7000 C:\WINNT\System32\DBmsLPCn.dll
    0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
    0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
    0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL
    Local Time = Thu Aug 22 11:40:22 2002
    Elapsed Time = 28
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.0-b92 mixed mode)
    # An error report file has been saved as hs_err_pid1804.log.
    # Please refer to the file for further information.

    I am no guru,
    but I have written BLOBS into DB2 via JDBC and I use a Prepared Statement, this works well for me.
    // Below is some code I originally mimicked and It worked well for me.
    // hope it it useful. I have never used SQLServer :-(
    import java.io.*;
    import java.sql.*;
    public void insertBlob( int rowid, byte[] bindata ) {
    // In this example I'm assuming there's an open, active
    // Connection instance called 'con'.
    // This examples uses an imaginary SQL table of the following
    // form:
    // CREATE TABLE blobs (
    //    ROWID INT NOT NULL,
    //    ROWDATA BLOB,
    //    PRIMARY KEY (rowid)
    try {
    ByteArrayInputStream bais = new ByteArrayInputStream(bindata);
    String sql = "INSERT INTO blobs ( rowid, rowdata ) VALUES ( ?, ? )";
    PreparedStatement ps = con.prepareStatement(sql);
    // Set up the parameter index for convenience (JDBC column
    // indices start from 1):
    int paramindex = 1;
    // Set the first parameter, the Row ID:
    ps.setInt(paramindex++, rowid);
    // Now set the actual binary column data by passing the
    // ByteArrayInputStream instance and its length:
    ps.setBinaryStream(paramindex++, bais, bindata.length);
    // Finally, execute the command and close the statement:
    ps.executeUpdate();
    ps.close();
    } catch ( SQLException se ) {
    System.err.println("Couldn't insert binary data: "+se);
    } catch ( IOException ioe ) {
    System.err.println("Couldn't insert binary data: "+ioe);
    } finally {
    con.close();
    }

  • Newbie: Problem with jdbc-odbc and MS SQL server 2005

    I'm on win vistax64 with SQLSERVER 2005 and I have set up the odbc source as system dsn using the SQL Native Client driver with SQL authentication and the connectivity test in the end succeeds.
    I'm trying to make a simple web app that will connect to the database and perform simple querries. It's a school assignment.
    I'm using the jdbc-odbc bridge because it's the simplest way to do it and it's what we were shown in class.
    I get the following irritating error:
    "Cannot establish a connection to jdbc:odb:sstmdb using sun.jdbc.odbc.JdbcOdbcDriver ([Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifies)".
    I'm working with netbeans 5.5.1 and this error is what I get when in the runtime tab I try to connect with the jdbc-odbc. I get a similar error in the logs when I try to run the app on the j2ee server.
    This is the java class that establishes the connection.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Connector {
        private static final String dbUrl="jdbc:odbc:sstmdb";
        private static final String user="kimon";
        private static final String password="jackohara";
        public static Connection getConnection(){
            Connection conn = null;
            try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                conn = DriverManager.getConnection(dbUrl,user,password);
            } catch (SQLException e) {
                e.printStackTrace(); 
            } catch (ClassNotFoundException e) {
                e.printStackTrace(); 
            return conn;
    }It has worked perfectly on my school PC with winXP and MSDE2000.
    What am I missing?

    Ok, help came from an other way where I was inquiring about a different problem:
    Connectivity works fine by using User DSN instead of System DSN for the ODBC source.

  • 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

  • Is it possible to use Jdeveloper with Other Sql Server using JDBC-ODBC bri

    I have been able to successfully establish connection with Sql server Using JDBC-ODBC bridge, but when i run the application and perform some operations such as insert the following errors occur:
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT ItmUnit.ORG_CODE, ItmUnit.UNIT_CODE, ItmUnit.UNIT_NAME, ItmUnit.ADDRESS1, ItmUnit.ADDRESS2, ItmUnit.ADDRESS3, ItmUnit.CITY_CODE, ItmUnit.USER_ID, ItmUnit.TIME_STAMP FROM ITM_UNIT ItmUnit
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [DataDirect][ODBC Sybase Wire Protocol driver]Sybase does not allow more than one active statement when retrieving results without a cursor
    (oracle.jbo.DMLException) JBO-26041: Failed to post data to database during "Insert": SQL Statement "INSERT INTO IMMS.HRM_UNIT(UNIT_CODE,UNIT_NAME) VALUES (?,?)".
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
    (oracle.jbo.AttrValException) JBO-27014: Attribute DeptCode in HrmUnitDept is required
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT HrmUnit.UNIT_CODE, HrmUnit.UNIT_NAME FROM IMMS.HRM_UNIT HrmUnit
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt

    Yes, you can do that. For testing purposes you can also create simple files (with mkfile) and add these to ASM. That way you could also experiment with deleting files and see what happens in ASM
    Bjoern

  • JDBC MS SQL Server driver catch SQLException on Update statement

    Hi,
    We change the driver for the BEA WebLogic Type 4 JDBC MS SQL Server driver
    driver=weblogic.jdbc.sqlserver.SQLServerDriver
    url=jdbc:bea:sqlserver://db_name:port_number
    since we use this driver we got an error when the application try to update a field date type with a NULL value.
    Before, we use this driver and we didn't have this error
    driver=com.inet.tds.TdsDriver
    url=jdbc:inetdae:ammtl1sqls01:1961
    The stack is:
    Failed to update - id [updateItemBranch] - parameterObject [xxx.domain.store.Item@b0237c].
    Cause:com.ibatis.common.jdbc.exception.NestedSQLException:
    --- The error occurred in com/gildan/ecrm/persistence/sql/Item.xml.
    --- The error occurred while applying a parameter map.
    --- Check the updateItemBranch-InlineParameterMap.
    --- Check the parameter mapping for the 'availableDate' property.
    --- Cause: java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driver
    Caused by: java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driver

    Carol Villeneuve wrote:
    Hi,
    We change the driver for the BEA WebLogic Type 4 JDBC MS SQL Server driver
    driver=weblogic.jdbc.sqlserver.SQLServerDriver
    url=jdbc:bea:sqlserver://db_name:port_number
    since we use this driver we got an error when the application try to update a field date type with a NULL value.
    Before, we use this driver and we didn't have this error
    driver=com.inet.tds.TdsDriver
    url=jdbc:inetdae:ammtl1sqls01:1961
    The stack is:
    Failed to update - id [updateItemBranch] - parameterObject [xxx.domain.store.Item@b0237c].
    Cause:com.ibatis.common.jdbc.exception.NestedSQLException:
    --- The error occurred in com/gildan/ecrm/persistence/sql/Item.xml.
    --- The error occurred while applying a parameter map.
    --- Check the updateItemBranch-InlineParameterMap.
    --- Check the parameter mapping for the 'availableDate' property.
    --- Cause: java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driver
    Caused by: java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driverHi. You should do two things:
    1 - Contact BEA support for the very latest versions of the weblogic drivers.
    2 - show us the actual jdbc code being called, and the full original stacktrace
    of the SQLException.
    Joe

  • MS SQL Server 7 thru JDBC:ODBC bridge

    Hi,
    I am trying to access MS SQL server 7 thru JDBC ODBC bridge. I am finding my varchar data is being truncated to 255 characters. Any help on this would be appreciated.

    Any body know of a good type 4 jdbc driver for SQL
    Server 7. There is one for SQL server 2000
    downloadable from micrsoft site, but does it work for
    sql server 7 too ?Older betas of this driver suported SQL Server 7, but I believe the plan is to specifically remove that capability in its final release.
    My biased opinion would be to try the driver from DataDirect. http://www.ddtek.com Its their driver (an older version) that Microsoft has licensed for MS SQl 2000.
    Getting it from DataDirect has a couple obvious advantages:
    1. Its a later, more stable, better performing version
    2. It will continue to Support MS SQL 7
    3. It's suported by 24/7 phone,email and web tech support.
    4. And, early this week, you should be able to get the latest 3.0 release which promises to be even more robust, in addition to conforming to the new specs.
    5. its not free, but then again- you get what you pay for...

  • How to connect Sql Server 2000 using JDBC ODBC Driver

    How to connect Sql Server 2000 using JDBC ODBC Driver ?
    plz Send Syntax.
    thanks

    In SQL Server 2000 the driver class is com.microsoft.jdbc.sqlserver.SQLServerDriver
    The connection URL for the default SQL Server 2000 database is jdbc:sqlserver://localhost:1433
    Class.forName(
      "com.microsoft.sqlserver.jdbc.
      SQLServerDriver");
    String url =
      "jdbc:sqlserver://localhost:1433";
    Connection conn = DriverManager.
      getConnection(
      url, "sa", "sqlserver");

  • JDBC-ODBC-Bridge connection to SQL Database

    Hi guys
    I have a problem. I've made a little game which I want to put on my website. It has a highscore-list which I want to connect to my web host's database server to get the current list.
    I tried this with JDBC and got it to work locally but when I uploaded it to my site it didn't work. I contacted my web host's technical support who told me that their server didn't have the JDBC driver and that I should use ODBC instead. I did lots of reading and found out about this JDBC-ODBC-Bridge. I have since been trying to implement this into my program but hasn't been successful.
    In my original JDBC connection I used
    private String url = "jdbc:mysql://" + host +  "/" + mydatabase;
    Class.forName("com.mysql.jdbc.Driver");
    Connection connection = DriverManager.getConnection(url, username, password);Now I'm trying
    private String url = "jdbc:odbc://" + host + "/" + database;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection = DriverManager.getConnection(url, username, password);But, at least when trying it locally, I get the error
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name is too long.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3073)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at HighscoreDB.readFile(HighscoreDB.java:53)
    at HighscoreDB.displayList(HighscoreDB.java:97)
    at HighscoreDB.main(HighscoreDB.java:33)Please help ;)
    Edited by: YZF-R1 on 2009-apr-09 13:26

    YZF-R1 wrote:
    masijade. wrote:
    Do you know what ODBC is?I think I at least have the basic idea, I learnt most of what I know from this post:
    [http://forums.sun.com/thread.jspa?threadID=211735&start=2&forumID=48]
    masijade. wrote:
    While "reading about this JDBC-ODBC Driver" did you also read about how to enter the URLs for it?No, I couldn't find that piece of information, why don't you tell me ;)
    Here
    >
    masijade. wrote:
    Did also read about the fact about needing to configure ODBC DSNs? Or about the fact that the connection URL is radically different if you don't configure one?No I did not. Please explain =)
    Here
    >
    PhHein wrote:
    Plus, JDBC-ODBC Bridges are evil!I'm beginning to realize this myself :O:(
    BalusC wrote:
    Drop that whole ODBC idea and just gently read the documentation which come along with the MySQL JDBC driver.I read a lot of it when I used the JDBC driver locally but how's that going to help me if the server doesn't have the JDBC driver installed?How will the Bridge help you if the ODBC Driver is not installed? And, the JDBC Driver (the Type 4.0 ones, which the MySQL Driver is) is 100% Java, so it can even be included in an Applet, if the HTML page that accesses it is done right, and the jars are "packaged" properly.

  • Java Web Analyzer security hole in SQL Query Spreadsheet using JDBC-ODBC bridge

    Hi,<BR><BR>I use Hyperion Analyzer 7.0.1 on Windows 2003 and relation database DB2 v8.2.<BR><BR>I did:<BR>1. log in to Java Web Analyzer<BR>2. button New<BR>3. Select Layout: Custom Report<BR>4. from toolbar pull down to desktop "SQL Spreadsheet" option<BR>5. "Enter SQL Query" window opens, from JDBC Driver drop down window select "JDBC-ODBC Bridge"<BR>6. in "JDBC Connection String" window replace "db1" string with database name<BR>7. leave JDBC Username and JDBC Password empty (this is default)<BR>8. click on "Test Connection" button.<BR>9. "Test Connection" window opens with message "Connection Succeded"!!! So connection to database without password succeeded.<BR>10. in "SQL Query window" write any SQL you wish and Database will execute the SQL.<BR><BR><b>Conclusion: Connecting Analyzer with SQL Spreadsheet option to relation database DB2 is possible without password.</b><BR><BR>Question: Is there any way to prevent users from executing "SQL Spreedsheet" option?<BR><BR>Thanks,<BR>Grofaty

    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection(dsn,"guest","guest");
    OR DriverManager.getConnection(dsn);
    System.out.println("Conection's opened");
    catch(ClassNotFoundException cnfe)
    System.err.println(cnfe);
    catch(SQLException sqle)
    System.err.println(sqle);
    try that code and double check you DSN Name . it's a good practice to greate a system DSN.
    i hope that helps.
    FEEL FREE TO ASK. WON'T BITE U
    ABDUL

  • Getting Sql Exception while using JDBC/ODBC to Excel 2007 through Java

    Iam getting the SQLexception by trying to connect using JDBC/ODBC to Excel 2007 through Java. Any Guys can tell abt this problem. java.sql.SQLException: [Microsoft][ODBC Excel Driver] External table is not in the expected format.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at InteractWithExcel.main(InteractWithExcel.java:13)

    From [Google Groups|http://groups.google.co.uk/group/sybase.public.powerbuilder.general/browse_frm/thread/97fbab02a5e6d45b]
    To use Excel as a datasource, you need to defined a named range in the spreadsheet, with the first row containing the column names.

  • Ms Access problems with Jdbc Odbc!!!

    Hi again people,
    Im creating a GUI swing project connecting a database (MsAccess) to a dialog using the bridge driver,
    The GUI is coming up but im getting runtime errors and the data does not go to the fields, the dialog and connection are in two files:
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*; //SQL package for the statements
    import javax.swing.*;
    class DatabaseMan
         public ResultSet m_resultSet; //recordset resulting from SQL query
         public ResultSetMetaData m_rsmd; //used to get general info about the columns
         private int m_nNumberOfFields; //number of fields in a recordset
         private Connection conn;
         private Statement stmt;
         public DatabaseMan(String strSQLQuery)
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");          
                   try               //establish connection to the database
                        //try to get connection to the database
                        conn = DriverManager.getConnection("jdbc:odbc:db1");
                        //this is not where we update the database so we make it read only
                        stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
                                                                     ResultSet.CONCUR_READ_ONLY);                                   
                        m_resultSet = stmt.executeQuery(strSQLQuery);
                   catch(SQLException exSQL)
                        System.err.println("\n\n\t\t ***SQLException has" +
                                                 "been caught ***\n\n");
                   while ( exSQL != null)
                        System.err.println("\nSQLState : " + exSQL.getSQLState() );
                   System.err.println("\nMessage : " + exSQL.getMessage() );
                             System.err.println("\nVendor code : "+ exSQL.getErrorCode() );
                             System.err.println("\n");
                             exSQL = exSQL.getNextException();
              catch( ClassNotFoundException e)
                   System.err.print("\n\n\tClassNotFoundException has"
                                       +" been caught");
                   System.err.println( e.getMessage());
              catch( java.lang.Exception ex )
                   ex.printStackTrace();
         public void CloseConnection() //close connection to database
              try
                        conn.close();
                        stmt.close();
                        m_resultSet.close(); //release the resources
                   catch (SQLException exSQL )
                        System.out.println("SQL Exception: " + exSQL.getMessage());
                        exSQL.printStackTrace(System.out);
         public int getNoFields()
              return m_nNumberOfFields;
    } //end of DatabaseMan.java
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import DatabaseMan;
    import javax.swing.*;
    class DBviewer extends JDialog implements ActionListener
         //JButtons to create toolbar
         private JButton m_buttonFirst;
         private JButton m_buttonNext;
         private JButton m_buttonPrevious;
         private JButton m_buttonLast;
         private JButton m_buttonClose;
         private JButton m_mainbuttonClose;
         //textfields to transfer the data from database
         private JTextField m_name;
         private JTextField m_age;
         private JTextField m_weight;
         private JTextField m_professionalism;
         private JTextField m_speed;
         private JTextField m_acceleration;
         private JTextField m_jump;
         private JTextField m_stamina;
         private JTextField m_bravery;
         private JTextField m_fitness;
         private JTextField m_experience;
         //labels to identify the textfields
         private JLabel m_labelname;
         private JLabel m_labelage;
         private JLabel m_labelweight;
         private JLabel m_labelspeed;
         private JLabel m_labelacceleration;
         private JLabel m_labelprofessionalism;
         private JLabel m_labeljump;
         private JLabel m_labelstamina;
         private JLabel m_labelbravery;
         private JLabel m_labelfitness;
         private JLabel m_labelexperience;
         DatabaseMan m_DatabaseMan;
         private String strSQLQuery1;
         private String type1 = new String("");
         public DBviewer(Frame parent, String caption, boolean bModal, String type)
              super(parent,caption,true);
              setSize(600,400);
              setLocation( new Point(150 , 150 )); //position it pops up on screen.
              setResizable(false);
              strSQLQuery1 = new String("");
              type1 = type;
              //SQL query to show the horse database
              if(type =="Horse")
                   strSQLQuery1 ="SELECT *" +
                                  "FROM HORSE";
                   buildHorseGUI();
              if(type =="Jockey")
                   strSQLQuery1 ="SELECT *" +
                                  "FROM JOCKEY"+
                                  " ORDER BY NAME";
                   buildJockeyGUI();                         
              if(type =="Course")
                   strSQLQuery1 ="SELECT *" +
                   "FROM RACECOURSE"+
                                  " ORDER BY NAME";
                   buildCourseGUI();
              m_DatabaseMan = new DatabaseMan(strSQLQuery1);
              /*try
              {//reset values with default move up to top later
                   if(m_DatabaseMan.m_resultSet.first())
                        transferData(type1);
              catch( SQLException exSQL)
                   System.out.println("SQL Exception: " + exSQL.getMessage());
                   exSQL.printStackTrace(System.out);
         public void buildHorseGUI() //construct the horse GUI
              buildDefaultGUI(); //build default buttons and toolbar
              m_labelname = new JLabel(" Horse Name:",JLabel.CENTER);
              m_labelname.setBackground(Color.blue);
              m_labelname.setForeground(Color.white);
              m_labelage = new JLabel("Age: ",JLabel.CENTER);
              m_labelage.setBackground(Color.blue);
              m_labelage.setForeground(Color.white);     
              m_labelweight = new JLabel("Weight(p): ",JLabel.CENTER);
              m_labelweight.setBackground(Color.blue);
              m_labelweight.setForeground(Color.white);
              m_labelspeed = new JLabel("Speed:",JLabel.CENTER);
              m_labelspeed.setBackground(Color.blue);
              m_labelspeed.setForeground(Color.white);
              m_labelacceleration = new JLabel("Acceleration:",JLabel.CENTER);
              m_labelacceleration.setBackground(Color.blue);
              m_labelacceleration.setForeground(Color.white);
              m_labelprofessionalism = new JLabel("Professionalism:",JLabel.CENTER);
              m_labelprofessionalism.setBackground(Color.blue);
              m_labelprofessionalism.setForeground(Color.white);
              m_labeljump = new JLabel("Jump:",JLabel.CENTER);
              m_labeljump.setBackground(Color.blue);
              m_labeljump.setForeground(Color.white);
              m_labelstamina = new JLabel("Stamina:",JLabel.CENTER);
              m_labelstamina.setBackground(Color.blue);
              m_labelstamina.setForeground(Color.white);     
              m_labelbravery = new JLabel("Bravery:",JLabel.CENTER);
              m_labelbravery.setBackground(Color.blue);
              m_labelbravery.setForeground(Color.white);
              m_labelfitness = new JLabel("Fitness:",JLabel.CENTER);
              m_labelfitness.setBackground(Color.blue);
              m_labelfitness.setForeground(Color.white);     
              m_labelexperience = new JLabel("Experience",JLabel.CENTER);
              m_labelexperience.setBackground(Color.blue);
              m_labelexperience.setForeground(Color.white);          
              //creation of textfields to hold the data
              //making them non-editable and b/ground of black with white text
              m_name = new JTextField(20);
              m_name.setEditable(false);
              m_name.setBackground(Color.black);
              m_name.setForeground(Color.white);
              m_age = new JTextField(2);
              m_age.setEditable(false);
              m_age.setBackground(Color.black);
              m_age.setForeground(Color.white);
              m_weight = new JTextField(3);
              m_weight.setEditable(false);
              m_weight.setBackground(Color.black);
              m_weight.setForeground(Color.white);
              m_speed = new JTextField(2);
              m_speed.setEditable(false);
              m_speed.setBackground(Color.black);
              m_speed.setForeground(Color.white);
              m_acceleration = new JTextField(2);
              m_acceleration.setEditable(false);
              m_acceleration.setBackground(Color.black);
              m_acceleration.setForeground(Color.white);
              m_professionalism = new JTextField(2);
              m_professionalism.setEditable(false);
              m_professionalism.setBackground(Color.black);
              m_professionalism.setForeground(Color.white);
              m_jump = new JTextField(2);
              m_jump.setEditable(false);
              m_jump.setBackground(Color.black);
              m_jump.setForeground(Color.white);
              m_stamina = new JTextField(2);
              m_stamina.setEditable(false);
              m_stamina.setBackground(Color.black);
              m_stamina.setForeground(Color.white);
              m_bravery = new JTextField(2);
              m_bravery.setEditable(false);
              m_bravery.setBackground(Color.black);
              m_bravery.setForeground(Color.white);
              m_fitness = new JTextField(2);
              m_fitness.setEditable(false);
              m_fitness.setBackground(Color.black);
              m_fitness.setForeground(Color.white);
              m_experience = new JTextField(2);
              m_experience.setEditable(false);
              m_experience.setBackground(Color.black);
              m_experience.setForeground(Color.white);
              //create a panel to hold this data
              Panel data = new Panel();
              data.setLayout(new GridLayout(0,4));
              data.setBackground(Color.blue);
              data.add(m_labelname);
              data.add(m_name);
              data.add(m_labelage);
              data.add(m_age);
              data.add(m_labelweight);
              data.add(m_weight);
              data.add(m_labelspeed);
              data.add(m_speed);
              data.add(m_labelacceleration);
              data.add(m_acceleration);
              data.add(m_labelprofessionalism);
              data.add(m_professionalism);
              data.add(m_labeljump);
              data.add(m_jump);
              data.add(m_labelstamina);
              data.add(m_stamina);
              data.add(m_labelbravery);
              data.add(m_bravery);
              data.add(m_labelfitness);
              data.add(m_fitness);
              data.add(m_labelexperience);
              data.add(m_experience);
              getContentPane().add(data, BorderLayout.CENTER);
         public void buildDefaultGUI() //construct the default components for GUI
              JToolBar wndToolBar = new JToolBar();
              wndToolBar.setBackground(Color.green);
              wndToolBar.setFloatable(false);
              m_buttonFirst = new JButton( new ImageIcon( "graphic/myFirst.gif" ) );
              m_buttonPrevious = new JButton(new ImageIcon( "graphic/myPrevious.gif" ) );
              m_buttonNext = new JButton(new ImageIcon( "graphic/myNext.gif" ) );
              m_buttonLast = new JButton(new ImageIcon( "graphic/myLast.gif" ) );
              m_buttonClose = new JButton(new ImageIcon( "graphic/myClose.gif" ) );
              m_mainbuttonClose = new JButton("CLOSE");
              // implement action listener
              m_buttonFirst.addActionListener(this);
              m_buttonPrevious.addActionListener(this);
              m_buttonNext.addActionListener(this);
              m_buttonLast.addActionListener(this);
              m_buttonClose.addActionListener(this);
              m_mainbuttonClose.addActionListener(this);
              //set the tool tips for each of the button
              m_buttonFirst.setToolTipText( "Display first record" );
              m_buttonPrevious.setToolTipText( "Display previous record" );
              m_buttonNext.setToolTipText( "Display next record" );
              m_buttonLast.setToolTipText( "Display last record" );
              m_buttonClose.setToolTipText( "Close this window and return to game" );
              m_mainbuttonClose.setToolTipText( "Close this window and return to game" );
              m_mainbuttonClose.setBackground(Color.green);
              //add these buttons to the toolbar
              wndToolBar.add( m_buttonFirst );
              wndToolBar.add( m_buttonPrevious );
              wndToolBar.add( m_buttonNext );
              wndToolBar.add( m_buttonLast );
              wndToolBar.addSeparator(); //separator in the toolbar
              wndToolBar.add( m_buttonClose );
              getContentPane().add(wndToolBar, BorderLayout.NORTH);
              getContentPane().add(m_mainbuttonClose, BorderLayout.SOUTH);
         public void buildCourseGUI() //construct the course GUI
              buildDefaultGUI();
         public void buildJockeyGUI() //construct the jockey GUI
              buildDefaultGUI();
         public void actionPerformed( ActionEvent evt)
              //button first record is pressed
              if( evt.getSource() == m_buttonFirst )
                   try
                        if( m_DatabaseMan.m_resultSet.first() )
                             transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //button next record is pressed
              if( evt.getSource() == m_buttonNext )
                   try
                        if(!m_DatabaseMan.m_resultSet.isLast())
                             if(m_DatabaseMan.m_resultSet.next())
                                  transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //previous button is pressed
              if( evt.getSource() == m_buttonPrevious )
                   try
                        if( !m_DatabaseMan.m_resultSet.first())
                             if(m_DatabaseMan.m_resultSet.previous())
                                  transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //last button is pressed
              if( evt.getSource() == m_buttonLast )
                   try
                        if(m_DatabaseMan.m_resultSet.last())
                             transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              // close button(s) pressed
              if( evt.getSource() == m_buttonClose)
                   setVisible( false );
                   dispose(); //return the dialog window resources
                   m_DatabaseMan.CloseConnection();
              if( evt.getSource() == m_mainbuttonClose)
                   setVisible( false );
                   dispose(); //return the dialog window resources
                   m_DatabaseMan.CloseConnection();
         public void transferData(String type1) throws SQLException //return a String
              if(type1 =="Horse")
                   //transfer horse details
                   m_name.setText(m_DatabaseMan.m_resultSet.getString("NAME"));
                   m_professionalism.setText(m_DatabaseMan.m_resultSet.getString("PROFESSIONALISM"));
                   m_speed.setText(m_DatabaseMan.m_resultSet.getString("SPEED"));
                   m_stamina.setText(m_DatabaseMan.m_resultSet.getString("STAMINA"));
                   m_weight.setText(m_DatabaseMan.m_resultSet.getString("WEIGHT"));
                   m_experience.setText(m_DatabaseMan.m_resultSet.getString("EXPERIENCE"));
                   m_fitness.setText(m_DatabaseMan.m_resultSet.getString("FITNESS"));
                   m_jump.setText(m_DatabaseMan.m_resultSet.getString("JUMP"));
                   m_age.setText(m_DatabaseMan.m_resultSet.getString("AGE"));
                   m_bravery.setText(m_DatabaseMan.m_resultSet.getString("BRAVERY"));
                   m_acceleration.setText(m_DatabaseMan.m_resultSet.getString("ACCELERATION"));
              if(type1 =="Jockey")
                   m_name.setText(m_DatabaseMan.m_resultSet.getString("NAME"));
                   m_age.setText(m_DatabaseMan.m_resultSet.getString("AGE"));
              if(type1 =="Course")
                   //transfer course details not implemented yet
    } //end of class DBviewer
    I ve set up an odbc driver and the database has data in it but I still get this run time error an no data is transfered to the dialog box
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1525)
    at sun.jdbc.odbc.JdbcOdbcResultSet.reWordAsCountQuery(JdbcOdbcResultSet.java:6268)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount(JdbcOdbcResultSet.java:6061)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:250)
    at DatabaseMan.<init>(DatabaseMan.java:34)
    at DBviewer.<init>(DBviewer.java:83)
    at MainWindow.actionPerformed(MainWindow.java:266)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
    at java.awt.Component.processMouseEvent(Component.java:3715)
    at java.awt.Component.processEvent(Component.java:3544)
    at java.awt.Container.processEvent(Container.java:1164)
    at java.awt.Component.dispatchEventImpl(Component.java:2593)
    at java.awt.Container.dispatchEventImpl(Container.java:1213)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
    at java.awt.Container.dispatchEventImpl(Container.java:1200)
    at java.awt.Window.dispatchEventImpl(Window.java:914)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    Im really stuck!!! any suggestions? thanks in advance

    Thank you for your response and sorry for the length
    of code,
    Thats was my first idea that it was asking for
    or something I dont have but I checked my database and
    I dont have any unusually large data entries (most
    between 8-15 letters, the others are numbers) could it
    be something wrong with how I've entered the database
    in MsAccess, or am i barking up the wrong tree again!
    Many thanks
    RobI think you've misunderstood me. This has nothing to do with unusually large data entries, but rather the opposite. You are wrongly expecting data that is shorter than you think. When you call rs.getString(i) to retrieve a column value of a field, and you only want the first 5 characters in the column (instead of 10 or whatever the column size is), you would do something similar to the following:
    String column_value = rs.getString(1).subtstring(0,5);The above expects a String that is at least 5 characters. Your problem is when your column value returned is less than the specified substring index ( in this case 5 ) it will throw an exception. If you changed your code to this, the error will not occur:
    String column_value = rs.getString( 1 ).subtstring( 0, 5);
    if ( column_value.length() > 5 )
    column_value = column_value.substring( 0, 5 );
    }Jamie

Maybe you are looking for

  • Need Help to locate a file on a FTP server using MediaLocator class

    Hi Friends, This is Venkat. Iam currently working on a Multimedia J2EE web project. Iam working on a requirement to show Thumbnail view for uploaded media. For this i have downloaded a standalone code from the following site. http://www.exactfutures.

  • Exchange 2010 SP3 - Can DAG member be on OS 2012 R2 STD?

    Hi guys. We have Exchange 2010 SP3 on 2008 r2 enterprise. now we are thinking about having DAG. I know that recommendations is to have the same OS on 2nd Exchange server but still is it possible to make DAG between: Exchange 2010 SP3 on 2008 r2 enter

  • Documents needed for Report

    Hi Experts,                 To build a report  what are the documents that you are needed or prepared from Functional spec to UAT (User Acceptance Test) like busines Blue print..we had 4 only .Can u share your experience with me.. Thanks & Regards, S

  • Adobe flex in Net Weaver CE environment

    Hi All, How can i use adobe flex UI in application developed with NetWeaver CE.Please provide full details. Regards, surya.

  • VSOM 7.0.1 LDAP Filter AD

    Hello! LDAP server settings are as follows:  Name: SFC.LOCAL Host Name: 192.168.104.252 port: 389 Member of: %USERID%@sfc.local Database search for users: OU=Accounts,DC=sfc,DC=local User ID attribute: sAMAccountName How to create a filter selecting