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.

Similar Messages

  • 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.

  • Jdbc-odbc error in an applet

    I'm trying to use a jdbc-odbc driver to connect to a db. When I do this using an application I have not problems but I'm trying to do the same in an applet and I get this error message:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc
    Here is the part of the program where it happens
    try {
    Class.forName(driver);
    } catch(Exception ex) {
    setError("Can't find Database driver class: " + ex);
    return;
    I hope you can tell me

    copy this line in {jre}/lib/java.policy
    jre = java runtime directory
    permission java.lang.RuntimePermission "accessClassInPackage.sun.jdbc.odbc";

  • 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

  • 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.

  • Compile error when connecting to JDBC:ODBC

    Hi
    I am not used to java so probably this is an enivorment problem, but I cannot fix, please help!
    FOLLOWING CODE
    import java.sql.*;
    public class DBtest {
    public static void main (String args[]) {
    String jdbcDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String protocolHeader = "jdbc:odbc:";
    String dbName = "myodbc3-test";
    String user = "";
    String password = "";
    Class.forName(jdbcDriver);
    Connection cn =
    DriverManager.getConnection(protocolHeader+dbName, user, password);
    GENERATES FOLLOWING COMPILING ERROR
    cd c:/Javakod/NewFolder/
    javac -classpath C:\Javakod\ DBtest.java
    DBtest.java:17: incompatible types
    found : java.sql.Connection
    required: NewFolder.Connection
    DriverManager.getConnection(protocolHeader+dbName, user, password);
    ^
    1 error
    What is wrong? I am using a Win2000.

    This code compiles and runs fine on my Windows 2000 machine running JDK 1.4.1:
    import java.sql.*;
    public class AnotherConnectionTester
        public static void main(String [] args)
            String jdbcDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
            String protocolHeader = "jdbc:odbc:";
            String dbName = "myodbc3-test";
            String user = "";
            String password = "";
            try
                Class.forName(jdbcDriver);
                Connection cn = DriverManager.getConnection(protocolHeader+dbName, user, password);
                DatabaseMetaData meta = cn.getMetaData();
                System.out.println("product name: " + meta.getDatabaseProductName());
            catch (Exception e)
                e.printStackTrace(System.err);
    }I set up an ODBC DSN myodbc3-test to connect to an Access database. It was no problem. I guess that doesn't explain why your post didn't work. I changed the name of the class and added that meta data output so I could make sure that it connected. - MOD

  • 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.

  • JDBC-ODBC BRIDGE (General error)

    I get some time "SQLException : general error" on the screen followed by a "[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]General network error. Check your network documentation" when i am using the jdbc-odbc bridge on a jsp page
    My configuration:
    OS : WIN NT 4.0
    TOMCAT 4.0
    JSP
    Database : SQL server 2000
    Database driver: Sun JDBC-ODBC bridge
    Could it come from a concurrent access problem?
    Does anyone have an idea?
    Thank you,
    Deenesh

    I've found that the descriptive "General Error" message ususally means there's something wrong with my sql. If your db passes Navin's test (meaning it's up and running), then try to take your sql query and paste it into a sql window for your db. Sometimes this gets you an error message that is a little more descriptive.

  • URGENT: Error:  Failed to Load JDBC/ODBC Driver

    I have created a database in Access and created user interface for it. Whenever I run the program from DOS (i.e java CarRental) the program begins but when I try to add a customer or add a vehicle I get the error java.lang.ClassNotFoundException: com.ms.jdbc.odbc.JdbcOdbcDriver.
    However, if I run it directly from MVisual J++ 6 it connects to the database fine. I have installed J2SDK 1_4 on my computer. Should I make changes to the following code?
    String url = "jdbc:odbc:CarRental";
                   try{
         Class.forName( "com.ms.jdbc.odbc.JdbcOdbcDriver" );
         connection = DriverManager.getConnection(url);
    Since I downloaded J2SDK does it need to be "sun.jdbc.odbc.JdbcOdbcDriver"?
    Please help- time is running thin!
    Thanks
    Angie

    The correct classname for the JDBC:ODBC bridge is
    sun.jdbc.odbc.JdbcOdbcDriver
    Thomas

  • Jdbc-odbc bridge connection error

    Hi,
    Please help me to create a jdbc-odbc connection from Jdev10g to a TSM server database.
    I have created a database connection with the following parameters:
    Connection name: tsm1a
    Connection type: jdbc-odbc bridge
    Username: admin
    Password: ***
    Datasource name: tsm1 (this is the name of the DSN datasource name in my Windows ODBC DSN datasource)
    Extra parameters: NONE
    Clicking on the Test button shows Success!
    I have tried to launch the SQL worksheet, it is success and give me a correct result to my "select * from volumes" query.
    I have created a simple JSP page:
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/sqltaglib.tld"
    prefix="database"%>
    <html>
    <body>
    <database:dbOpen connId="c1" URL="jdbc:odbc:TSM1a" user="admin" password="***">
    <database:dbQuery connId="c1" output="html" queryId="q1" >
    select * from volumes
    </database:dbQuery>
    </database:dbOpen>
    </body>
    </html>
    The result of the run of it:
    javax.servlet.jsp.JspTagException: Failed to establish connection     at oracle.jsp.dbutil.tagext.dbOpenTag.doStartTag(dbOpenTag.java:115)
    Please help me, how to get a connection to the ODBC datasource from a jsp page.
    What is wrong in the URL string or elsewhere ?
    Thanks a lot in advance:
    Arpad

    Hi,
    Please help me to create a jdbc-odbc connection from Jdev10g to a TSM server database.
    I have created a database connection with the following parameters:
    Connection name: tsm1a
    Connection type: jdbc-odbc bridge
    Username: admin
    Password: ***
    Datasource name: tsm1 (this is the name of the DSN datasource name in my Windows ODBC DSN datasource)
    Extra parameters: NONE
    Clicking on the Test button shows Success!
    I have tried to launch the SQL worksheet, it is success and give me a correct result to my "select * from volumes" query.
    I have created a simple JSP page:
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/sqltaglib.tld"
    prefix="database"%>
    <html>
    <body>
    <database:dbOpen connId="c1" URL="jdbc:odbc:TSM1a" user="admin" password="***">
    <database:dbQuery connId="c1" output="html" queryId="q1" >
    select * from volumes
    </database:dbQuery>
    </database:dbOpen>
    </body>
    </html>
    The result of the run of it:
    javax.servlet.jsp.JspTagException: Failed to establish connection     at oracle.jsp.dbutil.tagext.dbOpenTag.doStartTag(dbOpenTag.java:115)
    Please help me, how to get a connection to the ODBC datasource from a jsp page.
    What is wrong in the URL string or elsewhere ?
    Thanks a lot in advance:
    Arpad

  • MS access,servlets and jdbc-odbc

    when i try to connect to ms access database using servlet i get unable to open registry key DriverId problem.
    servlet successfully extracts the form data.Even jdbc code alone works fine, but when jdbc code is embeded in servlet I get the above error.I am using java web server 2.0 and a jdbc-odbc(type 1) driver.
    Please help me.................!
    I cannot proceed with my project without solving this problem.

    You have not specified the exception class.
    If it is java.security, try peeping into jws security directory, and set the access to your servlet directory.
    I do not know this helped you or not.
    regards

  • How can i put a file into blob(using sun.jdbc.odbc.JdbcOdbcDriver)

    Hi
    i tried to put a file into blob , but got a problem.....
    My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
    a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
    //Statement stmt2=null;
    //Resultset rs2;
    //opa1 is the blob data
    void saveBlobTableToDisk(Connection con) {
    try {
    stmt2=con.createStatement();
    sqlStr2="SELECT * FROM emp3 where id=1004";
    rs2=stmt2.executeQuery(sqlStr2);
    while (rs2.next()) {
    Blob aBlob=rs2.getBlob("opa1");
    i got the exception :
    " null
    java.lang.UnsupportedOperationException
         at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
         at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
         at test3.Frame1.<init>(Frame1.java:26)
         at test3.Application1.<init>(Application1.java:5)
         at test3.Application1.main(Application1.java:8) "
    and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
    Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
    I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
    Or i must install oracle jdbc driver ?
    Thanks.

    My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
    Is there a reason that you can't use the Oracle driver?
    Justin

  • JDBC-ODBC Bridge to SPSS data files - Result Set Type is not supported

    Hello,
    As mentioned in the subject I am trying to read SPSS data files using the SPSS 32-Bit data driver, ODBC and the JDBC-ODBC Bridge.
    Using this SPSS Driver I manged to read the data directly into an MS-SQL Server using:
    SELECT [...] FROM
    OPENROWSET(''MSDASQL.1'',''DRIVER={SPSS 32-BIT Data Driver (*.sav)};DBQ=' SomePathWhereTheFilesAre';SERVER=NotTheServer'', ''SELECT 'SomeSPSSColumn' FROM "'SomeSPSSFileNameWithoutExt'"'') AS a
    This works fine!
    Using Access and an ODBC System DNS works for IMPORTING but NOT for LINKING.
    It is even possible to read the data using the very slow SPSS API.
    However, when it comes to JDBC-ODBC the below code does only work in part. The driver is loaded successfully, but when it comes to transferring data into the resultset object the error
    SQLState: null
    Result Set Type is not supported
    Vendor: 0
    occurs.
    The official answer from SPSS is to use .Net or to use their implementation with Python in their new version 14.0. But this is obviously not an option when you want to use only Java.
    Does anybody have experience with SPSS and JDBC-ODBC??? I have tried the possible ResultSet Types, which I took from:
    http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvdsprp.htm
    and none of them worked.
    Thank you in advance for your ideas and input & stay happy!
    Here the code without all the rest of the class arround it:
    // Module:  SimpleSelect.java
    // Description: Test program for ODBC API interface.  This java application
    // will connect to a JDBC driver, issue a select statement
    // and display all result columns and rows
    // Product: JDBC to ODBC Bridge
    // Author:  Karl Moss
    // Date:  February, 1996
    // Copyright: 1990-1996 INTERSOLV, Inc.
    // This software contains confidential and proprietary
    // information of INTERSOLV, Inc.
    public static void main1() {
      String url   = "jdbc:odbc:SomeSystemDNS";
      String query = "SELECT SomeSPSSColumn FROM 'SomeSPSSFileName'";
      try {
        // Load the jdbc-odbc bridge driver
        Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
        DriverManager.setLogStream(System.out);
        // Attempt to connect to a driver.  Each one
        // of the registered drivers will be loaded until
        // one is found that can process this URL
        Connection con = DriverManager.getConnection (url);
        // If we were unable to connect, an exception
        // would have been thrown.  So, if we get here,
        // we are successfully connected to the URL
        // Check for, and display and warnings generated
        // by the connect.
        checkForWarning (con.getWarnings ());
        // Get the DatabaseMetaData object and display
        // some information about the connection
        DatabaseMetaData dma = con.getMetaData ();
        System.out.println("\nConnected to " + dma.getURL());
        System.out.println("Driver       " +
          dma.getDriverName());
        System.out.println("Version      " +
          dma.getDriverVersion());
        System.out.println("");
        // Create a Statement object so we can submit
        // SQL statements to the driver
        Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_READ_ONLY);
        // Submit a query, creating a ResultSet object
        ResultSet rs = stmt.executeQuery (query);
        // Display all columns and rows from the result set
        dispResultSet (rs);
        // Close the result set
        rs.close();
        // Close the statement
        stmt.close();
        // Close the connection
        con.close();
      }

    Thank you for your reply StuDerby!
    Actually the above script was before, as you suggested, leaving the ResultSetTeype default. This did not work...
    I am getting gray hair with SPSS - in terms of connectivity and "integratebility" none of their solutions offered is sufficient from my point of view.
    Variable definitions can only be read by the slow API, data can only be read by Python or Microsoft Products... and if you want to combine both you are in big trouble. I can only assume that this is a company strategy to sell their Dimensions Platform to companies versus having companies developping their applications according to business needs.
    Thanks again for any furthur suggestions and I hope, that some SPSS Developper will see this post!
    Cheers!!

  • Problem: connect DB with Applet by JDBC-ODBC bridge

    Dear all,
    When I connect local MS SQL server by "sun.jdbc.odbc.JdbcOdbcDriver" as below, it works well! However, when I put the similar code under Java Applet program, it cannot run by showing error:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1501)
    at sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:169)
    I think Java Applet has some security policy when I try to use applet to connect(read/write) DB. How can I solve it so that I can browse my applet under IE.
    Thanks a lot!
    Here is my worked code in Java program but not in Applet:
    import java.sql.*;
    public class TestJDBC1 {
    public static void main(String args[]) throws Exception {
    String userid = "";
    String password = "";
    // Register the driver with DriverManager
    new sun.jdbc.odbc.JdbcOdbcDriver();
    // Get a connection
    Connection conn = DriverManager.getConnection("jdbc:odbc:rdr",
    userid, password);
    // Create a statement for executing SQL
    Statement stmt = conn.createStatement();
    // Execute a query / SELECT statement
    ResultSet rset = stmt.executeQuery("SELECT * FROM PlatformNode");
    ResultSetMetaData rsmd = rset.getMetaData();
    // Find out how many columns were returned by the query
    int count = rsmd.getColumnCount();
    // Loop until all rows have been processed
    while (rset.next()) {
    // Loop until all columns in current row have been processed
    for (int i = 1; i <= count; i++) {
    // Print out the current value
    System.out.print(rset.getObject(i));
    // Put a comma between each value
    if (i < count) {
    System.out.println(",");
    // Start the next row's values on a new line
    System.out.println("");
    // Close the database objects
    rset.close();
    stmt.close();
    conn.close();

    Hi,
    Applets by default are restricted from accessing a lot of things.to enable applest from accessing database and other thngs u need to edit the policy file
    Try this.
    go to the jre/bin directory open the policytool.exe file
    and add permission(in ur case RuntimePermission to access class in package sun.jdbc.odbc) and save the file.
    this will enable applets from accessing the databse.
    Hope that helps
    Note:
    policytool.exe must be used to open the java.policy file present in /jre/lib/security directory and then add the permissions
    regards,
    Partha

  • 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

  • How to get the count of distinct customer in matrix?

    Hi, I want to get the count of distinct customer in matrix at the time of validation event. Thanks Regards,

  • Multiple imports from same dump file

    Hi, I have to import multiple related schemas - to avoid having to create multiple dump files can I just export them into one dump file (owner= a,b,c etc) and then run simultaneous imports like : export <dba_user> owner=a,b,c file=all.dmp --in newdb

  • Lossy DNG shows strong visible differences but JPG not, is this a bug?

    Hello, I tried out the lossy DNG format with a lot of pictures. For most pictures I can't find any visible differences. But I found also some pictures with very noticible visible differences between lossless and lossy DNG. It seems that the lossy DNG

  • Unresponsive Mac when opening certain files

    Hi, this is my first time using these forums as I've never had a problem with my macbook pro until yesterday. I'm not tech savy but fortunantely I haven't had too many problems with my MBP. However, beggining yesterday I've had a very unresponsive co

  • Enable auditing for specific db user

    Hi all, we have created on db user and we want that whenever this user connect with sql and do some DDL or DML statement a trace file generated. I googled but so many forums are there so bit confussion like: currently in my db audit_trail parameter i