Applet throws SQLException

I have simple applet where a user clicks a button, which runs a stored procedure on a SQL database. The code that runs the SP is in a different class.
In my applet I am trying to create an instance of that class and run the method that executes the stored procedure.
The applet code is:
public class clsButton extends Applet implements ActionListener
public void init ()
Button btnRunSp = new Button("Run Report All-YTD");
setLayout(new FlowLayout(FlowLayout.CENTER));
add(btnRunSp);
public void actionPerformed(ActionEvent ae)
sqlSPResults sqlRs = new sqlSPResults(); //Class for SP
sqlRs.sqlRun(); //method that executes the SP
The error I am getting is: "java.sql.SQLException; must be caught or declared to be thrown" and it points to the "." in sqlRs.sqlRun();.
I have the throws SQLException statement on the method in the class I am trying to call:
public class sqlSPResults
public static void sqlRun() throws SQLException, IOException
Not sure why the throws statement on the underlying method is not recognized and not sure how to solve the problem.
TIA,
Todd

The "throws" clause on that method is recognized, and it is exactly that clause that requires your code in the clsButton class to catch the exception. To fix this problem, you usually have two approaches, as the error message says. You can catch the error, like this:try {
  sqlRs.sqlRun(); //method that executes the SP
} catch(SQLException e) {
  // code that deals with an SQLException
}Or sometimes you can declare that the method containing the line of code throws SQLException. In this case, however, you can't do that because you are implementing the actionPerformed method and you can't change its signature that way.
You will also have to do the same for IOException, which is also thrown by the sqlRun method.

