JDBC API

The JDBC API has two parts: an application-level interface used by the application components to access a database, and a service provider interface to attach a JDBC driver to the J2EE platform.
So How & where we do coding for the application level interface & Service provider interface?
Does application level interface is coded in Java Standalone since it is used by application components?
please explain me in detail.
Thanks.

There are many tutorials on this out there. Very briefly (and i mean brief) WRT connections anyways
In a Java EE/J2EE environment, connections to the backend are done via a JNDI lookup of some sort of DataSource (Basic, XA or pooled) from which you get access to a connection object. Usually in this type of environment you let the container manage your transactions.
In a standalone java app, you would use DriverManager to obtain a Connection and you need to handle the mgmt of transactions.
You might also want to start looking at the Java Persistence API as this might meets someof your needs if you are starting fresh.
Try and ask more specific questions about specific interfaces for better guidance

Similar Messages

  • JDBC API ( JSR 169 ) Implementation for accessing oracle lite database

    We are developing an application using IBM J9 (CDC and Foundation Profile) on Pocket PC 2003 environment with SWT as the front end development. We are using Oracle Lite 9i as the Client database.
    We have sucessfully installed Oracle Lite and was able to create tables in the database.. however we could not find the JDBC API (java.sql and javax.sql packages which is JSR 169 JDBC 2.0/3.0) inorder to load the JDBC driver(OLITE40.jar) and access the oracle Lite Database on Pocket PC.
    IBM J9 Micro Environement does not have this support.
    I am wondering if Oracle provides this implementation.
    If not is there a get around.
    the client database is crucial to the application and i would really appreciate an answer to our problem.

    Check out
    http://groups.google.com/groups?hl=en&lr=&threadm=cjgl3g%248hhm%241%40news.boulder.ibm.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dibm.software.websphere.studio.device-developer
    I have had the same issue before.
    Regards,
    Ron

  • ERROR in JDBC API TUTORIAL using finally

    According to the jdbc api tutorial and reference, the way to close a pooled connection is to use a try/catch/finally block as follows:
    try{
    Connection con = ds.getConnection("login", "password");
    // ... code to use the connection
    catch(SQLException sqle){
    finally {
    if (con != null) con.close()
    HOWEVER it seems that u cannot call close() on con because it can throw an SQLException which is not caught. The compiler issues the following error:
    "unreported exception java.sql.SQLException; must be caught or declared to be thrown con.close();"
    Does anyone know how to remedy this

    try /catch the con.close,and you also can realize it by declaring the method by
    "thows SQLException"

  • WILL using JDBC API instead of LookUp APIs  hamper performance?????????????

    hi forum experts,
    i have done a JDBC call in a UDF in a message mapping to fetch some records from a database,
    i tried doing it with LookUp APIs,  but i think/found that LookUp APIs dont provide
    any method to execute DML statements, and moreover these APIs dont provide transactional behaviour....
    so i tried with JDBC APIs.......<<<<java.sql.*;>>>>.....where i used custom code to provide transactional behaviour........like explicitly using commit() methods. Where i m using Connection class...and in this case XI communication channels are not being used,,,....
    will using JDBC API instead of LookUp APIs hamper performance????????????

    Hi Sudeep,
    This will surely help u,
    /people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
    /people/william.li/blog/2007/03/30/using-jdbc-connection-pool-in-xi-message-mapping
    According to help.sap
    Use of Lookup API - Calls to other application systems are sometimes necessary to meet the following requirements:
    &#9679;     To get <b>read </b>access to application system data in the mapping program
    &#9679;     To call existing mapping routines in the application system
    So DML statements couldnt be used
    Additional help
    /people/prasad.illapani/blog/2006/10/25/how-to-check-jdbc-sql-query-syntax-and-verify-the-query-results-inside-a-user-defined-function-of-the-lookup-api
    <i>[Reward if helpful]</i>
    Regards,
    Prateek

  • Who will implement jdbc api interface?

    Hi Friends,
    I have One doubt on jdbc api interface,
    I will Explait it clearly
    Through java if we want connect any database we need to use JDBC,
    To conne to database,
    We need to load the driver and
    we need to establish the connection and
    we need to execute some Query,ryte...
    My exact doubt is...
    the Connection class and the total JDBC API is interface,
    to connect to the database,We need to use the above mentioned procedure but they are all interfaces,So those jdbc related interface must be implemented by someone.
    But who is going to implement that interface?
    I am very much confusing with this,
    Can anybody help me out regarding this with an Example.........
    Regards,
    Anji.

    Yes, the specific JDBC driver you use provides the implementation/concrete classes. So if you are using a oracle jdbc driver to connect to an oracle database, then as in your example:
    Connection con= DriverManager.getConnetion("--------");will result in an Oracle Specific implementation connection class (say: OracleConnection) being associated with your connection. Since OracleConnection implements Connection, you can interact with it through this interface. If for some reason, you database changes to MySQL you can simply replace the JDBC driver and your call to "getConnection" will now return the MySQL implementation class without having to change all the code that uses the connection since the MySQL connection class uses the same interface.
    In the same way, the JDBC driver has implementation classes for all the interfaces defined in the JDBC API (which you do not, and should not interact with directly). The driver will provide the correct implementation classes for your interfaces at runtime and you access them through their interface.

  • Why jdbc api ?why not use odbc api from java application?

    hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubt

    chari wrote:
    hi guys....am pretty confused abt these jdbc drivers...am unable to understand why we r using jdbc api when odbc api has been in market prior to jdbc.....please clarify my doubtbecause jdbc is the way that java does it.
    use it or don't.
    C++ was in the market before java - why was java developed at all? cobol was in the market before C++ - why was C++ developed at all?
    %

  • Launch mysql script using jdbc api

    Hello.
    I tried something like this:
                   stmt = conn.prepareStatement("source ./etc/schema-ddl.sql");
                   stmt.execute();
                   stmt.close();but it doesn't seem to work. Is there anyway possible to launch an sql script using jdbc api?
    thx in advance

    That won't work. Try using Runtime.exec to launch the full MySQL command.

  • About JDBC API

    "The JDBC API contains two major sets of interfaces:
    the first is the JDBC API for application writers,
    and the second is the lower-level JDBC driver API for driver writers.
    Applications and applets can access databases via the JDBC API using pure Java JDBC technology-based drivers."
    You can read this in the sun web site.
    When I have downloaded a jdbc driver for mysql database
    I have looked for source code and found those classes that implement the different interfaces belonging to package java.sql:
    at this point I imagine that this driver implements the first of the two interfaces in the previous sentence.
    I have not understood when the driver API for driver writers enter in this schema and if the second interface is anyway necessary for interact with the database: I would think that the second interface is necessary and is built with the driver API for driver writers, API that I have never seen.
    What do you think about this?

    I was thinking the same but now I am not so sure.
    Are you sure that API that belong to JDBC Driver API are not simply those concerning the driver manager?
    Anyway, when I download the driver in order to speak with the database, are there JDBC Driver API too?
    If you had reason, and the second volume of my official tutorial seems confirm this, the two interfaces would be completly separate.
    And I can not imagine a API that help me writing a driver for any database. Which type of help could give me?

  • Doubt handling Clob columns with Java JDBC api

    Hi,
    we have a doubt handling Clob columns with Java JDBC api.
    Reading Oracle 10g official documentation (document b10979.pdf, page 236), we found this note:
    ============================================
    To write LOB data, the application must acquire a write lock on the LOB object. One way to accomplish this is through a SELECT FOR UPDATE. Also, disable auto-commit mode.
    ============================================
    We also found a java sample code about how to handle Lob objects at this URL:
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSample/LOBSample.java.html
    In our java2 application, we access Clob objects in a quite different
    manner: we use normal setString() and getString() methods, as described into paragraph "Shortcuts For Inserting and Retrieving CLOB Data"
    (document b10979.pdf, page 244).
    Using those methods, we never lock the table row by a SELECT FOR UPDATE statement (as described into the note above). We use simply SELECT, UPDATE and INSERT prepared statement.
    In this way we can insert both clob objects and normal timestamp, number and other types with a single insert statement. Idem for update.
    To recap, our question is:
    Is it mandatory to create a SELECT FOR UPDATE statement when updating clob data? What may be the consequences if we don't use it? It is also correct to insert with a single sql statement both clob and not clob data using the setString() method for the clob types? And more than one lob column in the same record?
    bye,
    luca acri.

    And columns of type FLOAT. These also have, for some unknown reason a metadata type of OTHER, and a type string of 'FLOAT'. Yet PreparedStatement.setNull(x, Types.OTHER) doesn't work and setNull(x, Types.DECIMAL) does.

  • JDBC API 2.0

    Hello!
    How can I get autoincrementable element of an inserting row of a table?
    But I cannot use the JDBC API 2.0 new features(programmaticaly insert). In other words with the SQL only.

    Hello!
    How can I get autoincrementable element of an
    inserting row of a table?
    But I cannot use the JDBC API 2.0 new
    features(programmaticaly insert). In other words with
    the SQL only.depends on the database.
    what database are you using?
    the other option that is more independent is to select the last inserted row and read the value yourself.
    for example if the column is a number called id in a table called stuff
    String sql = "SELECT MAX(id) as lastid FROM stuff;";

  • JDBC API Docs?

    Where is the url about the JDBC API docs? I appreciate for any reply.
    Johnson

    You can also refer the Java doc here
    http://download-west.oracle.com/docs/cd/A97329_03/web.902/q20224/index.html
    Chandar

  • Oracle JDBC API for Classes111.zip

    Hi,
    Can any one tell where i could get the Java APIs for the classes111.zip.
    Thanks
    -Rao

    Rao,
    Javadocs for the JDBC drivers can be found here :
    http://otn.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm

  • JDBC oracle API

    Does anyone know where the oracle JDBC API docs are? I've looked all over and can't find them. Specifically I need the API for oracle ROWID type.
    David Shaffer
    null

    Rao,
    Javadocs for the JDBC drivers can be found here :
    http://otn.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm

  • How to use the direct bytebuffer in JNI? Accessing JDBC from C application.

    I am working on a project to access JDBC Driver within C application. The invocation JNI is used.
    To get better performance, I use the preparedStatement for dynamic sql. This need to transfer much parameter data from C to JDBC for PreparedStatement object in JVM. I think this maybe get improvements by using the new direct bytebuffer function from JDK1.4. However I cannot find an example code to get start. Could someone provide some ideas for this?
    Currently, I directly call JDBC API in C application through JNI, so there is no java codes. Only c file using JNI call.
    My understanding is to use the direct bytebuffer feature, I also need to have java codes to process the JDBC API call and then can share the same memory between Java and C. Please correct me if wrong.
    Any input is appreciated.

    tzhouxian wrote:
    thanks, jschell
    I am trying to get the best performance for the solution, using JDBC libs in a C application. So I am considering to use the direct bytebuffer in the solution to pass parameters to JDBC and get result sets from JDBC side.
    For your questions,
    1. Why don't you just write the database access in C?
    You mean to directly call JDBC API in C through JNI, right? My plan is to wrap the JDBC API by java and expose seldom interface to C native code, so reduce the JNI call between C and JAVA. If directly call the JDBC API call from C, the number of JNI call maybe more.
    No I mean what I said. In C, no java at all, why don't you write code to access the database?
    2. The database access itself is going to be slower than anything that you do in C or java.
    Exactly. I just want to find each potential points to get performance improvements for the whole solution. I also did some optimization work for the database call. The goal is to get the best performance from C application to database through JDBC libs.
    Then I suggest you profile it.
    3. Why don't you use import/export files and the database tools? This is often significantly faster with volume processing.
    Sorry, I am not very familar with some functions of JNI. Could you explain, " +Why don't you use import/export files and the database tools+"?
    Nothing to do with java, jni nor C.
    Major (or perhaps everything that is a real 'database') comes with additional tools. Amounst those tools will be command line tools capable of importing and exporting data from the database. In processing bulk data they will always be faster than anything you can do in JDBC.

  • Problem in sender JDBC adapter

    hello,
    I am facing one typical problem in sender JDBC adapter.
    Here is the issue,
    JDBC API method getString threw an exception: java.sql.SQLException: Cursor state not valid.
    Can anyone please help me out in solving this problem?
    Actually after a retry of 3 times the message has been successfully sent. Till then i am getting these error
    On 1st attempt ,
    Error during conversion of query result  to XML java.sql.SQLException: Cursor state not valid
    On 2nd attempt,
    Error during conversion of query result  to XML java.sql.SQLException: Internal driver error                                                                               
    (class.java.lang.InterruptedException)
    On 3rd attempt,
    Processing finished successfully.
    This is the scenario that i can see in the audit log.
    Can you please help me out in solving this issue.
    Thanks,
    Soorya

    Hi gaurav,
    It was a good response from your side.
    I have gone through the FAQ but could not able to find anything.
    Can you please help me out in this regard ?
    Also i am using select query of this kind,
    SELECT
    SEFVHRC.VHRBRCD,SEFVHRC.VHRCUCD,SEFVHRC.VHRVIN,SEFVHRC.VHRMOCD,SEFVHRC.VHRCHAS,
    SEFVHRC.VHRSLOR,SEFVHRC.VHRDIVI,SEFVHRC.VHRMGCD,SEFVHRC.VHRMOCH,SEFVHRC.VHRVHTY,
    SEFVHRC.VHRBDTY,SEFVHRC.VHRMFYR,SEFVHRC.VHRMOYR,SEFVHRC.VHRMODS,
    SEFVHRC.VHRMDTL,SEFVHRC.VHRCLBR,SEFVHRC.VHRRCID,SEFVHRC.VHRARDT,
    SEFVHRC.VHRLUTM,SEFVHRC.VHRLUDT,SEFVHRC.VHRKEYN,SEFVHRC.VHRCTORN,
    SEFVHRC.VHRCTIMP,SEFVHRC.VHRPRDT,SEFVHRC.VHRPRDT,SEFVHRC.VHRRCDT,
    SEFVHFT.VHFCLCD,SEFVHFT.VHFCAT,SEFVHFT.VHFCADSC,SEFVHFT.VHFKEY,SEFVHFT.VHFTEXT1,
    SEFVHFT.VHFTEXT2,SEFVHFT.VHFTEXT3,SEFVHFT.VHFTEXT4
    FROM
    SAPTESTLIB.SEFVHRC,SAPTESTLIB.SEFVHFT
    WHERE
    SEFVHRC.VHRVIN = SEFVHFT.VHFVIN AND SEFVHRC.VHRSTTS = ' '
    and update query of this kind,
    Update SEFVHRC SET VHRSTTS = 'R' WHERE VHRSTTS = ' '
    I am using prity big select query. is there any option to optimize it?
    Can you please help me out in solving this problem
    urs,
    Soorya

Maybe you are looking for

  • How can I get my iMac to not go to sleep, but also black out the screen?

    I want to leave my iMac on during the night, however when I sleep the display it ends up (after a couple of hours) completely going to sleep and an AppleScript won't work. Is there a way to make the screen go black but keep the computer on? I've got

  • Analysis and repair of BW objects

    Dear all, Could you please tell me how to use RSRV transcation in BW for analysis and repair of BW objects. I have tested some of my IC, IO and found errors in the objects and when i clicked 'correct error' it is not going to correct. Could you plese

  • Nokia6230i music track names

    I`ve had the same problem as many of you seem to have with track names in music player appearing as a series of squares.After a lot of experimenting i`ve found that removing the ID3v2 tags(leave the IDv1 tags)solved my problem.I used a tag editor cal

  • Linq to sql return dynamic table

    Hi, I am looking to use linq to sql like I did with ADO and return a dynamic table like I did with a datatable. I will not know what table/fields will return until runtime.  I later want to loop through the return table and get the field names and va

  • Ipad won't charge -- need to back it up

    My iPad will not charge and itunes will not detect it. I called Apple and they sent me a replacement cord but still nothing. I am reading on many sites that they will replace it so I need to get my stuff off my ipad. What is going to be the best way