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?

Similar Messages

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

  • 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

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

  • ####a question about jdbc driver

    A question about jdbc driver: for Oracle JDBC drivers which will not allow O/R
    tools to access columns over 4 kb. This affects some of the functionality of my
    application.A workaround is to use the my JDBC driver that acts as a wrapper to
    ensure that columns over 4 kb read and persist properly. my JDBC driver determines
    which actual driver to load based on the connection URL. If you pass in a URL
    that contains the string jdbc:oracle:thin, it will know to load oracle.jdbc.driver.OracleDriver.
    If the URL contains the string jdbc:db2, it will know to load COM.ibm.db2.jdbc.net.DB2Driver,
    and so on.
    now i have set CLASSPATH for my jdbc wapper,when I Creating and Configuring a
    JDBC Connection Pool,i have to input my driver name such com.lawrence.driver.....then
    i did,all
    is well,then i restart my WLS,when load config.xml,some errors such as "No registered
    driver accept URL:jdbc:oracle:thin:@localhost:1521:lawrence",if i set driver name
    is oracle.jdbc.driver.OracleDriver,all is good,no any errors.
    I find some questions like:
    1.for WLS8.1 ,it is only find some registed driver?
    2.why it cannot load my driver wapper when it is loading jdbc Connection Pool,but
    when the WLS start is finished, i Creating and Configuring a JDBC Connection Pool
    then it is right?

    my JDBC driver like this:
    public class myDriver implements Driver {
         public static String DB2_DRIVER = "COM.ibm.db2.jdbc.net.DB2Driver";
         public static String DB2_URL = "jdbc:db2:";
         public static String HYPERSONIC_DRIVER = "org.hsqldb.jdbcDriver";
         public static String HYPERSONIC_URL = "jdbc:hsqldb:";
         public static String MYSQL_DRIVER = "com.mysql.jdbc.Driver";
         public static String MYSQL_URL = "jdbc:mysql:";
         public static String ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
         public static String ORACLE_URL = "jdbc:oracle:";
         public static String POSTGRESQL_DRIVER = "org.postgresql.Driver";
         public static String POSTGRESQL_URL = "jdbc:postgresql:";
         public static String SQLSERVER_DRIVER =
              "com.microsoft.jdbc.sqlserver.SQLServerDriver";
         public static String SQLSERVER_URL = "jdbc:microsoft:";
         public boolean acceptsURL(String url) throws SQLException {
              return true;
         public synchronized Connection connect(String url, Properties props)
              throws SQLException {
              if (_driver == null) {
                   Class driverClass = null;
                   try {
                        if (url.startsWith(DB2_URL)) {
                             driverClass = Class.forName(DB2_DRIVER);
                        else if (url.startsWith(HYPERSONIC_URL)) {
                             driverClass = Class.forName(HYPERSONIC_DRIVER);
                        else if (url.startsWith(MYSQL_URL)) {
                             driverClass = Class.forName(MYSQL_DRIVER);
                        else if (url.startsWith(ORACLE_URL)) {
                             driverClass = Class.forName(ORACLE_DRIVER);
                        else if (url.startsWith(POSTGRESQL_URL)) {
                             driverClass = Class.forName(POSTGRESQL_DRIVER);
                        else if (url.startsWith(SQLSERVER_URL)) {
                             driverClass = Class.forName(SQLSERVER_DRIVER);
                        _driver = (Driver)driverClass.newInstance();
                   catch (Exception e) {
                        throw new SQLException(e.getMessage());
              Connection con = _driver.connect(url, props);
              return new myConnection(con);
         public int getMajorVersion() {
              return _driver.getMajorVersion();
         public int getMinorVersion() {
              return _driver.getMinorVersion();
         public DriverPropertyInfo[] getPropertyInfo(String url, Properties props)
              throws SQLException {
              return _driver.getPropertyInfo(url, props);
         public boolean jdbcCompliant() {
              return _driver.jdbcCompliant();
         private Driver _driver;

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

  • I would like to learn more about the API associated with contract and  pric

    Hi
    I would like to learn more about the API associated with contract and pricing agreements in advanced pricing modules os Oracle 11i and also get functional knowledge.
    Please note that, I have almost no knowledge about oracle oracle ERP system.
    Please advice, where do I start.
    thanks
    siva

    Please read Oracle Applications Developer's Guide .

  • About JDBC

    Hi, I am a fresher studying about JDBC. I wanted to know about the basics of JDBC. i wanted to know for what purpose JDBC is used..

    hi
    there r diffrent types of jdbc connection.hope u kmow jdbc is use to connect to database.if u need jdbc -mysql connection
    1.download a mysql connector from apache site
    2.edit .bash profile and add patf of connector to classpath
    3.follow this link http://www.kitebird.com/articles/jdbc.html#TOC_1

  • About JDBC Drivers

    Hello,
    I am not have a clear idea about JDBC drivers , Any one Give the diff between the four types and where we use ,which is best ..................plz make a reply

    "JDBC drivers in the wild
    Learn how to deploy, use, and benchmark JDBC driver types 1, 2, 3, and 4 " at
    http://www.javaworld.com/javaworld/jw-07-2000/jw-0707-jdbc.html
    Good work.

  • 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;";

Maybe you are looking for