Similar Messages

  • Report in Applet throws SecurityException

    Hello,
    I try to integrate CrystalReport into my Applet.
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open("reportName.rpt", 0);
    ReportViewerBean reportViewer = new ReportViewerBean();
    reportViewer.setReportSource(reportClientDoc.getReportSource());
    reportViewer.init();
    reportViewer.start();
    The Applet throws a SecurityException. It runs if the java.policy from client will be modified:
    grant  {
      permission java.util.PropertyPermission "*", "read,write";
      permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
      permission java.lang.RuntimePermission "createClassLoader";
    Is there a way without a modify by client? Server can be adjust.
    Edited by: ergerg on Aug 17, 2011 8:29 PM

    here it is :
    java.security.AccessControlException: access denied (java.io.FilePermission lena.png read)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
         at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
         at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:408)
         at sun.awt.SunToolkit.getImage(SunToolkit.java:422)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
         at PNGLoader$1.actionPerformed(PNGLoader.java:38)
         at java.awt.Button.processActionEvent(Button.java:381)
         at java.awt.Button.processEvent(Button.java:350)
         at java.awt.Component.dispatchEventImpl(Component.java:3526)
         at java.awt.Component.dispatchEvent(Component.java:3367)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

  • Change Web Browser Title from Applet throw by JInitiator

    Hi,
    I'm developing an Oracle application with Oracle Form Builder and I would need to change browser title from my Applet, when a procedures throws when I press a button.
    Thanks a lot.

    If you use SeparateFrame=true, you can use WebUtil_SeparateFrame.SetTitle

  • Throw sqlexception: broken pipe when executing sql or other related code

    My env is:
    weblogic 704 + oracle 8i, use datasource to create conneciton pool with 10 connections
    when weblogic starts, but when I execute some sql , the system throwed out:
    java.sql.SQLException: Io Exception: Broken pipe
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
    at oracle.jdbc.driver.OracleStatement.open(OracleStatement.java:560)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2778)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
    at weblogic.jdbc.pool.PreparedStatement.executeQuery(PreparedStatement.java:53)
    at com.ztsoft.ejb.dao.EntityDAO.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.dao.SL_FileContentTbDAO.readClob2(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean_oejxo1_ELOImpl.readClobToFile(MainHandlerBean_oejxo1_ELOImpl.java:531)
    at com.ztsoft.web.servlet.GetResultActionServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    How can I solve ? thanks, this is very urgent, help me..

    CottonXu wrote:
    My env is:
    weblogic 704 + oracle 8i, use datasource to create conneciton pool with 10 connections
    when weblogic starts, but when I execute some sql , the system throwed out:
    java.sql.SQLException: Io Exception: Broken pipe
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)Hi. This indicates a problem between the oracle driver version and the DBMS
    version. The first thing to do is to go to oracle's download site and get
    their latest version of the thin driver that is appropriate for your DBMS
    and JVM, and then edit your startWeblogic script so the new driver is ahead
    of the weblogic.jar in the -classpath argument for the commandline that
    starts the server.
    Joe
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
    at oracle.jdbc.driver.OracleStatement.open(OracleStatement.java:560)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2778)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
    at weblogic.jdbc.pool.PreparedStatement.executeQuery(PreparedStatement.java:53)
    at com.ztsoft.ejb.dao.EntityDAO.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.dao.SL_FileContentTbDAO.readClob2(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean_oejxo1_ELOImpl.readClobToFile(MainHandlerBean_oejxo1_ELOImpl.java:531)
    at com.ztsoft.web.servlet.GetResultActionServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    How can I solve ? thanks, this is very urgent, help me..

  • Applet throws null pointer...

    I have weired problem... it was working fine. I have applet which connects to chat server from anywhere from the the browser but my own server computer. Whenever i try to load from my local machine it either throws null pointer or applet load failed error. neither it works from appletviewer.
    Remember , it works fine from anywhere else.. so all .class files etc. etc. are valid...
    Thanks

    Just in addition to above,
    actually it throws java.secrity.AccessControlException:access denied (java.net.SocketPermission "My Ip":9991 conect resolve..
    But weired thing ... from same computer when i run appletviewer from Net Beans IDE ... it connects fine to my sockets...

  • Signed applet throws SecurityException

    I have trouble with java applets and access permissions (plugin 1.3.0_02).
    Although I signed the applet using a Verisign certificate
    and although the user grants access (when loading the
    applet a security dialog pops asking for permission),
    the applet obviously does not have "AllPermission"
    code:
        String host = "abc"
        int port = 80
        // the following code throws a SecurityException
        Socket = new Socket(host, port);from java console:
    java.security.AccessControlException: access denied (java.net.SocketPermission abc resolve)
    why is that so ?
    what's wrong here ?
    this is how I created the jar:
    - compile applet to my.class file
    - generated jar: jar cvf my.jar mydir
    - sign the jar: jarsigner -keystore mykeystore my.jar mycertificate (mykeystore contains the "mycertivicate" Verisign certificate)
    at least something works since the plugin 1.3.0_02 detects the certificate and pops up the security dialog asking the user for access permissions.
    the documentation says (see http://java.sun.com/products/plugin/1.3/docs/nsobjsigning.html#deploy), that when the user "grants always" the applet gets "AllPermission".
    but the applet obviously does not get "AllPermission"
    however, the code will work when I manually add "AllPermission" on the client side using the policytool. but it is not accetable solution to have client users use
    policytool for granting permissions...
    please help!!!

    I found the problem: the critical code was in a second jar file having a different code base (org.abc.... instead of de.abc...). So I only had to sign the additional jar file and then it worked...
    ...

  • Thin Driver throws SQLException instead of BatchUpdateExeption!

    Hi,
    I am using classes12.zip.
    While executing a batch update, one of the values in the prepared statement
    is invalid, so executeUpdate() fails. But, instead of throwing a
    java.sql.BatchUpdateException, the driver throws a java.sql.SQLException.
    This is a big problem for me since I handle BatchUpdateException to
    find out the erroneous value and so on.
    Please let me know if anybody else faced this problem, and what the solution is.
    TIA,
    Prasad

    At the time our issue was resolved, the bug was not published. And, I was told, there was no information in metalink about the isue. I am not sure whether they published some thing in the last few weeks.
    This is what resolved our issue.
    Step 1: alter system set java_jit_enabled=FALSE;
    Step 2: Try your test case. If it is the same issue as ours, your test case will be successful. If it succeeds, Go to step 3. If it does not succeed, it is a different issue.
    Step 3: alter system set java_jit_enabled=TRUE;
    Step 4: Run your test case. If it is the same issue, it is expected to fail. Go to Step 5 in case of failure.
    Step 5: Delete all rows from table java$mc$
    Step 6: Restart the database
    Step 7: Run your test case. It is expected to be successful.

  • Applet throws "Unable to obtain Document object"

    Hello,
    I have an applet in a html-page and a link to show the applet (in a later version this should be a menu with links to different applets).
    If I click very often (click,click,click,click) on the link I get an exception (see below).
    Used environment:
    - Windows 2000 English
    - Internet Explorer 6
    - Java(TM) Plug-in: Version 1.4.2, Using JRE version 1.4.2 Java HotSpot(TM) Client VM
    Here are my 4 tiny source-codes:
    1. My test Applet:
       import java.util.*;
       import javax.swing.*;
       public class BigApplet extends JApplet {
          Vector vec = new Vector();
          public void init() {
             this.getContentPane().add(new JLabel("BigApplet"));
             for (int i = 0; i < 10; i++) {
                vec.add(new Object[250000]);
       }And 3 HTML-Pages:
    2. Frame.html
       <html>
          <frameset cols="80,*" frameborder="NO" border="0" framespacing="0">
             <frame src="link.html" name="menuFrame" noresize marginheight="0" marginwidth="0">
             <frame name="applet" noresize marginheight="0" marginwidth="0">
          </frameset>
       </html>3. Link.html
       <html>
          <a href="applet.html" target="applet">Applet</a>
       </html>4. Applet.html
       <applet code="BigApplet.class" codebase="bin" />The three html pages are in the same directory and the BigApplet.class is in the bin-folder of this directory.
    If I start the frame.html from Explorer and than click very fast (about 5 to 10 times) on the link to the applet I get this exception:
    netscape.javascript.JSException: Unable to obtain Document object
         at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
         at sun.plugin.AppletViewer.getCodeBase(Unknown Source)
         at sun.plugin.AppletViewer.appletInit(Unknown Source)
         at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
         at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)If the applet is delivered by a webserver (tried IIS and Apache) the Internet Explorer crashes without a message. In that case I get a different exception (found in the log file of the java console):
    java.lang.NullPointerException
         at sun.plugin.util.URLUtil.canonicalize(Unknown Source)
         at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
         at sun.plugin.AppletViewer.getCodeBase(Unknown Source)
         at sun.plugin.AppletViewer.appletInit(Unknown Source)
         at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
         at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)Any idee what to do to be sure that an user can not produce this error?
    Bye
    Thomas

    Hello, I am getting the same error under different circumstances. No clicking is involved. What I need to know is what causes the error? Anyone know?
    And levi_h - the end users of applets often get impatient when they don't see immediate results and will click and click and click and click, thinking that somehow they are helping the situation. You may feel they deserve to be punished, but the powers that be who are the customers who will deploy our applets don't feel that way at all, and they are the ones that pay our salaries and allow us to be sheltered, clothed, fed and send our kids to college!

  • Signed applet throws security exceptions

    Since nobody seems to be reading the Signe Applet forum, I decided to try here:
    Hi all
    I have problems with signed applet (self-made cert), and after reading this forum I see this is more or less common.
    The problem that I am having is, that I can not use doPrivilege() and similar tricks, because applet needs to be Java 1.1 compatible.
    So, signing will have to work.
    Applet is signed using 1.5.0_06 jarsigner. Jarsigner verifies it OK.
    It works on JVM 1.5.0_06 but not on 1.4.2_08.
    Please help me make if work under any JVM.
    The error I get is:
    Java(TM) Plug-in: Version 1.4.2_08
    Using JRE version 1.4.2_08 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\miha
    Proxy Configuration: Automatic Proxy Configuration
         URL: http://orion.nil.si/proxy.pac
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    p:   reload proxy configuration
    q:   hide console
    r:   reload policy configuration
    s:   dump system properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    java.security.AccessControlException: access denied (java.net.SocketPermission host.domain.dom resolve)
    TelnetWrapper PROXY: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:0 connect,resolve)
    java.lang.NullPointerException
         at net.propero.rdp.ISO.connect(ISO.java:123)
         at net.propero.rdp.MCS.connect(MCS.java:84)
         at net.propero.rdp.Secure.connect(Secure.java:153)
         at net.propero.rdp.Secure.connect(Secure.java:171)
         at net.propero.rdp.Rdp.connect(Rdp.java:498)
         at net.propero.rdp.Rdesktop.main_nonstatic(Rdesktop.java:615)
         at net.propero.rdp.applet.RdpThread.run(RdpApplet.java:222)
    FATAL: java.lang.NullPointerException: nullWhat is funny, is that I have two applets, and one works and the other one doesn't. It is like this:
    Applet A (signed) needs to connect to host1, fails and tries to connect through proxy using my proxy library (also signed - different JAR). Everything works.
    Applet B (signed) needs to connect to host1, fails and tries to connect through proxy using the same proxy library. It gets a security exception.
    All JARs are signed using the same key/certificate.
    Both applets try to connect to the same "host1".
    Both applets try to use the same proxy - which is different from "host1".
    The one thing that might make a difference, is that in the working applet, everything is within one thread, and in the broken applet, the proxy object is in the main applet thread, and this applet may open many windows, that all utilize the same proxy object - only they can't.
    When I tried to move the proxy object down to the child threads, I get the following exception:
    Exception in thread "Thread-1952" java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.misc)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
         at sun.applet.AppletSecurity.checkPackageAccess(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at net.propero.rdp.Rdesktop.main_nonstatic(Rdesktop.java:567)
         at net.propero.rdp.applet.RdpThread.run(RdpApplet.java:211)It seems that I can only create the proxy object in the Applet.init() method, to avoid this exception.
    So to, summarize: I would prefer just one object for all threads that I will create, but then my applet behaves like it is not signed (at least under JVM 1.4.2_08). Java 1.5.0_06 doesn't have any problems with this.
    Regards, Miha Vitorovic

    The one thing that might make a difference, is that in the working applet, everything is within one thread, and in the broken applet, the proxy object is in the main applet thread, and this applet may open many windows, that all utilize the same proxy object - only they can't.
    When I tried to move the proxy object down to the child threads, I get the following exception:
    Exception in thread "Thread-1952" java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.misc)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
         at sun.applet.AppletSecurity.checkPackageAccess(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at net.propero.rdp.Rdesktop.main_nonstatic(Rdesktop.java:567)
         at net.propero.rdp.applet.RdpThread.run(RdpApplet.java:211)It seems that I can only create the proxy object in the Applet.init() method, to avoid this exception.
    So to, summarize: I would prefer just one object for all threads that I will create, but then my applet behaves like it is not signed (at least under JVM 1.4.2_08). Java 1.5.0_06 doesn't have any problems with this.
    Regards, Miha Vitorovic

  • Stored procedure call throwing SQLException

    Our application recently migrated to WLS8.1 SP3 from 7.0 SP4. While registering the value to OracleTypes.CURSOR, I am getting the following exception. We are using oracle 8.1.7, and thin driver(Solaris 5.9). After installing I noticed that WLS8.1 does not have the classes12.zip file under WL_HOME/server/ext/jdbc/oracle/ directory, moreover the 8.1.7 folder itself is missing. Does the existing driver files came with 7.0 version is good enough to run the application in 8.1.3. Any help is appreciated.
    Here is the code that I use:
    cs = connection.prepareCall("{call PROC_NAME(?)}");
    cs.setNull(1, OracleTypes.CURSOR);
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    Object obj = cs.getObject(1);
    Here is the exception that I get :
    java.sql.SQLException: Unsupported feature: sqlType=-10
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.OraclePreparedStatement.setNullInternal(OraclePreparedStatement.java:3719)
         at oracle.jdbc.driver.OracleCallableStatement.setNull(OracleCallableStatement.java:4145)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:419)
    Thanks,
    Rajeev

    Rajeev Mani wrote:
    Our application recently migrated to WLS8.1 SP3 from 7.0 SP4.
    While registering the value to OracleTypes.CURSOR, I am getting
    the following exception. We are using oracle 8.1.7, and thin driver
    (Solaris 5.9). After installing I noticed that WLS8.1 does not have
    the classes12.zip file under WL_HOME/server/ext/jdbc/oracle/ directory,
    moreover the 8.1.7 folder itself is missing. Does the existing driver
    files came with 7.0 version is good enough to run the application in 8.1.3. Any help is appreciated.
    Hi. If the same code works in 70, and doesn't in 81, it must be because of the
    newer version of the oracle thin driver that comes with 81. You can use the classes12.zip
    that worked for you in 70 by putting it somehwere in yout 81 installation (server\lib for instance)
    and editing your startWebLogic scripts to list it explicitly before the weblogic stuff.
    Eg, just before the line in the script that calls java to start the server, put this:
    set CLASSPATH=\myinstall\server\lib\classes12.zip;%CLASSPATH%
    or for Unixes:
    setenv CLASSPATH /myinstall/server/lib/classes12.zip:$CLASSPATH
    Joe
    Here is the code that I use:
    cs = connection.prepareCall("{call PROC_NAME(?)}");
    cs.setNull(1, OracleTypes.CURSOR);
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    Object obj = cs.getObject(1);
    Here is the exception that I get :
    java.sql.SQLException: Unsupported feature: sqlType=-10
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.OraclePreparedStatement.setNullInternal(OraclePreparedStatement.java:3719)
         at oracle.jdbc.driver.OracleCallableStatement.setNull(OracleCallableStatement.java:4145)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:419)
    Thanks,
    Rajeev

  • JDBC:ODBC, Resultset with 0 rows throws SqlException

    For short, I have used forte for java version 3.0 ea to create an application which is manipulating data in an MS SQLServer database. Further I have installed JDK 1.3.1 and JRE 1.3.1, running on WINDOWS 2000 os.
    The DB-configuring is set to binary sort order.
    When my program is running a "rs = stmt.executQuery() then the situation is:
    1) If this query results in 1 or more rows in the resultset, everything seems to work fine.
    2) But if the resultset doesn't contains any rows, which is a quit legal result and actually a succes criteria in a certain point in my prg., an SQLException is thrown stating "Invalid object name + 'database tablename in uppercase'". Although the db-tables name is in mixedletters (see the code below).
    For testing purpose I have worked out a quit simpel prg. which reflects the real prg. I enclose it for examining purpose.
    I certaintly hope somebody is able to guide me to a solution.
    Thanks in advance.
    Kind regards
    Kuno Reck
    IBC Systems A/S
    TestCode:
    import java.sql.*;
    import javax.swing.*;
    //import javax.swing.table.*;
    class DBTest {
    private static final String driver = "sun.jdbc.odbc.JdbcOdbcDriver",
    dbUrl = "jdbc:odbc:KEKVRF",
    comUser = "tbs", password = "tbs";
    private static Connection conn;
    private static Statement stmt;
    private static ResultSet rs;
    // String queryDdi = "SELECT DISTINCT N.DdiNumber FROM DdiNumbers N left
    join DdiGroups G on N.DdiNumber = G.DdiNumber and N.ProviderId = G.ProviderId
    WHERE 1 = 1 AND N.DdiNumber BETWEEN 35248305 AND 35248309 ORDER BY N.DdiNumber";
    // String queryDdi = "SELECT DISTINCT N.DdiNumber FROM DdiNumbers N left
    join DdiGroups G on N.DdiNumber = G.DdiNumber and N.ProviderId = G.ProviderId
    WHERE 1 = 1 AND N.DdiNumber = 35248307 ORDER BY N.DdiNumber";
    String queryDdi = "SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber =
    35548307";
    public static void main (String[] args){
    DBTest dbtest = new DBTest();
    public DBTest() {
    try{
    Class.forName(driver);
    conn = DriverManager.getConnection(dbUrl, comUser, password);
    java.sql.DriverManager.setLogStream(java.lang.System.out);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    rs = stmt.executeQuery(queryDdi);
    if (rs.isBeforeFirst()){
    while (rs.next()) {
    // BEM?RK! KolonneV?rdierne skal l?ses ud i samme r?kkef?lge som de
    selectes i sql-statementet.
    System.out.println("DdiNumber = "+rs.getString("DdiNumber"));
    else{
    JOptionPane.showMessageDialog(null, "> Ddi-number does not exist
    < ", "Validation of input fields", JOptionPane.ERROR_MESSAGE);
    catch (SQLException e){
    JOptionPane.showMessageDialog(null, "No matching records found, " +
    e.getMessage(), "SQLException", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    catch (ClassNotFoundException cnfe){
    JOptionPane.showMessageDialog(null, "ClassNotFoundException, " +
    cnfe.getMessage(), "ClassNotFoundException", JOptionPane.ERROR_MESSAGE);
    LogStream:
    C:\jdk1.3.1\bin>java DBTest
    *Connection.createStatement
    Allocating Statement Handle (SQLAllocStmt), hDbc=148181752
    hStmt=148185176
    Setting statement option (SQLSetStmtOption), hStmt=148185176, fOption=6,
    vParam=3
    Setting statement option (SQLSetStmtOption), hStmt=148185176, fOption=7,
    vParam=1
    Registering Statement sun.jdbc.odbc.JdbcOdbcStatement@17d257
    *Statement.executeQuery (SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber =
    3554830
    7)
    *Statement.execute (SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber = 35548307)
    Free statement (SQLFreeStmt), hStmt=148185176, fOption=0
    Executing (SQLExecDirect), hStmt=148185176, szSqlStr=SELECT DdiNumber FROM
    DdiNumbe
    rs WHERE DdiNumber = 35548307
    Number of result columns (SQLNumResultCols), hStmt=148185176
    value=1
    Get statement option (SQLGetStmtOption), hStmt=148185176, fOption=6
    value=3
    SQLWarning: reason(Result set type has been changed.)
    Number of result columns (SQLNumResultCols), hStmt=148185176
    value=1
    Number of affected rows (SQLRowCount), hStmt=148185176
    value=0
    Fetching (SQLFetchScroll), hStmt=148185176
    End of result set (SQL_NO_DATA)
    Get statement option (SQLGetStmtOption), hStmt=148185176, fOption=14
    RETCODE = -1
    ERROR - Generating SQLException...
    SQLException: SQLState(24000) vendor code(0)
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetStmtOption(JdbcOdbc.java:3773)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount
    (JdbcOdbcResultSet.java
    :5982)
    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 DBTest.<init>(DBTest.java:27)
    at DBTest.main(DBTest.java:18)
    Fetching (SQLFetchScroll), hStmt=148185176
    End of result set (SQL_NO_DATA)
    *Connection.createStatement
    Allocating Statement Handle (SQLAllocStmt), hDbc=148181752
    hStmt=148186208
    Setting statement option (SQLSetStmtOption), hStmt=148186208, fOption=6,
    vParam=0
    Setting statement option (SQLSetStmtOption), hStmt=148186208, fOption=7,
    vParam=1
    Registering Statement sun.jdbc.odbc.JdbcOdbcStatement@19c082
    *Statement.executeQuery (SELECT COUNT(*) FROM DDINUMBERS WHERE DDINUMBER =
    3554830
    7)
    *Statement.execute (SELECT COUNT(*) FROM DDINUMBERS WHERE DDINUMBER = 35548307)
    Free statement (SQLFreeStmt), hStmt=148186208, fOption=0
    Executing (SQLExecDirect), hStmt=148186208, szSqlStr=SELECT COUNT(*) FROM
    DDINUMBE
    RS WHERE DDINUMBER = 35548307
    RETCODE = -1
    ERROR - Generating SQLException...
    SQLException: SQLState(S0002) vendor code(208)
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid
    objec
    t name 'DDINUMBERS'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2494)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:334)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:249)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount
    (JdbcOdbcResultSet.java
    :6063)
    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 DBTest.<init>(DBTest.java:27)
    at DBTest.main(DBTest.java:18)
    ResultSet.finalize sun.jdbc.odbc.JdbcOdbcResultSet@4ac268
    ResultSet.finalize sun.jdbc.odbc.JdbcOdbcResultSet@216869
    *ResultSet.close
    C:\jdk1.3.1\bin>

    Hi,
    my suggestion: you can't use isBeforeFirst() on empty result set. Try following:
    rs = stmt.executeQuery(queryDdi);
    int count = 0;
    while (rs.next()) {
      count++;
      System.out.println("DdiNumber = "+rs.getString("DdiNumber"));
    if (count == 0) {
    JOptionPane.showMessageDialog(null, "> Ddi-number does not exist < ", "Validation of input fields", JOptionPane.ERROR_MESSAGE);
    }Best Regards,
    Martin

  • FileDialog in Applet throwing security exception.

    I am trying to create a simple applet that a user can select a file from and then upload that file to a server somewhere. I am able to accomplish this using the JApplet class and the JFileChooser class. Everything works fine with the signed applet. However I am going to need to make it compliant with the Microsoft VM since it is for a corporate settings and those people won't have admin rights on their machines to toggle between the VM. So JApplet has been changed to Applet, JFileChooser has been changed to FileDailog and now I am getting this error:
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
         at com/ms/security/permissions/UIPermission.check
         at com/ms/security/PolicyEngine.deepCheck
         at com/ms/security/PolicyEngine.checkPermission
         at com/ms/security/StandardSecurityManager.chk
         at com/ms/security/StandardSecurityManager.checkFileDialog
         at java/awt/FileDialog.<init>
         at com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed
         at java/awt/Button.processActionEvent
         at java/awt/Button.processEvent
         at java/awt/Component.dispatchEventImpl
         at java/awt/Component.dispatchEvent
         at java/awt/EventDispatchThread.run
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
    This line of code is where it blows up:
    FileDialog fileDialog = new FileDialog(new Frame(), "Please choose the file to open:", FileDialog.LOAD);The jar is signed, however something of interest to note: there isn't a pop-up asking me if I would like to trust this applet when I use the Microsoft VM?
    jar.exe -cvf k:\applet\lib\Importer.jar com.java.applet.il.AimsImporter/*.class
    jarsigner k:\applet\lib\Importer.jar mykey
    jarsigner -verify Importer.jar
    Is there something that is different when doing this with the Microsoft VM?????
    Help! :)

    I am trying to create a simple applet that a user can select a file from and then upload that file to a server somewhere. I am able to accomplish this using the JApplet class and the JFileChooser class. Everything works fine with the signed applet. However I am going to need to make it compliant with the Microsoft VM since it is for a corporate settings and those people won't have admin rights on their machines to toggle between the VM. So JApplet has been changed to Applet, JFileChooser has been changed to FileDailog and now I am getting this error:
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
         at com/ms/security/permissions/UIPermission.check
         at com/ms/security/PolicyEngine.deepCheck
         at com/ms/security/PolicyEngine.checkPermission
         at com/ms/security/StandardSecurityManager.chk
         at com/ms/security/StandardSecurityManager.checkFileDialog
         at java/awt/FileDialog.<init>
         at com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed
         at java/awt/Button.processActionEvent
         at java/awt/Button.processEvent
         at java/awt/Component.dispatchEventImpl
         at java/awt/Component.dispatchEvent
         at java/awt/EventDispatchThread.run
    com.ms.security.SecurityExceptionEx[com/java/applet/il/AimsImporter/AimsImportApplet.actionPerformed]: FileDialog creation denied.
    This line of code is where it blows up:
    FileDialog fileDialog = new FileDialog(new Frame(), "Please choose the file to open:", FileDialog.LOAD);The jar is signed, however something of interest to note: there isn't a pop-up asking me if I would like to trust this applet when I use the Microsoft VM?
    jar.exe -cvf k:\applet\lib\Importer.jar com.java.applet.il.AimsImporter/*.class
    jarsigner k:\applet\lib\Importer.jar mykey
    jarsigner -verify Importer.jar
    Is there something that is different when doing this with the Microsoft VM?????
    Help! :)

  • What does XMLType.isFragment () throw SQLException with no details?

    package com.test.db.xml;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import oracle.jdbc.OracleResultSet;
    import oracle.xdb.XMLType;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class TestXMLTypeMethods {
         // This test performs a simple insert into a table defined as
         // Name Type
         // ID NUMBER
         // DESCR VARCHAR2(32)
         // XMLDOC SYS.XMLTYPE
         public static void main(String[] args) {
              String sConn = "jdbc:oracle:thin:@saturn:1522:ssidev";
              String sUser = "scott";
              String sPass = "tiger";
              Connection          conn = null;
              Statement          stmt = null;
              ResultSet          rs = null;
              OracleResultSet orset = null;
              OracleXMLQuery     oraQry = null;
              try {
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   conn = DriverManager.getConnection(sConn, sUser, sPass);
                   stmt = conn.createStatement();
                   rs = stmt.executeQuery("select a.xmldoc from robxml1 a ");
                   orset = (OracleResultSet) rs;
                   while (orset.next()) {
                        XMLType tXML = XMLType.createXML(orset.getOPAQUE(1));
                        System.out.println (" *** SQL Type Name: " + tXML.getSQLTypeName());
                        try {
                             System.out.println (" *** isFragment() : " + tXML.isFragment());
                        } catch (SQLException e) {
                             while (e != null) {
                                  System.err.println (" " + e.getSQLState() + " " + e.getErrorCode() + " " + e.getMessage());
                                  e.printStackTrace();
                                  e = e.getNextException();
                        } catch (Exception e) {
                             e.printStackTrace();
              } catch (Exception e) {
                   e.printStackTrace();
              } finally {
                   try {
                        if (orset != null) {
                             orset.close();
                   } catch (Exception e) { /* ignore */
                   try {
                        rs.close();
                   } catch (Exception e) { /* ignore */
                   try {
                        stmt.close();
                   } catch (Exception e) { /* ignore */
                   try {
                        conn.close();
                   } catch (Exception e) { /* ignore */
              System.out.println("all done");

    hello,
    What is the error message. Atleast what is the output of
    System.out.println (" *** SQL Type Name: " + tXML.getSQLTypeName());
    Regards.

  • PreparedStatement.addBatch() throws SQLException: Unsupported feature

    Hi,
    We am using Oracle 8i with thin JDBC driver (classes12.zip) & JDK1.3.
    If we use normal statement for batch update, using OracleStatement.addBatch() and OracleStatement.executeBatch(), it works fine. Problem occurs when doing batch update with prepared statement, using OraclePreparedStatement.addBatch() and OraclePreparedStatement.executeBatch(). The see the exception below
    01-08-03 11:59:53 | ERROR | [Thread4] | user.BLineOS400CB_B1User:lvlAC_NOUser |
    Error in bbojUser
    java.sql.SQLException: Unsupported feature
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
    at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedSta
    tement.java:2847)
    at com.orbitech.frameworks.bline.user.BLineOS400CB_B1User.lvlAC_NOUser(U
    nknown Source)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.invokeUserLvl(Unkno
    wn Source)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.lvlAC_NO(Unknown So
    urce)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.lvl(Unknown Source)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.blineMainPolymorph(
    Unknown Source)
    at com.orbitech.frameworks.bline.engine.BLine.execute(Unknown Source)
    at com.orbitech.frameworks.bline.engine.BLine.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:484)
    01-08-03 11:59:53 | ERROR | [Thread4] | gen.BLineOS400CB_B1:lvlAC_NO | Error in
    lvlAC_NO.
    Please help... Do I need to change the JDBC driver. If Yes, which driver should I use.
    Regards,
    Mandar

    Try using
    ((OraclePreparedStatement)theStmt).setExecuteBatch(blocking factor);
    set the blocing factor to be something like 1000.
    The the above doesn't work by itself, then try adding the following after connection.
    ((OracleConnection)conn.setDefaultRowPrefetch(blocking factor);
    and then use the 1st statement.
    Hope it works.

  • JDBC throws SQLException: failUTFConversion

    hi,
    i'm running: oracle 8.1.5 (server with an instance running utf8), classes111b.zip (jdbc - thin driver), nlscharset11.zip (to support utf8), orion (client - java application server/web server)
    on the server, i've
    $ echo $NLS_LANG
    AMERICAN_AMERICA.UTF8
    and
    select * from v$nls_parameters where parameter='NLS_CHARACTERSET'
    returns utf8
    on the client, which is the web server, i get:
    $ echo $NLS_LANG
    AMERICAN_AMERICA.UTF8
    when i do getString() on a JSP page, i got the SQLException:
    java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTFConversion at oracle.jdbc.dbaccess.DBError.check_error(DBError.java) at oracle.jdbc.oracore.JavaConversion.CHARBytesToJavaChars(JavaConversion.java) at oracle.jdbc.oracore.JavaConversion.CharBytesToString(JavaConversion.java) at oracle.jdbc.driver.OracleStatement.getStringValue(OracleStatement.java) at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java) at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java)
    i don't have any problem if the database contains only english, i.e. 1 byte utf8... however, i got that exception when the database contains chinese character
    what should i do to make things work?
    besides, i don't know where the web container called the code in nlscharset11.zip (although i included it in my classpath)
    thx

    hi, thx
    for a)
    i'm using orion (www.orionserver.com) as my client
    according to their instruction, "Also remember to put the driver (zip/jar) for your database to the /lib dir in Orion." i put both the classes111b.zip and nlscharset11.zip into the /usr/local/orion/lib directory (where my ORION_HOME=/usr/local/orion) and have the CLASSPATH=/usr/java/jdk1.3/lib/tools.jar:/usr/share/java/ant.jar:/usr/share/java/jaxp.jar:/usr/share/java/parser.jar:/usr/local/orion/orion.jar:/usr/local/orion/lib/classes111b.zip :/usr/local/orion/lib/nlscharset11.zip
    i also tried to add all classes in nlscharset11.zip to classes111b.zip, so i'm sure that the web server can access to the required classes. in addition, i attempted to move the modified classes111b.zip to another directory, and in that case, the web server gives the following error
    # java -jar orion.jar
    Error initializing server: DriverManagerDataSource driver 'oracle.jdbc.driver.OracleDriver' not found
    for b)
    how can i check whether the dumped bytes are correct UTF-8 bytes?
    i have the following data in my utf8 database
    New York
    a$i
    $i%;
    and this is what i got from select dump(col, 16) from tab1
    Typ=1 Len=8: 4e,65,77,20,59,6f,72,6b
    Typ=1 Len=3: 61,a4,e9
    Typ=1 Len=4: a4,e9,a5,bb
    where a4,e9 and a5,bb are chinese char $i and %; respectively
    is this correct? seems that the database stores a chinese char as 2 HEX codes... what does Typ means?
    any suggestion (software) that i can use to enter unicode char?
    thx

Maybe you are looking for

  • How can I get two hard drives connected to the Airport Extreme. There's only 1 USB port.

    I believe I want to use TWO USB Hard Drives with my Airport Extreme, but it seems there is only 1 USB port. I am currently using that USB port for my backup external hard drive (works with Time Machine). But now I have decided I want a common hard dr

  • Wireless Link two wrt54g

    I have a floorplan that pretty much eliminates my being able to get Ethernet cabling between my Computer area and Home Entertainment center. When it was just Tivo I linked it to the existing wrt54g - no problem. Just added XBox 360, upgraded Cable Bo

  • How come i can't open iTunes?

    itunes has stopped working, i cant open it up.  Ive tried restarting my computer many times and i have tried reinstalling itunes serveral times. i have tried changing the compatibal mode too but that doesnt work. i troubleshooted it and it said incom

  • Using SVN under OS X.5 Leopard Server

    Hi there! We run a Mac Pro with OS X Server Leopard 10.5.1 for collaboration services. We also need to use SVN for other matters. As this service is not directly accessible from Server Admin, but is always running because it's used as a backend for W

  • How do I get my Windows 7 network to see my iPad mini?

    Can't get my mini to connect to my network via wifi. Want to stream content from my Win 7 laptop to mini using Plex Media Server. Thanks for any help anyone can offer. Stan