Sql.exception using jdbc:odbc Sqlserver 7

hi
i use java jdk 1.3 and sqlserver 7.0 on windows98 and establish a connection over jbc:odbc. I use executeUpdate() statement and insert something to a table. there is a trigger defined and sometimes i got an sql.exception, that no rowcount returned.
can you help me ?
thanks jens

The trigger does a rollback in some cases.
Obviously - try this out! - this causes that JDBC exception then.
Now I see a problem in this, that the trigger does rollbacks concering the connection, but your Java program does not know that its connection's actual transaction has been rolled back. Imagine, if you have done several steps before without commitng yet, they are rolled back as well.
So I would use this only with AutoCommit set to true.
I think it's not a good idea in general to let a trigger do a rollback. But in this area I have few experiences.
I assume you have to use this table schema and its trigger definition and can't change it.
So I would find out the error code which this DBException contains.
So in case of exceptions you can identify if this case has happened and react on it in your logic. You must interpretate this as an error or maybe as an expected condition - that depends on your logic.
Another thought: can't you validate the values before you do the insert. Then this logic would not longer be encapsulated in the trigger, but maybe it is really a validation rule which the program should know anyway. What do you tell the user if it has occured?

Similar Messages

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

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

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

  • Null Pointer Exception using JDBC-ODBC bridge on Linux

    Wonder if anyone can help me with this one?
    I am attempting to use the JDBC-ODBC bridge on Fedora with J2SDK 1.4.2_04, however I am getting a NullPointerException whenever I get the connection. I can get the JDBC connection to work but it is a requirement that ODBC be used.
    The code is as simple as it can get.
    import java.sql.*;
    public class TestClass
       public static void doConnection()
          try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               Connection cn = DriverManager.getConnection("jdbc:odbc:DB");
          catch (Exception e)
               e.printStackTrace();
       public static void main(String[] args)
          doConnection();
    }Running this program using java -verbose TestClass I get the following output.
    [Loaded sun.jdbc.odbc.JdbcOdbc from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    [Loaded java.lang.UnsatisfiedLinkError from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    [Loaded java.sql.SQLException from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    [Loaded java.sql.SQLWarning from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    java.lang.NullPointerException
    [Loaded java.lang.StackTraceElement from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at TestClass.doConnection(TestClass.java:13)
    at TestClass.main(TestClass.java:96)
    [Loaded java.lang.Shutdown from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    [Loaded java.lang.Shutdown$Lock from /usr/java/j2sdk1.4.2_04/jre/lib/rt.jar]
    The UnsatisfiedLinkError suggests to me that a library cannot be found, but I don't know what library.
    As far as I know I have configured ODBC correctly. I can achieve connectivity to my database using other tools and I still get this same error irrespective of whether the DSN is valid or not.
    I have installed the unixODBC rpm.
    Any help/insite would be greatly appreciated.

    This is the output of ldd. Everything appears to be resolved.
    linux-gate.so.1 => (0x00cf5000)
    libodbcinst.so => /usr/sybase/lib/libodbcinst.so (0x001d5000)
    libjava.so => libjava.so (0x008af000)
    libjvm.so => /usr/java/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so (0x002a7000)
    libc.so.6 => /lib/i686/libc.so.6 (0x00d77000)
    libdbtasks7.so => /usr/sybase/lib/libdbtasks7.so (0x00eb2000)
    libdl.so.2 => /lib/libdl.so.2 (0x00111000)
    libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x00115000)
    libm.so.6 => /lib/i686/libm.so.6 (0x008fb000)
    libverify.so => libverify.so (0x0016e000)
    libnsl.so.1 => /lib/libnsl.so.1 (0x00180000)
    libpthread.so.0 => /lib/i686/libpthread.so.0 (0x006d0000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00157000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00b75000)
    The ODBC is a Sybase driver and is loaded from elsewhere. I will check for any known compatibility issues.

  • Database package for handling SQL queries using JDBC/ODBC bridge

    I perform a package using J2ME which can stores the contact.It consisting of the fascilities of the editing,Inserting, Deleting,Updating records
    i have write import statements as
    import javax.microedition.midlet*;
    import javax.microedition.lcdui.*;
    but when i write import java.sql.* error message shown AS this package does not exist.
    So for J2ME using J2ME wireless toolkit 2.5 cldc which package i want to import to implement the sql statements i implement the Database using the text Files.
    Requirement is that all SQL statements are implemented.also Which other equivalent packages are there for handling the databases in J2ME.
    Please tell me all the package & Answer of the above problem.

    Hey
    I was told that I can (through Java code) read all the registered DSNs and that way basically modify my application to populate it with a list of databases in the system and then when the user clicks on a database, the program would function as before...i.e. read the list of tables with it..yadda yadda yadda
    Can anyone guide me on how to do that? read a list of DSNs in the system etc

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

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

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

  • How to connect Sql Server 2000 using JDBC ODBC Driver

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

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

  • Problem using Jdbc-Odbc Bridge

    Hi,
    I am using Java 2 SDK and I am trying to access MS Access database on my machine using Jdbc-Odbc bridge. I have set up the DSN in ODBC. But I get the following error when I run my program -
    'No Suitable Driver'
    Here's my code snippet-
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    String dsn = "jdbc:odbc:DriverInfoDB";
    Connection con = DriverManager.getConnection(dsn,"","");
    con.setAutoCommit(false);
    Statement stmt;
    String query = null; // SQL select string
    ResultSet rs; // SQL query results
    stmt = con.createStatement();
    .....etc etc...
    Where is the error in this code??
    Help Needed!!
    Thanks
    Vivek.

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

  • JSP connected to MS Access using JDBC-ODBC

    If I want to run a jsp file connected to a MS Access database using jdbc-odbc bridge.
    I thought that I should use the following code to make the connection:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=http://myComputerName:8080/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    but Tomcat 4.1 produces many errors.
    The file runs fine when I determine the complete path and include the local drive (C://) of the database Like the following:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};
    DBQ=C:/Tomcat4.1/webapps/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    Of course I do not want to use the second code because I want to use my computer as a host.
    I will appreciate any answer!

    Yes, using the DSN, it works fine.
    But, I think it will run from the drive C.
    I want to use my computer as a host. So, I think that I should include the name of the computer in the path.
    I do not know may I am confused.
    I appreciate your reply. Thanks!

  • Oracle to SQL Server using JDBC

    I would like to connect Oracle to SQL Server using JDBC and a java program in oracle using loadjava.
    I cannot seem to get a SQL Server driver to work when loaded into Oracle using loadjava. Outside of oracle, they work just fine. Within oracle, I receive class not found exceptions.
    PLEASE HELP!!!!!!!

    I would like to connect Oracle to SQL Server using JDBC and a java program in oracle using loadjava.
    I cannot seem to get a SQL Server driver to work when loaded into Oracle using loadjava. Outside of oracle, they work just fine. Within oracle, I receive class not found exceptions.
    PLEASE HELP!!!!!!!

  • Getting Multiple Recordsets using A Single Connection using jdbc-odbc

    I have a java application which uses sql 7.0 database server. I want to have multiple recordsets created using a single connection using jdbc-odbc bridge. Kindly let me know the procedure.

    Well, you create a recordset, then you create another one, and so on. Are you actually having a problem or you just don't know where to start?

  • To run a report from command line, when using jdbc-odbc bridge

    Hi,
    How to run a report from command line, when using jdbc-odbc bridge?
    Usually with tns, we do by "rwrun module=<> userid=<user>/<passwd>@tns".
    with odbc, we do by "rwrun module=<> userid=<user>/<passwd>@odbc:DSN"
    Please specify, what is command line arguments for jdbc-odbc bridge driver?
    Environment : Oracle 9i Report Builder on WinNT
    Database : Sybase
    Regards,
    Ramanan

    Hello Ramanan,
    Report Builder : connect JDBC Query in Report Builder is to through Connection Dialog in JDBC Query Editor. User can use a Sign on parameter (can use, default : P_JDBCPDS or can create new) to connect to JDBC Data Source. Connection once made will be mentioned and will be reused through out Reports Builder.
    JDBC PDS allows user to connect one or more same or different kind of databases.
    While running report through runtime or Server, user can pass the sign on parameter(connection string) value, like any other user parameter.
    Syntax for connection string : <username>/<password>@databaseURL . The syntax of database part of connection string depend on the type of JDBC Driver used to connect to Data Source while designing the JDBC Query. databaseURL refer to the location of the database and its format depend on the JDBCPDS river selected in design time while creating the JDBC Query.
    rwrun eg :
    rwrun report=jdbc_odbc.rdf destype=file desname=output.html desformat=html P_JDBCPDS=scott/tiger@database
    Server eg :
    http://server.com:8888/servlet/RWServlet?server=MyReportServer+report=jdbc_odbc.rdf+destype=cache+desformat=html+P_JDBCPDS=scott/tiger@database
    http :
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more information.
    With Regards
    Reports Team

  • How to run Excel Macros using JDBC-ODBC

    Hi,
    I want to run the excel macros in the excel file, after I connected to excel file, using JDBC-ODBC bridge.
    How macros treated here?
    Help needed please..........
    - Ramesh

    How to run Excel Macros using JDBC-ODBCYou don't.
    As my fuzzy understanding goes.....
    Macros (excel, word, etc) run via a "OLE" extension of the script host system.
    So the only way to run them is via the OLE interface. That has nothing to do with ODBC. You can write your own JNI to do that, or you might get lucky and find that someone else has written a java library to do it for you.

  • Can J2ee1.3 using jdbc/odbc?

    hi all,
    Is there anyone can tell me whether J2EE1.3 able to use jdbc/odbc? If not what should I do?
    thank you for your advise,
    regards,
    elvis

    See the answer to question 1 of the JDBC FAQ:
    http://java.sun.com/products/jdbc/faq.html

  • Compile a procedure /SQL file using JDBC?

    Is there a way we can compile a procedure or even a smiple SQL file using JDBC?
    Or in other words can "@ <file name with path>" be done using JDBC? Has anyone tried this before?
    I have five different databases, and i want to be able to compile my stored procedures at once on all my 5 databases. So, if we know if this is possible in JDBC?
    THanks

    right, as a matter of fact i wanted some pointers on how to run these SQL commands using JDBC.
    Like, set serveroutput on
    set feedback on
    @ filename or start filename
    show error
    etc.

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

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

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

Maybe you are looking for

  • Does Yosemite support DisplayPort 1.2 to daisy-chain 2 monitors from a single Thunderbolt port?

    Has anyone tried daisy-chaining two monitors from a single Thunderbolt port in Yosemite? DisplayPort 1.2 wasn't supported by Mavericks, but I'm hoping that might have been fixed with the new

  • Double Space File from GET Download from Server

    Whenever I GET a file within Dreamweaver (FTP) from the server, PHP and CSS files come down as double spaced. I've search many forums and changed the Code Format under Preferences but still get the same issues. I'm running the most current version of

  • Itunes 7.3 download

    How do I download itunes 7.3 for my ipod nano? I receive AOL security warning-windows has found a problem with this file-File blocked-no valid digital signature. hp pavilion a320n   Windows 2000  

  • Batch Merging PDF files.

    Okay here is the deal. We have two folders. Both folders have different PDF files that have the exact same name. So there is a /billing/00001.pdf and /activity/00001.pdf. We want to merge those two PDFs together through a batch process that will take

  • Region is not created and also the item is not added.. Help me

    Hi to all, I want to create a region dynamically(in the sense using code). The following code is used but the thing is the region is not created and the item also not created. Using the object of the item, i set the prompt , this is also not working.