Support for Generated Keys in oracke jdbc drivers?

Hi All,
Anyone know when the Oracle Thin JDBC drivers are going to support generated keys?
Regards,
Lee

Sure Justin,
I should have made myself more clear. Sorry about that.
I have a sequence for generating primary keys in a particular table, and a trigger to replace a null in my insert query with the nextval. That all works fine. I would like to use the DB-neutral means of getting a generated primary key...
prepStmt = connection.prepareStatement(insertSQL, Statement.RETURN_GENERATED_KEYS);
prepStmt.executeUpdate();
... and later ...
ResultSet generatedKeyRS = prepStmt.getGeneratedKeys();
... etc.
I am aware that I can get this information several other Oracle9i-specific ways, including using the sequence's .currval and creating a callable statement that returns the primary key column. However I would still like to use the nice, neat, vendor-neutral JDBCv3 way. Call me pedantic.
Regards,
Lee

Similar Messages

  • Latvian Language support for generated PDF's with FPDF module for PHP

    Hello !
    I have a problem with Adobe Reader for Android. I am working with online PDF creation with PHP module named FPDF.
    With FPDF module for PHP you can create PDF's online.
    The problem is that - when generated PDF appears on phone it doesn't show Latvian language ( cp1257 or  ISO-8859-13 for example ). For example - "ŗķļņž" and "ŖĶĻŅŽ" is shown with other symbols.
    However opening the same file with standart app "Polaris Office" - the text is show as it used to be, without problem.
    Strange bug, that i can't fix from PHP ( Tried a lot of decodes and encodes ). Also i have saved PHP file with different encodings - nothing helped.

    You might ask about this in the regular forum. There are several form experts there that may be able to help you.

  • Bad support for ts hint in Oracle jdbc driver (for preparedStatement)

    hi
    I have the following SQL
    SELECT TRUNC({ ts '2004-01-01 00:00:00.0' }) FROM ET1_ELEMENT
    With the jdbc.odbc driver the following meta data is returned:
    ResultSet meta data are...
    Column [1]
    name [TRUNC(TO_DATE('2004-01-0100:00]
    type [93]
    class name [java.sql.Timestamp]
    which is fine.
    Nevertheless with Oracle thin driver I got an SQL exception:
    The SQL Error is:
    ORA-00932: inconsistent datatypes: expected NUMBER got TIMESTAMP
    internal exception:
    (class java.sql.SQLException):
    java.sql.SQLException: ORA-00932: inconsistent datatypes: expected NUMBER got TIMESTAMP
    If I use the TO_DATE in the sentence (e.g. t_date('2004-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS')) everything is fine on both driver.
    Any idea on the problem? Is it a bug?
    Thanks

    Mikael,
    I couldn't ascertain your environment from your post, so the below may be irrelevant for you. But in the hope that is isn't...
    I tried your example on an Oracle 9i (9.2.0.4) database on SUN [sparc] Solaris 9, with J2SE 1.4.2_04 and the "ojdbc14.jar" [JDBC] driver. If I remove the "trunc" function, then I do not get an Oracle error. I must admit, though, that I don't understand why you need to trunc(ate) a literal value. All that the "trunc" function does is set the time part -- the hours, minutes, seconds, etc. -- of your timestamp to (all) zeroes -- which is what you have in your literal, anyway, so why the need for "trunc"?
    I believe the Oracle JDBC driver converts the java sql-escape syntax -- "{ts '2004-01-01 00:00:00.0'}" -- to a call to the "to_date" function, anyway. Possibly one way to verify this would be to use P6 Spy. If I am correct, then it would only be logical that Oracle allows you to use the sql-escape syntax wherever it is all right to use the "to_date" function. But then again, I guess that
    select trunc(to_date('2004-01-01 00:00','YYYY-MM-DD HH24:MI')
    from   ET1_ELEMENTis allowable syntax anyway. So I guess maybe that this may be a bug in the JDBC driver. Have you checked the MetaLink Web site?
    Good Luck,
    Avi.

  • JDBC Drivers for Linux

    How come Oracle's web site only has downloads for NT and Solaris. Where do I get the latest JDBC driver for Linux?

    You should be able to use clases111.zip from AIX or NT with your
    Linux client, just copy the file, and add it to your CLASSPATH.
    I'm using classes111.zip from AIX (8.1.5) on NT and Win95
    clients.
    This will work for the thin client, the oci8 needs SQL*Net
    (and some more support libs.) installed to work
    Hilsen Jan
    Greg Patrick (guest) wrote:
    : Well that's no good! I don't have the database client
    : for Linux. Our 8.0.5 DB is on AIX. We have Windows NT
    : 8.0.5 client CD's. I shouldn't need an entire 8.0.5
    : Linux client installation just to use JDBC, should I?
    : JDBC drivers are available for download for NT and Solaris,
    : why not Linux?
    : John Salvo (guest) wrote:
    : : They are included with the 8 and 8i installations.
    : : Greg Patrick (guest) wrote:
    : : : I can't find any JDBC drivers for Linux on the Oracle
    : Technet
    : : : site... It seems very strange that Oracle would have an
    : : : 8i database for Linux but not have JDBC drivers. Is this
    : true?
    : : : All I want is for a java program on a Linux machine to be
    : : : able to use the OCI drivers to talk to the database on
    : another
    : : : machine. Even JDBC thin drivers would be better than
    : nothing.
    : : : Where are they?
    : : : Thanks,
    : : : Greg Patrick
    : : : http://www.abe.com
    null

  • Why is there no support for up and down arrow keys when scrolling through presets in adobe raw

    seems like it would be common sense to support such a basic function, especially when having to scroll through about 100+ different presets(VSCO Film). We need support for arrow keys so that it may be easier to compare colors much more quickly. Also the support for comparing 2 of the same images would be even more awesome, RAW image on left, and Presets on the right, or compare different presets to one another.

    You can submit it as a feature rquest, then forget about and go back to your life.

  • How to get auto generated column in spring jdbc

    Hi guys ,
    I am using springJDBC and sybase db.
    I think what i am facing is a standard problem but whatever support i am getting from google is not working.
    My problem is :
    "While inserting values in database one colum is autogenerated .....how do i get the value of that column??"
    FYI,
    I have tried using the following code :
    "final String INSERT_SQL = "insert into my_test (name) values(?)";
    final String name = "Rob";
    KeyHolder keyHolder = new GeneratedKeyHolder();
    jdbcTemplate.update(
    new PreparedStatementCreator() {
    public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
    PreparedStatement ps =
    connection.prepareStatement(INSERT_SQL, new String[] {"id"});
    ps.setString(1, name);
    return ps;
    keyHolder);
    // keyHolder.getKey() now contains the generated key"
    but i am getting this error : "java.lang.AbstractMethodError: com.sybase.jdbc2.jdbc.SybConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement"
    I think this code works well with Oracle but not with sybase .........does anyone know the solution of this problem .......and by "this problem" i mean how to retrieve auto generate value in spring jdbc ...........without using SimpleJdbcInsert class

    Looking at the previous post it doesn't look like a Spring issue.
    You are using a JDBC driver which does not support getting generated keys so you have 2 choices:
    - Use a different driver that supports generated keys
    - Get the generated key by issuing some vendor specific SQL e.g. 'select @@identity' for SQL server

  • Configure OC4J with other JDBC Drivers

    I want to add ability for OC4J to use mySQL JDBC drivers.
    Normally in the J2EE RI you would copy the driver and then use the j2eeadmin tool.
    Does anyone have info on getting this to work in OC4J (so I can test EJBs that use that DB).
    Note: I did get mySQL working for the JDeveloper9i IDE to get it to work in the IDE I just added a line to C:\jdev9i_902\jdev\binjdev.conf:
    AddJavaLibFile C:/mm.mysql-2.0.14/mm.mysql-2.0.14-bin.jar
    Thanks

    Check out the following doc
    http://otn.oracle.com/docs/products/ias/doc_library/90200doc_otn/web.902/a95879/ds.htm#1004903
    you can post OC4J configuration questions in the J2EE forum
    raghu
    JDev Team

  • Is the 'jdbc.drivers' system property official?

    Hi, i've just read the Java Technology Fundamentals Newsletter, June issue. They mention a way to load a JDBC driver using the 'jdbc.drivers' system property. But i wonder if this is an official system property because i can't find it in the docs (JDBC specification, API docs). Does somebody know, where this system property is specified?
    Thanks in advance.
    Markus

    This is an extract form JavaDocs on java.sql.DriverManger:
    public class DriverManager
    extends Object
    The basic service for managing a set of JDBC drivers.
    NOTE: The DataSource interface, new in the JDBC 2.0 API, provides another way to connect to a data source. The use of a DataSource object is the preferred means of connecting to a data source.
    As part of its initialization, the DriverManager class will attempt to load the driver classes referenced in the "jdbc.drivers" system property. This allows a user to customize the JDBC Drivers used by their applications. For example in your ~/.hotjava/properties file you might specify:
    jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
    A program can also explicitly load JDBC drivers at any time. For example, the my.sql.Driver is loaded with the following statement:
    Class.forName("my.sql.Driver");
    Dave

  • How to add support for new JDBC Drivers in WebLogic Server?

    Hi!
    I am using WebLogic Server 10.
    As we know,WebLogic Server contains some jdbc drivers itself,but if we want to use another drivers besides them,what can we do?(I am using Oracle 11g,but WebLogic Server 10 doesn't contain JDBC support for it.)
    Just copy the .jar files of the drivers to the directoty "WL_HOME/server/lib" or need to configure something else?
    Thanks!
    Huang

    Hi!
    I am using WebLogic Server 10.
    As we know,WebLogic Server contains some jdbc drivers itself,but if we want to use another drivers besides them,what can we do?(I am using Oracle 11g,but WebLogic Server 10 doesn't contain JDBC support for it.)
    Just copy the .jar files of the drivers to the directoty "WL_HOME/server/lib" or need to configure something else?
    Thanks!
    Huang

  • Where can I find platform support metrix for Oracle 10g/11i JDBC drivers?

    I need find the official supported platform metrix of Oracle 10g/11i JDBC drivers.
    Where can I find this kind of information?
    especially, does Oracle 10g/11i JDBC drivers support Windows2008 and AIX6.1?
    Any information, please share with me here.
    Thank you so much!

    This Metalink has all the nesscessary inforamtion
    metalink 401934.1
    Besides this you can check the JDBC developers guide
    [For 11|http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/overvw.htm#i1003779] [For 10g|http://download.oracle.com/docs/cd/B14117_01/java.101/b10979/overvw.htm#sthref61]

  • Is this good approach for generating Primary Keys ?

    Hi,
    All our EJBs are state less Session Beans.
    We have created a state less Session(name SequenceEJB) for getting Primary Key.
    Thre is a method,
    int getSequenceNumber(String tableName,String fieldName) in SequenceEJB. And the following query is used in the above said method.
    SELECT MAX("+fieldName+") ID FROM "+tableName
    Each EJB will lookup SequenceEJB, and call the above said method for getting sequence number.
    Is this approach sclable ?
    Can we proceed by this approach ?
    Thanks in advance
    Srinivas

    As long as you are in EJB, synchronization won't help you because it is not permitted by the EJB spec.
    If you can go with JDBC 3.0 / Java 1.4, the statement interface supportes generated keys. See http://java.sun.com/j2se/1.4/docs/api/java/sql/Statement.html.
    If you cannot go with JDBC 3.0 / Java 1.4, you can implement the key-generation db-specific (e.g. using oracle sequences for oracle tables, and whatever exists for DB2, SQL Server etc.) That of course requires special support for all databases, but at least you can run your app with different databases.
    Or you can try to do it the following way, using a separate table for the keys.
    ResultSet rs = statement.executeQuery("select id from mySequences");
    oldId = rs.getInt(1);
    newId = oldId + 1
    int updatedRows = statement.executeQuery("update mySequences set id = newId where id = oldId");
    if(updatedRows == 1) {
      // succesful
    } else {
      // not sucessful, somebody else has already retrieve this id; do something like Thread.sleep() and retry
    }This way, the database does the actual synchronization between the processes (each process sees the same data in the tables), and you implement the retry logic.

  • JDBC - Optional support for certain methods

    According to the notes on http://java.sun.com/products/jdbc/driverdevs.html (Section A.2.1) a method that is inappropriate for the underlying DBMS may throw SQLException. Presumably the text associated with this exception would indicate that the method is not supported. However, the actual text used is not defined. Indeed, how can it be if full internationalisation is to be accounted for?
    And so to my dilemma...
    Let's say I want to write a generic wrapper for any JDBC driver and somewhere in my code I want to invoke PreparedStatement.setBigDecimal(). This method must be implemented but isn't necessarily supported. [ The JDBC driver supplied by SAS Institute is an example of this. ] When invoked, this method throws SQL Exception unconditionally.
    What I want to be able to do is to determine in advance whether or not this method, or indeed any of the optional methods, is supported.
    There are certain useful methods available in the implementation of DatabaseMetaData but nothing to help me in this particular case.
    It's no good catching the exception because there's no well-defined way to interrogate the exception's message String to determine how or why it was generated.
    Am I missing something here or is this really a "hole" in the standard?

    Am I missing something here or is this really a "hole"
    in the standard? You are missing something.
    You are assuming that there is some sort of real standard compliance for JDBC drivers.
    There is not.

  • Is in ORACLE JDBC drivers connection pooling support

    Hi All!
    Can anybody give me information about subj?
    Any information appreciated

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mike:
    Hi All!
    Can anybody give me information about subj?
    Any information appreciated<HR></BLOCKQUOTE>
    Yes, Oracle JDBC drivers do support connection pooling. Download the latest drivers to get samples and refer doc for more details.

  • JDBC 10g - Support for TNS name entries

    Hello,
    I found the following statement:
    JDBC-Thin support for TNSNAMES.ORA Lookup: similar to JDBC-OCI, both client-side and server-side JDBC-Thin can now read the local TNSNAMES.ORA file to resolve service name or TNS alias. Consequently Java in the database will also be in position to reference external Oracle database, using service name. See the JDBC documentation for more details.
    in the Oracle white paper "What’s New for Java DB, JDBC, and Database Web Services in Oracle Database 10g". However, I have found several statments/notes in the accompanying 10g JDBC documentation that appear to directly contradict the statement above. For example, the following note:
    Note:
    Because the JDBC Thin driver can be used in applets that do not depend on an Oracle client installation, you cannot use a TNSNAMES entry to set up a Thin driver connection.
    Does anybody know if the JDBC Thin driver supports connection via a TNSNAMES entry? If so, can you direct me to the documentation on how to use it.
    FYI, I have managed to establish a connection using a TNS alias and JDBC-OCI as follows:
    OracleDataSource ods = new OracleDataSource();
    ods.setTNSEntryName("MyTNSAlias");
    ods.setUser("scott");
    ods.setPassword("tiger");
    ods.setDriverType("oci8");
    Connection conn = ods.getConnection();
    However, if I set driver type to "thin" instead of "oci8", I get the following error:
    Exception in thread "main" java.sql.SQLException: Io exception: SO Exception was generated
    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.OracleConnection.<init>(OracleConnection.java:404)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:140)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:169)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:108)
    at prototype.TNSTest.main(TNSTest.java:36)
    Thanks in advance.

    Hi,
    I wrote the white paper in question and am in position to confirm that in 10.2, JDBC-Thin does indeed support tnsnames.ora; you need to specify the location (i.e., directory) of the tnsnames.ora file in the oracle.net.tns.admin system property
    java -Doracle.net.tns_admin=$ORACLE_HOME/network/admini have working examples in my book.
    I'll have it fixed in the online doc, our printed doc is sometimes out of sync.
    Kuassi http://db360.blogspot.com

  • JDBC Drivers for Windows 2000

    I am new to JDBC and relatively new to Java. I am trying to set up my environment to connect to an Oracle database and am running Windows 2000 Professional. I need advice on what driver I need to install and where to get it. Have looked at Oracle but they only offer drivers for Win NT. Don't want to pay for it either!
    Thanks in advance

    Anything that runs under Win NT will run under Win 2000.
    Search the internet for free JDBC drivers - it might turn that you get what you pay for, however. If your site has an Oracle database then it probably has a support contract - check with your admin.

Maybe you are looking for

  • Importing Word Documents with Images

    Hi, When I import word document in to Robohelp, it imports the images also. Now, I have duplicate images in multiple topics. How do I avoid duplicate images being imported? Is there anyway, where I can collate and store all the images in a single fol

  • My phone keeps sending Imessages to someone without an Iphone, and someone else is receiving them through imessage and replying.

    If my 3g or Wifi is off my phone will text the correct number, my friend's samsung phone, however whenever my 3g or wifi is on, my phone sends my texts to my friend as imessages that do not go to his phone - they go to another persons device as an im

  • Error message 13005

    iTunes working fine on my Pc with Vista. Yesterday wouldn't open and puts up 'unknown error 13005 message. I've removed and reloaded iTunes but it still refuses to open and puts up the same message. Any suggestions?

  • F.05 Problem

    Dear Friiends, I ran F.05 to revalue our AR/AP balances at the end of P3 using varient ( UK 0705) unfortunately when I ran it I used the evaluation date 30.09.2007 and posting date 29.09.0207..... of course this is wrong. Will this create an issue in

  • Is it possible to run IC WINclient through the ITS?

    Hello. I try to launch Interaction Center WIN Client through ITS and get DNS-error when using Search BP page of IC WinClient: all links have domain "sapevent:" Of course this domain doesn't exists in our network. I know about IC WEB Client and we use