JDBC 4.0 Public Review

The JDBC 4.0 Public Review Draft specification is now available on the JCP web site.
http://jcp.org/aboutJava/communityprocess/pr/jsr221/index.html
This is the JDBC spec that will be included in Java 6.0 so this is what you'll be living with for the next few years. I strongly encourage you to take a look at it.
There isn't much room to make significant additions or sweeping changes. Java 6.0 goes final fairly soon. What is important is to have as many eyes as possible review the spec and look for things that are unclear or broken.
Of course you can post comments here, in fact I encourge you to do so to refine your criticism, but the Expert Group will only see comments emailed to the address on the web page above.
Major new things include support for XML type, support for an unwrap method, factory methods for large objects, and a lot of bug fixes, clean up, and clarifications of the 3.0 spec. The XML support is intentionally minimal as this is a complex area. It is easier to add new methods than remove old broken ones. The unwrap method is somewhat subtle so look at it closely.
We didn't get any responses to the Early Review Draft. We would really like a lot more eyes looking for problems and helping to identify areas that are unclear. This is your opportunity to have an impact on the JDBC spec.

Well, the JDBC 4.0 specification is not yet final, as an implementor we cannot comment or fix a potential bug until the spec is final. Having said that I'll forward this to our rep at the JDBC JSR Expert Group.
Kuassi - http://db360.blogspot.com/

Similar Messages

  • Java Card 2.2.2 draft is out for public review

    A draft for the upcoming release of the Java Card Specification is available for public review.
    The Java Card 2.2.2 Specification will provide numerous enhancements to the award-winning Java Card platform. In particular it will include specific support for contactless communication and ID cards :
    * enhancements to ease the management and increase interoperability of contactless cards.
    * additional cryptography and security features
    * utility APIs for memory-efficient applet development
    Java Card technology v2.2.2 is ready for the next generations of smart card standards, and is fully backward-compatible with previous versions.
    New features in Java Card 2.2.2 :
    * Utility APIs for TLV, BCD, short, int
    * ISO7816-based Extended length APDU support
    * Support for up to 20 logical channels
    * External memory access API
    * Multiple Interfaces management
    * Additional cryptography algorithms : HMAC-MD5, HMAC-SHA1, SHA-256 and Korean Seed
    * Signature with message recovery
    * Partial message digest
    * Standardized Biometrics API
    Please direct your comments on this draft at [email protected] Feedback received before December 15th will be considered for the final version of the specification. For more information on the Java Card Platform Specification v2.2.2, Public Review Draft, refer to the release notes on http://java.sun.com/products/javacard/RELEASENOTES_jcspecsp.html

    The Installer and the Applet Deletion Manager are implemented in the JCRE and GlobalPlatform. On-card the Card Manager manages the content management, communication and the related security. JCRE specifies how it has to handle installation and deletion, but leaves room for different implementations. To the outside world, on a GP card, the Installer/ADM is the Card Manager with a specific AID.
    Installer and ADM are optional. For instance a Java Card Static product does not need an Installer/ADM.
    JCOP cards have the Installer/ADM fully implemented. It uses the GP functionality. The CM has to be selected to install or delete a package/applet.

  • [Announce] WSRP 1.0 Primer available for public review

    A public draft of WSRP 1.0 Primer is now available for review and
    comments. This document may help those trying to figure out the nuts and
    bolts of WSRP. If you have any comments, please post at the link below.
    Subbu
    A public review period for the WSRP v1 Primer (located at
    http://www.oasis-open.org/committees/download.php/9002/wsrp-primer-1.0-draft-0.9.pdf)
    will run until October 2, 2004. Please use the WSRP comment facility at
    http://www.oasis-open.org/committees/comments/form.php?wg_abbrev=wsrp to
    provide feedback to the TC.
    Rich Thompson
    OASIS WSRP TC Chair

    As explained by Marc Fluery of JBoss, there are essentially three types of
    open-source:
    1) Corporations that open their source for market share, such as IBM's Eclipse, that
    then uses it to market WebSphere Studio
    2) Hobbyist who develop an open-source project for free. The hobbyist may be a true
    professional developer, but he is dedicated to his project as a hobby. In this situation,
    donations are substantial enough to pay a dedicated developer.
    3) Professional Open-Source in which developer is paid to maintain and develop an
    open-source project in the hopes of making money with it through consulting and
    professional services.
    My question to the MyFaces team, which type of open-source are you?
    As a corporate developer, I would hope it is Professional Open-Source, since that
    model may have more support for the product I am using.
    -Me

  • [ANNOUNCE] JSP 2.1 and Faces 1.2 Public Review

    We are pleased to announce the availability of the Public Review
    of the next versions of the specification for JavaServer Pages (JSP)
    and JavaServer Faces (Faces). JSP 2.1 is developed under JSR-245 and
    Faces 1.2 is developed under JSR-252. The two expert groups are working
    ogether to improve the alignment between these two powerful web presentation
    technologies.
    Building on the work that was accomplished with the Early Draft
    Review, this Public Review covers two additional areas that required
    better integration between JSP and Faces:
    - Tree Creation and Content Interweaving
    - Deferred expressions nested within iteration tags
    Please see Appendix E of the JSP spec and the
    Preface of the Faces spec to see details of what's changed.
    To access the specifications:
    JSP 2.1 PR (JSR-245)
    http://jcp.org/aboutJava/communityprocess/pr/jsr245/
    Faces 1.2 PR (JSR-252)
    http://jcp.org/aboutJava/communityprocess/pr/jsr252/
    Sincerely,
    The JSR-245 and JSR-252 Expert Groups

    Can you confirm reports that the Unified EL is still not going to allow method calls on Java objects?
    This has had a major impact on Joda-Time http://joda-time.sourceforge.net (a replacement for all the date and calendar classes in the JDK). The JSP and JSF specs expect to get all of their date objects as java.util.Date. However, our classes do not extend Date, but instead provide a toDate() method for easy conversion. However, with the EL being so restrictive it cannot call the toDate() method, causing no end of trouble.
    The mailing list thread is here:
    http://sourceforge.net/mailarchive/forum.php?thread_id=7037421&forum_id=8530
    It really is incredibly narrow minded to block method calls from the EL. Joda-Time is just one of many projects that would benefit from allowing method calls. As it is, I will probably have to pollute the Joda-Time library by providing a getAsDate() method, which is frankly crap.

  • Jsr-201 including varargs in public review

    Now that jsr-201 has gone into public review I have sent an email about varargs to:
    [email protected]
    I have included below some of the reasons why I think the Concise Object Array Literals syntax is better than their currently proposed varargs syntax.
    They claim that most of the feedback they have got prefers the vararg syntax, I did another search in this forum and it still appears to me that people prefer the Concise Object Array Literals syntax , hence maybe others could also send their comments to [email protected]
    * the callee can clearly see that they are passing in varargs
    * the callee can pass in many var arg parameters, not just 1 at the end
    e.g.
    public void foo(int arg1, Object[] arg2, Integer[]) {
    public void test() {
      foo(1, {"hello", true, 5, 5L, 5F, 5.0}, {1, 2, 3});
    }* the callee can choose to pass in a different number of arguments based on a condition:
    e.g.
    public void foo(int arg1, Object[] arg2, int arg3) {
    public void test() {
      foo(1, condition ? {"hello", true, 5, 5L, 5F, 5.0} : {"hello", true, 5}, 3);
    }* the callee can call other 3rd party methods that already exist without having to wait for them to change all their methods to the ... syntax (Concise Object Array Literals is more compatible with existing code)

    They claim that most of the feedback they have got
    prefers the vararg syntax, I did another search in
    this forum and it still appears to me that people
    prefer the Concise Object Array Literals syntax ,
    hence maybe others could also send their comments to
    [email protected]
    I don't like varargs, too. Your observation about this forum may be quite simple to explain - people who really understand problems with varargs do not write to these forums. For lots of people, typing extra { and } with concise array literals will not be an issue. However, they consider this extra curly braces "an overhead" and submit feedback that they like varargs syntax more, just because it does not have curly braces. It seems that they do not fully realize consequences or just simply have not spent enough time to think about them. At the first glance, of course, varargs will look more attractive than concise array literals for method calls.
    I also object that "varargs are good because they help to see that certain method is interested only in values of array". We have javadoc for this! One can also use Tiger's annotation facility for this. There is no need to invent new syntaxt just for annotation/documentation. I'm alarmed when I read "this is what I like the most about varargs". It means - varargs are no good.
    However, it may not be possible to resurrect concise array literals in Tiger due to timing. My opining on this matter is expressed fully in my JSR-201 comment. Here's a copy:
    lease, do not include varargs as they currently specified into Tiger.
    There seem to be too much controversy between varagrs and concise
    array liters at this point. It is evident that a better solution that
    addresses needs for both sides is needed. It may not be enough time to
    find such solution for Tiger, but inclusion of varargs into the
    language as they currently specified may ruin better alternatives in
    the future. For example, concise array literals (or similar proposals)
    will look extremely ugly combined with varargs as per PRD.
    I understand that varargs are needed to support important marketing
    features in Tiger like printf. Yes, it is marketing (with questionable
    need in education sector), because real projects will not use printf.
    Real projects are using logging and MessageFormat. They are not very
    convenient without concise array literals, but at least everybody is
    already accustomed to them. People have already written a lot of
    helper classes themselves for MessageFormat&Logging that do not need
    any varargs and have higher performance than PRD varargs will. They
    simply declare methods with varying number of parameters. They have as
    may version of their methods as their really need in their project.
    This practice is not going to stop with introduction of varargs. Just
    look at EnumSet.of(...) series of methods! This kind of
    [unquestionably ugly] design even got into Tiger which already
    supposed to have varargs.
    Varargs break language clarity and consistency in too many places
    (overloaded method resolution is clearly getting out of hands). I
    doubt that varargs benefits justify their shortcomings.
    However, if customer demand for varargs-like facility is overwhelming,
    then, at least, consider alternatives that are not based on arrays.
    Array-based varargs (as in PRD) are especially devastating for future
    language evolution. A special interface or class shall be defined to
    pass varargs behind the scenes. For example, the following interface
    may be defined in "java.lang":
    public interface Indexed<T> extends Iterable<T> {
    public int size();
    public T get(int index);
    // Btw, java.util.List<T> can be retrofitted to implement Indexed<T>
    So, in "myMethod(T... arg)" the arg will actually have a type of
    "Indexed<T>" instead of "T[]".
    This solves a lot of issues! For example, it will become possible to
    define varargs based on generic types (which is not possible with
    array-based varargs).
    Moreover, when compiler creates code to call varargs method it may
    create an instance of a special class for chosen small number of
    arguments. It is obvious, that a special implementation of Indexed for
    one element will be always faster on modern HotSpot than a
    single-element array (although naive iteration with "foreach" facility
    will require extra Iterator object, but that can be fixed if needed by
    recognizing Indexed object as a special case in "foreach" statement).
    Performance will be on the side of array-based varargs when number of
    arguments is large, but something tells me that people who really need
    varargs and drive their inclusion into Java do not care about
    performance that much and will be perfectly Ok with extra object that
    implements Indexed interface and wraps underlying array for many
    argument cases.
    In conclusion I must stress that if the following is legal in the
    Java language (regardless of underlying implementation):
    void myMethod(MyClass... arg); // declaration
    myMethod(1, 2, 3); // call site
    Then the following must be also legal:
    MyClass... arg = 1, 2, 3;

  • Public Review of SKSML v1.0

    FYI.
    The OASIS EKMI Technical Committee would be grateful for any comments
    received from members of this forum about the key-management protocol.
    If you are interested in reviewing a working implementation of an early
    version of this protocol - written completely in Java - , you can get the
    implementation here:
    http://www.strongkey.org.
    Thank you.
    Arshad Noor
    StrongAuth, Inc.
    ----- Forwarded Message -----
    From: "Mary McRae" <[email protected]>
    To: [email protected], [email protected]
    Cc: "ekmi" <[email protected]>
    Sent: Thursday, July 24, 2008 7:04:49 PM (GMT-0800) America/Los_Angeles
    Subject: [ekmi] Public Review of SKSML v1.0
    To OASIS members, Public Announce Lists:
    The OASIS Enterprise Key Management Infrastructure (EKMI) TC has recently
    approved the following specification as a Committee Draft and approved the
    package for public review:
    Symmetric Key Services Markup Language (SKSML) Version 1.0
    The public review starts today, 24 July 2008, and ends 23 September 2008. This
    is an open invitation to comment. We strongly encourage feedback from potential
    users, developers and others, whether OASIS members or not, for the sake of
    improving the interoperability and quality of OASIS work. Please feel free to
    distribute this announcement within your organization and to other appropriate
    mail lists.
    More non-normative information about the specification and the technical
    committee may be found at the public home page of the TC at:
    http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=ekmi. Comments may be
    submitted to the TC by any person through the use of the OASIS TC Comment
    Facility which can be located via the button marked "Send A Comment" at the top
    of that page, or directly at:
    http://www.oasis-open.org/committees/comments/index.php?wg_abbrev=ekmi.
    Submitted comments (for this work as well as other works of that TC) are
    publicly archived and can be viewed at:
    http://lists.oasis-open.org/archives/ekmi-comment/. All comments submitted to
    OASIS are subject to the OASIS Feedback License, which ensures that the feedback
    you provide carries the same obligations at least as the obligations of the TC
    members.
    The specification document and related files are available here:
    Editable Source (Authoritative):
    http://docs.oasis-open.org/ekmi/sksml/v1.0/pr01/SKSML-1.0-Specification.odt
    PDF:
    http://docs.oasis-open.org/ekmi/sksml/v1.0/pr01/SKSML-1.0-Specification.pdf
    HTML:
    http://docs.oasis-open.org/ekmi/sksml/v1.0/pr01/SKSML-1.0-Specification.html
    Schema:
    http://docs.oasis-open.org/ekmi/sksml/v1.0/pr01/schema/
    Abstract:
    This normative specification defines the first (1.0) version of the Symmetric
    Key Services Markup Language (SKSML), an XML-based messaging protocol, by which
    applications executing on computing devices may request and receive symmetric
    key-management services from centralized key-management servers, securely, over
    networks. Applications using SKSML are expected to either implement the SKSML
    protocol, or use a software library - called the Symmetric Key Client Library
    (SKCL) - that implements this protocol. SKSML messages are transported within a
    SOAP layer, protected by a Web Services Security (WSS) header and can be used
    over standard HTTP securely.
    OASIS and the EKMI TC welcome your comments.
    Mary P McRae
    Manager of TC Administration, OASIS
    email: [email protected]
    web: www.oasis-open.org

    ejp wrote:
    And who is constructing another list of rules?
    You* are.No,I am not costructing any more rules but asking if I missed any rules,since I am unsure of all the rules.May be in some other page of JLS ,some more rules may be defined.
    My question is simple,I have these set of rules extracted from JLSExactly. Here is where you are 'constructing another list of rules'.No,again.
    extracted from JLS and I just wanted to review them.Why? You have the JLS. You also have the compiler.Very True,I am reviewing them.
    Perhaps,I was not clear enough. :)No, you were clear enough, you just didn't have any motivation for what you are doing.The motivation was just to make sure that I knew the rules for declaring a top class level class.And yes,I will read JLS to find out some more than these(if they exist).

  • Database DAO - JDBC Query Class - Code review please

    I use the following class (Database.java) as a DAO for handling all database calls. The class works. You can use this if you're looking for a DAO solution (i.e. a way to query databases using connection pools / JNDI). I am looking for some suggestions on improving this class. Can you help? I.e. suggestions for improving SELECT speed, logic? The class is used by a moderately heavily used Web application (ca. 2000 - 3000 queries a day - so not too much) on a Sun Web Server system.
    This class had the following interfaces:
    getErrors() // for retrieving any errors that occurred during an query
    setSql() // one way to set the SQL that must be run
    setDbName() // one way to set the JNDI name of the database resource
    getInsertDelete() // run the INSERT/DELETE statement that was provided with setSql
    getInsertDelete(String givenSql, String givenDb) // run with provided sql and db
    getClobInsert(String givenSql, String givenDb, Hashtable clobHash, String identifierSql) // clobHash contains the column name and the value (which is a string over 4000 chars). Identifier SQL is the SQL for identifying the row, into which the Clob must be inserted. This interface is specific to Oracle.
    getSelect() // Query database with set SQL. Return as a vector of hashes so I can close connection.
    getSelect(String givenSql, String givenDb) // select with given sqlAnd here is the full class. I know, this is a weird post, but we don't really have a code review process here at work, and I don't have a specific problem. Just want some feedback concerning the way I query our databases. So, any tips or comments are welcome.
    package melib.network;
    import java.io.Writer;
    import java.io.StringReader;
    import java.io.IOException;
    import java.util.Vector;
    import java.util.Hashtable;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.Clob;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    import melib.system.PropertiesReader; // This is just a simple class for pulling values from a .properties file
    * Manages database connections.
    * @author jetcat33
    * @version 2.0, 2006-07-09
    public class Database {
        protected String sql = "";
        protected String dbName = "";
        private StringBuffer errors = new StringBuffer();
        /** Creates a new instance of Database */
        public Database() {
         * Check completeness of data
         * for example to check if dbname given or
         * sql given or to make sure that yikes
         * used instead of sccweb in test conditions
        protected boolean checkData(){
            if(dbName.equals("") || sql.equals("")){
                Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database]","No database selected for query (db: "+dbName+" or sql not included (sql: "+sql+")");
                setErrors("No database selected for query (db: "+dbName+" or sql not included (sql: "+sql+")");
                return false;
            }else{
                return true;
         * Sets and gets errors resulting from
         * exceptions - otherwise would have to
         * somehow include errors in the results
         * that are returned but that would include
         * other more complicated stuff.
        private void setErrors(String e){
            errors.append("\n"+e);
        public StringBuffer getErrors(){
           return errors;
         * Setter for the sql variable.
         * @param givenSql The sql required to process
        public void setSql(java.lang.String givenSql) {
            sql = givenSql;
         * Sets the dbName needed to commect
         * to the correct database.
         * @param givenDbName Name of the database - name and connections specified within this class
        public void setDbName(java.lang.String givenDbName) {
            dbName = givenDbName;
         * Processes Insert and Delete requests with given SQL and DB Name.
         * @param givenSql
         * @param givenDbName
         * @return String Number of rows affected
        public String getInsertDelete(String givenSql, String givenDbName){
            sql = givenSql;
            dbName = givenDbName;
            return getInsertDelete();
         * Takes care of insert, update and delete requests.
         * Must have set both dbName as well as the sql String.
         * Will return number of rows affected as String.
         * @return String Number of rows affected
         * @exception Exception
        public String getInsertDelete() {
            int returnValue = 0;
            if(checkData()){
                Connection conn = null;
                InitialContext initContext = null;
                DataSource source = null;
                Statement stmt = null;
                try{
                    // Get connection from configured pool
                    initContext = new InitialContext();
                    source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName);
                    conn = source.getConnection();
                    if(conn != null){
                        stmt = conn.createStatement();
                        returnValue = stmt.executeUpdate(sql);
                }catch (Exception e){
                    Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database.getInsertDelete]","getInsertDelete Exception: "+e.toString()+"\nWith: "+sql);
                    setErrors(e.toString());
                }finally{
                    try{
                        stmt.close();
                    }catch(Exception e){
                        e.printStackTrace();
                    try{
                        conn.close();
                    }catch(Exception e){
                       e.printStackTrace();
                    try{
                        initContext.close();
                    }catch(Exception e){
                        e.printStackTrace();
            return returnValue+"";
         * Processes Insert requests for SQL containing CLOBS
         * @param givenSql
         * @param givenDbName
         * @param clobHash Contains column name of clob and clob text
         * @param identifierSql Contains SQL to identify the just entered SQL so the clobs can be filled in.
         * @return String Number of rows affected
        public String getClobInsert(String givenSql, String givenDbName, Hashtable clobHash, String identifierSql){
            sql = givenSql;
            dbName = givenDbName;
            String returnValue="";
            int rv = 0;
            if(checkData()){
                Connection conn = null;
                InitialContext initContext = null;
                DataSource source = null;
                Statement stmt = null;
                try{
                    // Get connection from configured pool
                    initContext = new InitialContext();
                    source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName);
                    conn = source.getConnection();
                    if(conn != null){
                        conn.setAutoCommit(false);
                        stmt = conn.createStatement();
                        rv = stmt.executeUpdate(sql); // write first time
                        // Now get and overwrite "EMPTY_CLOB()"
                        ResultSet lobDetails = stmt.executeQuery(identifierSql);
                        ResultSetMetaData rsmd = lobDetails.getMetaData();
                        if(lobDetails.next()){
                            for(int i = 1; i <= rsmd.getColumnCount(); i++){
                                if(clobHash.get(rsmd.getColumnName(i))!=null && !clobHash.get(rsmd.getColumnName(i)).equals("")){
                                    Clob theClob = lobDetails.getClob(i);
                                    Writer clobWriter = ((oracle.sql.CLOB)theClob).getCharacterOutputStream();
                                    StringReader clobReader = new StringReader((String) clobHash.get(rsmd.getColumnName(i)));
                                    char[] cbuffer = new char[30* 1024]; // Buffer to hold chunks of data to be written to Clob, the slob
                                    int nread = 0;
                                    try{
                                        while((nread=clobReader.read(cbuffer)) != -1){
                                            clobWriter.write(cbuffer,0,nread);
                                    }catch(IOException ioe){
                                       //System.out.println("E: clobWriter exception - " + ioe.toString());
                                    }finally{
                                        try{
                                            returnValue+=" Writing: "+rsmd.getColumnName(i);
                                            clobReader.close();
                                            clobWriter.close();
                                        }catch(IOException ioe2){
                                            //System.out.println("E: clobWriter close exception - " + ioe2.toString());
                        conn.commit();
                }catch (Exception e){
                    Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database.getClobInsert]","getClobInsert Exception: "+e.toString()+"\nWith: "+sql+"\nAND\n"+identifierSql);
                    setErrors(e.toString());
                }finally{
                    try{
                        stmt.close();
                    }catch(Exception e){
                        e.printStackTrace();
                    try{
                        conn.close();
                    }catch(Exception e){
                       e.printStackTrace();
                    try{
                        initContext.close();
                    }catch(Exception e){
                        e.printStackTrace();
                returnValue=rv+" "+returnValue;
            return returnValue;
         * Takes care of Select statements.
         * Must have set both dbName as well as the sql String.
         * Will return a vector.
         * @return Vector of Hashes containing the Results of the query
         * @exception SQLException
         * @exception Exception
        public Vector getSelect(){
            Vector returnValue = new Vector();
            if(checkData()){
                Connection conn = null;
                InitialContext initContext = null;
                DataSource source = null;
                ResultSet result = null;
                ResultSetMetaData rsmd = null;
                Statement stmt = null;
                try{
                    // Get connection from configured pool
                    initContext = new InitialContext();
                    source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName);
                    conn = source.getConnection();
                    if(conn != null){
                        stmt = conn.createStatement();
                        result = stmt.executeQuery(sql);
                        rsmd = result.getMetaData();
                        while(result.next()){
                            Hashtable hash = new Hashtable();
                            for(int i = 1; i <= rsmd.getColumnCount(); i++){
                                if(result.getString(i) != null){
                                    hash.put(rsmd.getColumnName(i),result.getString(i));
                                }else{
                                    hash.put(rsmd.getColumnName(i),"");
                            returnValue.addElement(hash);
                }catch (Exception e){
                    Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database.getSelect]","getSelect Exception: "+e.toString()+"\nWith: "+sql);
                    setErrors(e.toString());
                }finally{
                    try{
                        result.close();
                    }catch(Exception e){
                        e.printStackTrace();
                        setErrors(e.toString());
                    try{
                        stmt.close();
                    }catch(Exception e){
                        e.printStackTrace();
                        setErrors(e.toString());
                    try{
                        conn.close();
                    }catch(Exception e){
                       e.printStackTrace();
                       setErrors(e.toString());
                    try{
                        initContext.close();
                    }catch(Exception e){
                        e.printStackTrace();
                        setErrors(e.toString());
            return returnValue;
         * Takes care of Select statements with given SQL.
         * Must have set both dbName as well as the sql String.
         * Will return a vector.
         * @return Vector with Results of the query
         * @exception SQLException
         * @exception Exception
        public Vector getSelect(String givenSql, String givenDbName){
            sql = givenSql;
            dbName = givenDbName;
            return getSelect();
    }Thank you,
    dailysun

    too much code that's repeated. refactor all the code you have for closing resources into a utility class and simply call its methods.
    your dao creates the connection, so it can't participate in a transaction. if there are several daos that should be one unit of work, you can't manage it with this framework.
    transactions are under the control of a service layer. I think it's better to have the service object get the connection, pass it to all the DAOs needed for that unit of work, and then have the service close it.
    e-mailing errors? I don't like it. if you have 2-3K queries a day failing because the database you'll have 2-3K e-mails to delete. better to log messages. if you really want e-mail, you can have Log4J add an e-mail appender. at least that way it's configurable outside the code.
    CRUD operations without an UPDATE? You're missing something important.
    What if I don't want to get the database from a JNDI datasource? Now you can't use this DAO without an app server.
    Your error messages are less informative than a stack trace. Why not throw an exception with detailed info?
    have a look at Spring and how it handles persistence. if you insist on writing your own, might want to look at Spring. Rod Johnson has developed a much better, more general way to handle persistence.
    http://www.springframework.org
    You return a Vector of Hashtables for queries? Two old-school data structures. You understand the implication of choosing those, right? I'd recommend that you change that to a List of Maps. Let the concrete types be ArrayList and HashMap. Interfaces are preferred, because they let you change the implementation without affecting clients. Vector and Hashtable are synchronized by default; ArrayList and HashMap are not. Synchronization is thread safe but slower.
    I understand why you chose to return Vector, because you wanted something general that wouldn't force you to deal with object-relational mapping. This way you can just worry about ResultSetMetaData.
    A Vector of Hashtables is a row-based view of the ResultSet (one Hashtable per row). Sometimes a column based view can be more convenient. Then it's a Map of Lists.
    You gave it a good try, but I think there's a lot of room for improvement.
    %

  • PKGBUILD Public review request for wxFreeChart

    Hi Arch Linux community.I am a newbie on Arch Linux. Just installed it a few months ago & I like it's install once, lifetime updates without reinstalling philosophy! Please review my first PKGBUILD for wxFreeChart:
    http://wxcode.sourceforge.net/components/freechart/
    Here is the PKGBUILD
    # Maintainer: Sum <keansum AT gmail DOT com>
    pkgname=freechart
    pkgver=1.6
    pkgrel=1
    pkgdesc="Free powerful charting library based on wxWidgets."
    arch=('x86_64' 'i686')
    url="http://wxcode.sourceforge.net/components/freechart/"
    license=('custom:"wxWindows"')
    depends=('wxgtk')
    source=(http://downloads.sourceforge.net/project/wxcode/Components/wxFreeChart/$pkgname-$pkgver.tar.gz
    'configure.patch'
    'LICENSE')
    md5sums=('0e39d22a76c43df9e566ca1e1b669594'
    '38dd8576fcd0b2c2e726499b2042a42d'
    '9063869c9f1586dc0bd7c3f8d5060f76')
    prepare() {
    export CPLUS_INCLUDE_PATH=/usr/include/wx-3.0/:/usr/lib/wx/include/gtk2-unicode-3.0/
    export LIBS=-lwx_gtk2u_adv-3.0
    cd "$srcdir/$pkgname"
    patch --verbose configure $srcdir/configure.patch
    build() {
    cd "$srcdir/$pkgname"
    ./configure --prefix=/usr
    make
    package() {
    cd "$srcdir/$pkgname"
    make DESTDIR="$pkgdir/" install
    install -D -m644 $srcdir/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    Here is the LICENSE file.
    wxWidgets is currently licenced under the "wxWindows Library Licence" pending
    approval of the "wxWidgets Library Licence" which will be identical apart from
    the name.
    The wxWindows Library Licence is essentially the L-GPL (Library General Public
    Licence), with an exception stating that derived works in binary form may be
    distributed on the user's own terms. This is a solution that satisfies those
    who wish to produce GPL'ed software using wxWidgets, and also those producing
    proprietary software.
    Participants in the discussion that led to this decision include the folk from
    AbiSource, Robert Roebling, Julian Smart, Markus Fleck, Karsten Ballueder, and
    some advice from Richard Stallman. Richard has confirmed that the new licence
    is compatible with GPL'ed applications. However, there are no significant
    restrictions on proprietary applications.
    The wxWindows Library Licence has been approved by the Open Source Initiative.
    In August 2005, an ambiguity in Clause 2 was removed (replaced "the user's"
    with "your") and the version bumped to 3.1.
    ... then this last one is a patch file for the configure script. The code is for version 1.6 but to me it looks like the author forgotten to update the version from 1.4 to 1.6 in the configure script. I ahve checked in freechart/ReadMe.txt saying it is verion 1.6 and confirmed that the 1.6 addition of freechart/src/chartsplitpanel.cpp indeed exists.
    *** 1,6 ****
    #! /bin/sh
    # Guess values for system-dependent variables and create Makefiles.
    ! # Generated by GNU Autoconf 2.63 for WXFREECHART 1.4.
    # Report bugs to <[email protected]>.
    --- 1,6 ----
    #! /bin/sh
    # Guess values for system-dependent variables and create Makefiles.
    ! # Generated by GNU Autoconf 2.63 for WXFREECHART 1.6.
    # Report bugs to <[email protected]>.
    *** 596,603 ****
    # Identity of this package.
    PACKAGE_NAME='WXFREECHART'
    PACKAGE_TARNAME='wxfreechart'
    ! PACKAGE_VERSION='1.4'
    ! PACKAGE_STRING='WXFREECHART 1.4'
    PACKAGE_BUGREPORT='[email protected]'
    ac_subst_vars='LTLIBOBJS
    --- 596,603 ----
    # Identity of this package.
    PACKAGE_NAME='WXFREECHART'
    PACKAGE_TARNAME='wxfreechart'
    ! PACKAGE_VERSION='1.6'
    ! PACKAGE_STRING='WXFREECHART 1.6'
    PACKAGE_BUGREPORT='[email protected]'
    ac_subst_vars='LTLIBOBJS
    *** 1332,1338 ****
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat <<_ACEOF
    ! \`configure' configures WXFREECHART 1.4 to adapt to many kinds of systems.
    Usage: $0 [OPTION]... [VAR=VALUE]...
    --- 1332,1338 ----
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat <<_ACEOF
    ! \`configure' configures WXFREECHART 1.6 to adapt to many kinds of systems.
    Usage: $0 [OPTION]... [VAR=VALUE]...
    *** 1398,1404 ****
    if test -n "$ac_init_help"; then
    case $ac_init_help in
    ! short | recursive ) echo "Configuration of WXFREECHART 1.4:";;
    esac
    cat <<\_ACEOF
    --- 1398,1404 ----
    if test -n "$ac_init_help"; then
    case $ac_init_help in
    ! short | recursive ) echo "Configuration of WXFREECHART 1.6:";;
    esac
    cat <<\_ACEOF
    *** 1506,1512 ****
    test -n "$ac_init_help" && exit $ac_status
    if $ac_init_version; then
    cat <<\_ACEOF
    ! WXFREECHART configure 1.4
    generated by GNU Autoconf 2.63
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
    --- 1506,1512 ----
    test -n "$ac_init_help" && exit $ac_status
    if $ac_init_version; then
    cat <<\_ACEOF
    ! WXFREECHART configure 1.6
    generated by GNU Autoconf 2.63
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
    *** 1520,1526 ****
    This file contains any messages produced by compilers while
    running configure, to aid debugging if configure makes a mistake.
    ! It was created by WXFREECHART $as_me 1.4, which was
    generated by GNU Autoconf 2.63. Invocation command line was
    $ $0 $@
    --- 1520,1526 ----
    This file contains any messages produced by compilers while
    running configure, to aid debugging if configure makes a mistake.
    ! It was created by WXFREECHART $as_me 1.6, which was
    generated by GNU Autoconf 2.63. Invocation command line was
    $ $0 $@
    *** 10248,10254 ****
    # report actual input values of CONFIG_FILES etc. instead of their
    # values after options handling.
    ac_log="
    ! This file was extended by WXFREECHART $as_me 1.4, which was
    generated by GNU Autoconf 2.63. Invocation command line was
    CONFIG_FILES = $CONFIG_FILES
    --- 10248,10254 ----
    # report actual input values of CONFIG_FILES etc. instead of their
    # values after options handling.
    ac_log="
    ! This file was extended by WXFREECHART $as_me 1.6, which was
    generated by GNU Autoconf 2.63. Invocation command line was
    CONFIG_FILES = $CONFIG_FILES
    *** 10298,10304 ****
    _ACEOF
    cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
    ac_cs_version="\\
    ! WXFREECHART config.status 1.4
    configured by $0, generated by GNU Autoconf 2.63,
    with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
    --- 10298,10304 ----
    _ACEOF
    cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
    ac_cs_version="\\
    ! WXFREECHART config.status 1.6
    configured by $0, generated by GNU Autoconf 2.63,
    with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
    I have used namcap to check the PKGBUILD and the generated freechart-1.6-1-x86_64.pkg.tar.xz. Both passed. However when I use the -i switch, I get a whole bunch of messages. I am quite sure these dependencies do not need to be included in the PKGBUILD. Please correct if I am wrong.
    $ namcap -i freechart-1.6-1-x86_64.pkg.tar.xz
    freechart I: Link-level dependence (wxgtk) in file ['usr/lib/libwx_baseu-3.0.so.0', 'usr/lib/libwx_gtk2u_aui-3.0.so.0', 'usr/lib/libwx_gtk2u_core-3.0.so.0']
    freechart I: Link-level dependence (gcc-libs) in file ['usr/lib/libgcc_s.so.1', 'usr/lib/libstdc++.so.6']
    freechart I: Link-level dependence (glibc) in file ['usr/lib/libm.so.6', 'usr/lib/libc.so.6']
    freechart I: Symlink (usr/lib/libwxcode_gtk2u_freechart-3.0.so.0) found that points to libwxcode_gtk2u_freechart-3.0.so.0.0.0
    freechart I: Symlink (usr/lib/libwxcode_gtk2u_freechart-3.0.so) found that points to libwxcode_gtk2u_freechart-3.0.so.0
    freechart I: Dependency covered by dependencies from link dependence (freetype2)
    freechart I: Dependency covered by dependencies from link dependence (jasper)
    freechart I: Dependency covered by dependencies from link dependence (xextproto)
    freechart I: Dependency covered by dependencies from link dependence (gdbm)
    freechart I: Dependency covered by dependencies from link dependence (gstreamer0.10-base)
    freechart I: Dependency covered by dependencies from link dependence (graphite)
    freechart I: Dependency covered by dependencies from link dependence (libcap)
    freechart I: Dependency covered by dependencies from link dependence (libx11)
    freechart I: Dependency covered by dependencies from link dependence (coreutils)
    freechart I: Dependency covered by dependencies from link dependence (shared-mime-info)
    freechart I: Dependency covered by dependencies from link dependence (pcre)
    freechart I: Dependency covered by dependencies from link dependence (xf86vidmodeproto)
    freechart I: Dependency covered by dependencies from link dependence (shadow)
    freechart I: Dependency covered by dependencies from link dependence (readline)
    freechart I: Dependency covered by dependencies from link dependence (gtk2)
    freechart I: Dependency covered by dependencies from link dependence (libxdmcp)
    freechart I: Dependency covered by dependencies from link dependence (damageproto)
    freechart I: Dependency covered by dependencies from link dependence (dbus)
    freechart I: Dependency covered by dependencies from link dependence (avahi)
    freechart I: Dependency covered by dependencies from link dependence (cracklib)
    freechart I: Dependency covered by dependencies from link dependence (videoproto)
    freechart I: Dependency covered by dependencies from link dependence (libsasl)
    freechart I: Dependency covered by dependencies from link dependence (libxft)
    freechart I: Dependency covered by dependencies from link dependence (libxrandr)
    freechart I: Dependency covered by dependencies from link dependence (fontconfig)
    freechart I: Dependency covered by dependencies from link dependence (libxdamage)
    freechart I: Dependency covered by dependencies from link dependence (acl)
    freechart I: Dependency covered by dependencies from link dependence (pixman)
    freechart I: Dependency covered by dependencies from link dependence (ncurses)
    freechart I: Dependency covered by dependencies from link dependence (libdbus)
    freechart I: Dependency covered by dependencies from link dependence (cairo)
    freechart I: Dependency covered by dependencies from link dependence (zlib)
    freechart I: Dependency covered by dependencies from link dependence (xproto)
    freechart I: Dependency covered by dependencies from link dependence (harfbuzz)
    freechart I: Dependency covered by dependencies from link dependence (libomxil-bellagio)
    freechart I: Dependency covered by dependencies from link dependence (kbproto)
    freechart I: Dependency covered by dependencies from link dependence (sh)
    freechart I: Dependency covered by dependencies from link dependence (pango)
    freechart I: Dependency covered by dependencies from link dependence (pam)
    freechart I: Dependency covered by dependencies from link dependence (libxau)
    freechart I: Dependency covered by dependencies from link dependence (llvm-libs)
    freechart I: Dependency covered by dependencies from link dependence (libxfixes)
    freechart I: Dependency covered by dependencies from link dependence (attr)
    freechart I: Dependency covered by dependencies from link dependence (mesa-dri)
    freechart I: Dependency covered by dependencies from link dependence (libtxc_dxtn)
    freechart I: Dependency covered by dependencies from link dependence (xz)
    freechart I: Dependency covered by dependencies from link dependence (gdk-pixbuf2)
    freechart I: Dependency covered by dependencies from link dependence (elfutils)
    freechart I: Dependency covered by dependencies from link dependence (libxv)
    freechart I: Dependency covered by dependencies from link dependence (mesa)
    freechart I: Dependency covered by dependencies from link dependence (renderproto)
    freechart I: Dependency covered by dependencies from link dependence (systemd)
    freechart I: Dependency covered by dependencies from link dependence (libxcursor)
    freechart I: Dependency covered by dependencies from link dependence (hwids)
    freechart I: Dependency covered by dependencies from link dependence (bash)
    freechart I: Dependency covered by dependencies from link dependence (glibc)
    freechart I: Dependency covered by dependencies from link dependence (expat)
    freechart I: Dependency covered by dependencies from link dependence (e2fsprogs)
    freechart I: Dependency covered by dependencies from link dependence (linux-api-headers)
    freechart I: Dependency covered by dependencies from link dependence (libffi)
    freechart I: Dependency covered by dependencies from link dependence (libxi)
    freechart I: Dependency covered by dependencies from link dependence (libice)
    freechart I: Dependency covered by dependencies from link dependence (libldap)
    freechart I: Dependency covered by dependencies from link dependence (libxcomposite)
    freechart I: Dependency covered by dependencies from link dependence (libgpg-error)
    freechart I: Dependency covered by dependencies from link dependence (libxcb)
    freechart I: Dependency covered by dependencies from link dependence (libseccomp)
    freechart I: Dependency covered by dependencies from link dependence (keyutils)
    freechart I: Dependency covered by dependencies from link dependence (xcb-proto)
    freechart I: Dependency covered by dependencies from link dependence (randrproto)
    freechart I: Dependency covered by dependencies from link dependence (bzip2)
    freechart I: Dependency covered by dependencies from link dependence (libxml2)
    freechart I: Dependency covered by dependencies from link dependence (libpciaccess)
    freechart I: Dependency covered by dependencies from link dependence (util-linux)
    freechart I: Dependency covered by dependencies from link dependence (krb5)
    freechart I: Dependency covered by dependencies from link dependence (compositeproto)
    freechart I: Dependency covered by dependencies from link dependence (glib2)
    freechart I: Dependency covered by dependencies from link dependence (libxinerama)
    freechart I: Dependency covered by dependencies from link dependence (gstreamer0.10)
    freechart I: Dependency covered by dependencies from link dependence (kbd)
    freechart I: Dependency covered by dependencies from link dependence (kmod)
    freechart I: Dependency covered by dependencies from link dependence (filesystem)
    freechart I: Dependency covered by dependencies from link dependence (libxxf86vm)
    freechart I: Dependency covered by dependencies from link dependence (tzdata)
    freechart I: Dependency covered by dependencies from link dependence (libsm)
    freechart I: Dependency covered by dependencies from link dependence (pambase)
    freechart I: Dependency covered by dependencies from link dependence (libcups)
    freechart I: Dependency covered by dependencies from link dependence (atk)
    freechart I: Dependency covered by dependencies from link dependence (libgl)
    freechart I: Dependency covered by dependencies from link dependence (libsystemd)
    freechart I: Dependency covered by dependencies from link dependence (xineramaproto)
    freechart I: Dependency covered by dependencies from link dependence (lzo)
    freechart I: Dependency covered by dependencies from link dependence (orc)
    freechart I: Dependency covered by dependencies from link dependence (inputproto)
    freechart I: Dependency covered by dependencies from link dependence (libpng)
    freechart I: Dependency covered by dependencies from link dependence (db)
    freechart I: Dependency covered by dependencies from link dependence (libdatrie)
    freechart I: Dependency covered by dependencies from link dependence (fixesproto)
    freechart I: Dependency covered by dependencies from link dependence (hicolor-icon-theme)
    freechart I: Dependency covered by dependencies from link dependence (gtk-update-icon-cache)
    freechart I: Dependency covered by dependencies from link dependence (libjpeg)
    freechart I: Dependency covered by dependencies from link dependence (libtirpc)
    freechart I: Dependency covered by dependencies from link dependence (gcc-libs)
    freechart I: Dependency covered by dependencies from link dependence (openssl)
    freechart I: Dependency covered by dependencies from link dependence (gmp)
    freechart I: Dependency covered by dependencies from link dependence (libxext)
    freechart I: Dependency covered by dependencies from link dependence (iana-etc)
    freechart I: Dependency covered by dependencies from link dependence (libutil-linux)
    freechart I: Dependency covered by dependencies from link dependence (libthai)
    freechart I: Dependency covered by dependencies from link dependence (perl)
    freechart I: Dependency covered by dependencies from link dependence (libxrender)
    freechart I: Dependency covered by dependencies from link dependence (wayland)
    freechart I: Dependency covered by dependencies from link dependence (libtiff)
    freechart I: Dependency covered by dependencies from link dependence (libxshmfence)
    freechart I: Dependency covered by dependencies from link dependence (libgcrypt)
    freechart I: Dependency covered by dependencies from link dependence (libdaemon)
    freechart I: Dependency covered by dependencies from link dependence (libdrm)
    freechart I: Depends as namcap sees them: depends=(wxgtk)
    Many thanks!

    Hi it turns out that the SVN version is the most up to date which does not need to be patched as it has the right version numbers. I have created a new PKGBUILD.
    # Maintainer: kso <keansum AT gmail DOT com>
    pkgname=freechart-svn
    pkgver=r3169
    pkgrel=1
    pkgdesc="Free powerful charting library based on wxWidgets."
    arch=('x86_64' 'i686')
    url="http://wxcode.sourceforge.net/components/freechart/"
    license=('custom:"wxWindows"')
    depends=('wxgtk')
    makedepends=('subversion')
    source=('svn+http://svn.code.sf.net/p/wxcode/code/trunk/wxCode/components/freechart/')
    md5sums=('SKIP')
    _svntrunk=http://svn.code.sf.net/p/wxcode/code/trunk/wxCode/components/freechart/
    _svnmod=freechart
    pkgver() {
    cd "$_svnmod"
    local ver="$(svnversion)"
    printf "r%s" "${ver//[[:alpha:]]}"
    build() {
    cd "$srcdir"
    msg "Connecting to SVN server...."
    if [[ -d "$_svnmod/.svn" ]]; then
    (cd "$_svnmod" && svn up -r "$pkgver")
    else
    svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod"
    fi
    msg "SVN checkout done or server timeout"
    msg "Starting build..."
    rm -rf "$srcdir/$_svnmod-build"
    svn export "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
    cd "$srcdir/$_svnmod-build"
    # BUILD HERE
    ./configure --prefix=/usr
    make
    package() {
    cd "$srcdir/$_svnmod-build"
    make DESTDIR="$pkgdir/" install
    # install LICENSE
    install -D -m644 $srcdir/$_svnmod/license.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    I have uploaded onto the AUR. I have checked using namcap. Please let me know if there are any mistakes.  Many thanks!

  • How to find good games/apps in the store besides the public reviews?

    Hi all, I'm trying to find good games/apps in the store to put on my 32gig touch. I know about the reviews for the games/apps but with so many negative comments for some, for example F***G c**p, reboots the ipod touch every time I play it or run it for apps (insert Maker's name ere) want a refund don't download & giving it 1 star & the list just goes on, out of the one's I've thought I would either buy or download (for the free one's) I've not even botherd as I think to myself. With so many negative comment's the app/game must be rubbish. Doesn't apple review the comments put on the games/apps reviews?. So is there another way to find out what is good/bad in the app store besides trawling though 95% of negative comments? cheers
    Message was edited by: dj-toonz

    I tried to follow the instructions using iphone 5. When you get to step 5,  swipe your finger over the apps. It won't work. Does anyone have iphone 5 and try to hide unwanted apps sucessuflly. Please share with us. Thanks

  • Urgent ! CORBA and JDBC! The problem is continued...

    Hi Don!
    Thank for Your advice!
    did you use an oci jdbc driver in your code and then deploy it to the jvm in 8.1.6 ?
    you need to use the "server side" jdbc driver documented in the jdbc manuals ...
    Please review the "Oracle8i JDBC Developer's Guide and Reference Release 2 (8.1.6)
    A81354-01" at :
    http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/toc.htm
    Especially the section called "JDBC in the Server: the Server-Side Internal Driver"
    located in Chapter 14 at :
    http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/advanc4.htm#1001042
    But... I have used the "server side" jdbc driver from the beginning in according to specification.
    Moreover, I have applied all variants offered in Chapter 15.
    But I have got, however, the same mistake: "No suitable driver".
    Here are my attempts:
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public java.lang.String PetroDeleteRow() {
    // IMPLEMENT: Operation
    String res="GOOD";
    Connection conn=null;
    try {
    // 1th-variant
    OracleDriver ora = new OracleDriver();
    conn=ora.defaultConnection();
    //2th-variant
    conn=DriverManager.getConnection("jdbc:oracle:kprb:@application:1521:ims2","ims","www");
    //3th-variant
    conn=DriverManager.getConnection("jdbc:default:connection:");
    //4th-variant
    conn=(OracleConnection)DriverManager.getConnection("jdbc:oracle:kprb:","ims","www");
    catch (SQLException e) {res=e.toString();}
    return res;
    What did i wrong? ;-((
    Gali
    Thanks in advance!
    null

    Hi Don!
    are you running the code inside jdeveloper or inside the 816 jvm ?Yes, of course. I have deployed my CORBA object on the 816 server and then I
    invoked PetroDeleteRow method from my client code.
    try
    System.out.println("Calling pressurecorba.PrognosisInterface methods...\n");
    System.out.println(corbaInterface.PetroDeleteRow());
    System.out.println("...done!");
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    Furthermore, when I use SQLJ in CORBA object all is correct.
    if in jdeveloper what version of it ?I use JDeveloper 3.1.1.2
    Gali
    Thanks in advance!
    null

  • Urgent... unable to load JDBC driver

    i have developed a servlet which will establish connection to mySQL.. but it couldn't load the JDBC driver even i placed
    [ mysql-connector-java-2.0.14-bin.zip ] in [ C:\j2sdk1.4.2_05\jre\lib\ext\ ]
    in fact.. it work fine b4 i format my notebook.. anyone can help me??
    pls note that i using APACHE TOMCAT and mySQL 3.23
    pls help.. very urgent one
    the following is my servlet code.....
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class LoginServlet extends HttpServlet {
    static final String dbURL = "jdbc:mysql://localhost" ;
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
    Connection conn = null;
    String nextJSP = null;
    try {
    Class.forName("org.gjt.mm.mysql.Driver");
    catch (ClassNotFoundException e) {
    throw new ServletException("Unable to load JDBC driver");
    }

    i already add new variable in environment variables
    variable name = CLASSPATH
    variable value = C:\j2sdk1.4.2_05\jre\lib\ext\mysql-connector-java-2.0.14-bin.jar;
    but the same output is come up.. still unable to load my JDBC driver in TOMCAT... y?

  • Need help w corba/jdbc class

    hi
    i'm trying to get this class to work right, i don't think i'm coding it the right way, especially the getAllAccounts() and selectAccounts() methods. this code compiles cleanly, but i get runtime exceptions when i try to run my app. my runtime exceptions look like
    ############################ StackTrace ############################
    java.lang.NullPointerException
    at com.kafein.accountServices.AccountServiceImpl.getAllAccounts(AccountS
    erviceImpl.java:218)
    at com.kafein.idl.accountServices.AccountServicePOA._invoke(AccountServi
    cePOA.java:74)
    at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java
    :247)
    at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:477)
    at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:604)
    and
    Creating 100 Accounts
    org.omg.CORBA.UNKNOWN: This exception was reported by the server, it is only re-
    thrown here. vmcid: 0x0 minor code: 0 completed: No
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.jacorb.orb.SystemExceptionHelper.read(SystemExceptionHelper.java:
    157)
    at org.jacorb.orb.connection.ReplyInputStream.checkExceptions(ReplyInput
    Stream.java:117)
    at org.jacorb.orb.Delegate.invoke(Delegate.java:942)
    at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
    at com.kafein.idl.accountServices._AccountServiceStub.getAllAccounts(_Ac
    countServiceStub.java:134)
    at com.kafein.client.AccountClient.main(AccountClient.java:111)
    org.omg.CORBA.UNKNOWN: This exception was reported by the server, it is only re-
    thrown here. vmcid: 0x0 minor code: 0 completed: No
    ORB shutting down...
    code for this class is below...
    // AccountServiceImpl.java: The AccountService Implementation
    package com.kafein.accountServices;
    import java.util.Hashtable;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import junit.framework.TestCase;
    import junit.framework.Test;
    import junit.framework.TestSuite;
    import org.omg.PortableServer.*;
    import com.kafein.idl.accountServices.AccountServicePOA;
    import com.kafein.idl.accountServices.AccountEntryStruct;
    import com.kafein.idl.accountServices.AccountStruct;
    import com.kafein.idl.utilities.DateTimeStruct;
    import com.kafein.idl.exceptions.NotFoundException;
    import com.kafein.idl.exceptions.DataValidationException;
    import com.kafein.idl.errorCodes.DataValidationErrorCodes;
    import com.kafein.utils.ServiceHandler;
    import com.kafein.utils.Log;
    import java.net.URL;
    import java.sql.*;
    import java.util.*;
    * AccountServiceImpl is an implementation of the
    * idl.accountServices.AccountService interface.
    public class AccountServiceImpl extends AccountServicePOA {
      POA poa;
      private Hashtable accounts = new Hashtable(); // collection of Accounts
      private static int nextAccountID = 1; // global account ID
      Connection connection;
      Vector connections;
      Statement statement;
      PreparedStatement preparedStatement;
       * Construct an instance.
      public AccountServiceImpl(POA aPOA, String driver, String url, String user, String password) {
        super();
        poa = aPOA;
        driver = driver;
        url = url;
        user = user;
        password = password;
        connections = new Vector();
        // Connect to Database
        try {
            connect(driver,url,user,password);
        catch(Exception e) {
               e.printStackTrace();       
        // Simple Database Select
        try {
            testSimpleSelect();
        catch(Exception e) {
               e.printStackTrace();       
        // Database Select
        try {
            testSelect();
        catch(Exception e) {
               e.printStackTrace();       
       * Overloaded constructor for unit tests.
      protected AccountServiceImpl() {
        poa = null;
       * createAccount is used by administrator to add a new Account
       * in the system.
       * @param newAccount AccountEntryStruct containing data for new account
       * @return int the new unique Account ID
       * @exception com.kafein.idl.exceptions.DataValidationException
      public int createAccount(AccountEntryStruct newAccount) throws
        DataValidationException {
        validateData (newAccount); // throws DataValidationException;
        int accountID = getNextID();     
        // Create new Account.
        Account anAccount = new Account(accountID,
                            newAccount.userName,
                            newAccount.userEmail,
                            newAccount.creditCardType,
                            newAccount.creditCardNumber,
                            newAccount.creditCardExpirationDate.year,
                            newAccount.creditCardExpirationDate.month,
                            newAccount.userPassword,
                            newAccount.initialBalance);
    // Insert here / call method insertAccount() pass it in an account object
    // or call manager object - accountmanager.put()
        // Insert Account into Database
        try {
            insertAccount(anAccount);
        catch(Exception e) {
               e.printStackTrace();       
        accounts.put(accountID,anAccount);
        return accountID;
       * isAccountValid is used to validate a user logon.
       * @param accountID AccountID
       * @param userPassword String
       * @return boolean true to indicate an existing Account
      public boolean isValidAccount (int accountID, String userPassword) {
        // Get account with key equal to accountID.
        AccountStruct anAccount;
        try {
          anAccount = (AccountStruct) getAccount (accountID);
        catch (NotFoundException e) {
          return false;
        // Verify password.
        return (anAccount.userPassword.equals(userPassword) ? true : false);
       * getAccount is used to retrieve an existing Account in the system
       * @param int AccountID
       * @return AccountStruct containing data for the existing Account
       * @exception com.kafein.idl.exceptions.NotFoundException
      public AccountStruct getAccount(int accountID)throws
        NotFoundException {
        // Verify that accountID is within an appropriate interval.
        if (accountID < 1 || accountID > accounts.size()) {
          throw new NotFoundException(DataValidationErrorCodes.INVALID_ACCOUNT_ID,
                          "Account ID not found");
        // Get Account and convert to AccountStruct (which is returned).
        Account anAccount = (Account) accounts.get(accountID);
        return anAccount.getAccountStruct();
       * getAllAccounts is used to retrieve all existing Accounts in the system
       * @return AccountStruct[] containing all existing Accounts.
       * @fyi returns an empty sequence if no Accounts exist
      // GetAllAcounts method v. 2 - rather than enumerating through the vector
      // call a method that returns a collection of objs in that method where
      // you do select stmts
      public AccountStruct[] getAllAccounts() {
        // Allocate the array of AccountStructs.
        Vector results = new Vector();
        try {
                results = selectAccounts();
        catch(Exception e) {
               e.printStackTrace();       
        //Vector results = selectAccounts();
        int lastKey = results.size();
        //int lastKey = accounts.size();
        AccountStruct[] accountSequence = new AccountStruct[lastKey];
        if (lastKey==0) {
          return accountSequence;
        // Create AccountStructs from Accounts.
        for (int i = 1; i <= lastKey; i++) {
          Account anAccount = (Account) accounts.get(i);
          accountSequence[i-1] = anAccount.getAccountStruct();
        return accountSequence;
       * validateData is used to check new account data.
       * @param newAccount AccountEntryStruct containing data for new account
       * @exception com.kafein.idl.exceptions.DataValidationException
      protected void validateData(AccountEntryStruct newAccount) throws
        DataValidationException {
        // Check all of the member data in newAccount.
        if (newAccount.userName.equals("")) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_USER_NAME,
              "User Name must not be empty");
        if (newAccount.userEmail.equals("")) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_USER_EMAIL,
              "User Email must not be empty");
        if (newAccount.creditCardType.equals("")) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_CREDIT_CARD_TYPE,
              "Credit card type must not be empty");
        if (newAccount.creditCardNumber.equals("")) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_CREDIT_CARD_NUMBER,
              "Credit card number must not be empty");
        // Compare creditCardExpirationDate to current date
        // (we only consider year and month).
        GregorianCalendar now = new GregorianCalendar();
        DateTimeStruct proposed = newAccount.creditCardExpirationDate;
        if (proposed.year < now.get (Calendar.YEAR) ||
         (proposed.year == now.get (Calendar.YEAR) &&
          proposed.month < now.get (Calendar.MONTH) + 1)) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_CREDIT_CARD_EXPIRATION_DATE,
              "Credit card has expired");
        if (newAccount.userPassword.equals("")) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_USER_PASSWORD,
              "Password must not be empty");
        else if (!newAccount.userPassword.equals(newAccount.userPasswordVerification)) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_USER_PASSWORD,
              "Password verification failure");
        if (newAccount.initialBalance < 0.0F) {
          throw new DataValidationException(
              DataValidationErrorCodes.INVALID_BALANCE,
              "Account Balance cannot have a negative balance");
       * getNextID is used to generate a unique ID.
       * Needs a much better implementation that generates a globally unique ID!
       * @return int an Account ID
      protected synchronized int getNextID() {
        nextAccountID++;
        return nextAccountID - 1;
       * override _default_POA to return this servant's POA, not Root POA
      public POA _default_POA() {
        return poa;
       * jdbc related methods
      public void connect(String driver, String url, String user, String password)
                    throws Exception {
            try {
                // Load JDBC driver
                Class.forName(driver);
                System.out.println("Connecting to " + url);
                connection = DriverManager.getConnection(url, user, password);
                connections.add(connection);
                connection.setAutoCommit(false);
            } catch(Exception e) {
                System.err.println("System Exception in connect");
                System.err.println(e);
                throw e;
      public void closeConnection() throws Exception {
            try {
                Enumeration myEnum = connections.elements();
                while ( myEnum.hasMoreElements() ) {
                    System.out.println("Closing connection");
                    ((Connection) myEnum.nextElement()).close();
            } catch (Exception e) {
                System.err.println("System Exception in closeConnection");
                System.err.println(e);
                throw e;
      private void testSimpleSelect() throws Exception {
            try {
                Statement statement = connection.createStatement();
                ResultSet rs = statement.executeQuery("Select 1 from ACCOUNT");
                if (rs != null && rs.next()) {
                   int value = rs.getInt(1);
                   System.out.println("Fetched value " + value);
                connection.commit();
                statement.close();
            } catch(Exception e) {
                System.err.println("System Exception in testSimpleSelect");
                System.err.println(e);
                throw e;
      private void testSelect() throws Exception {
            try {
                Statement statement = connection.createStatement();
                ResultSet rs = statement.executeQuery(
                    "Select ACCT_ID, ACCT_USERNAME, ACCT_USEREMAIL, ACCT_CC_TYPE, ACCT_CC_NUMBER, ACCT_CC_EXPYR, ACCT_CC_EXPMO, ACCT_USERPASSWORD, ACCT_USERBALANCE from ACCOUNT LIMIT 1");
                System.out.println("Account ID   User Name     User Email     CC Type     CC Number     CC Expyr CC Expmo User Password     User Balance");
                while (rs != null && rs.next()) {
                    int acct_id = rs.getInt(1);
                    String acct_username = rs.getString(2);
                    String acct_useremail = rs.getString(3);
                    String acct_cc_type = rs.getString(4);
                    String acct_cc_number = rs.getString(5);
                    int acct_cc_expyr = rs.getInt(6);
                    int acct_cc_expmo = rs.getInt(7);
                    String acct_userpassword = rs.getString(8);
                    float acct_userbalance = rs.getFloat(9);
                    System.out.println(acct_id + "         " +
                                       acct_username + "   " +
                                       acct_useremail + "   " +
                                       acct_cc_type + "   " +
                                       acct_cc_number + "   " +
                                       acct_cc_expyr + "   " +
                                       acct_cc_expmo + "   " +
                                       acct_userpassword + "   " +
                                       acct_userbalance);
                connection.commit();
                statement.close();
            } catch(Exception e) {
                System.err.println("System Exception in testSelect");
                System.err.println(e);
                throw e;
      private void testLoadData() throws Exception {
            int numberOfAccounts = 5;
            String  acct_username    = "<--20 BYTE STRING-->";
            String  acct_useremail = "<--20 BYTE STRING-->";
         String  acct_cc_type = "TEST ";
            String  acct_cc_number = "<--20 BYTE STRING-->";
            int  acct_cc_expyr = 2000;
            int  acct_cc_expmo = 1;
            String  acct_userpassword = "<--20 BYTE STRING-->";
            float     acct_userbalance = 0.0F;
            int     acct_id = 0;
         try {
                System.out.println("Inserting data...");
                connection.setAutoCommit(false);
                // Calculate Start time
                System.out.println("Starting data insertion (" + numberOfAccounts +
                    " rows) into ACCOUNT table..");
                long startTime = System.currentTimeMillis();
                preparedStatement = connection.prepareStatement(
                    "INSERT INTO ACCOUNT (ACCT_ID, ACCT_USERNAME, ACCT_USEREMAIL, ACCT_CC_TYPE, ACCT_CC_NUMBER, " +
                    "ACCT_CC_EXPYR, ACCT_CC_EXPMO, ACCT_USERPASSWORD, ACCT_USERBALANCE) VALUES ( ?, ?, ?, ?, ?, ? , ?, ?, ?)");
                // Insert accounts in ACCOUNT table
                for (int i = 1; i <= numberOfAccounts; i++) {
                    acct_id  = i * 1000;
                    preparedStatement.setInt(1, acct_id);
                    preparedStatement.setString(2, acct_username);
                    preparedStatement.setString(3, acct_useremail);
                    preparedStatement.setString(4, acct_cc_type);
                    preparedStatement.setString(5, acct_cc_number);
                    preparedStatement.setInt(6, acct_cc_expyr);
                    preparedStatement.setInt(7, acct_cc_expmo);
                    preparedStatement.setString(8, acct_userpassword);
                    preparedStatement.setFloat(9, acct_userbalance);
              preparedStatement.executeUpdate();
                    connection.commit();
                System.out.println(numberOfAccounts + " accounts created.");
                preparedStatement.close();
                long stopTime = System.currentTimeMillis();
                System.out.println("Account table load complete.");
                System.out.println("Load time = " +
                                   ((stopTime - startTime)/(1000f)) + " seconds");
                System.out.println("Data insertion complete");
            } catch(Exception e) {
                System.err.println("System Exception in loadData");
                System.err.println(e);
                throw e;
       * insertAccount is used to insert a new Account in the Database
       * @param int AccountID
       * @return AccountStruct containing data for the existing Account
      private void insertAccount(Account anAccount) throws Exception {
              AccountStruct anAccountStruct = anAccount.getAccountStruct();  
         int numberOfAccounts = 1;
         String  acct_username    = anAccountStruct.userName;
            String  acct_useremail = anAccountStruct.userEmail;
         String  acct_cc_type = anAccountStruct.creditCardType;
            String  acct_cc_number = anAccountStruct.creditCardNumber;
         int acct_cc_expyr = anAccountStruct.creditCardExpirationDate.year;
            int acct_cc_expmo = anAccountStruct.creditCardExpirationDate.month;
            String  acct_userpassword = anAccountStruct.userPassword;
            float     acct_userbalance = anAccountStruct.accountBalance;
            int     acct_id = anAccountStruct.accountID;
         try {
                System.out.println("Inserting data...");
                connection.setAutoCommit(false);
    //instead of system.out just log
                // Calculate Start time
                System.out.println("Starting data insertion ( 1" +
                    " row) into ACCOUNT table..");
                long startTime = System.currentTimeMillis();
                preparedStatement = connection.prepareStatement(
                    "INSERT INTO ACCOUNT (ACCT_ID, ACCT_USERNAME, ACCT_USEREMAIL, ACCT_CC_TYPE, ACCT_CC_NUMBER, " +
                    "ACCT_CC_EXPYR, ACCT_CC_EXPMO, ACCT_USERPASSWORD, ACCT_USERBALANCE) VALUES ( ?, ?, ?, ?, ?, ? , ?, ?, ?)");
                    acct_id  = 1000;
                    preparedStatement.setInt(1, acct_id);
                    preparedStatement.setString(2, acct_username);
                    preparedStatement.setString(3, acct_useremail);
                    preparedStatement.setString(4, acct_cc_type);
                    preparedStatement.setString(5, acct_cc_number);
                    preparedStatement.setInt(6, acct_cc_expyr);
                    preparedStatement.setInt(7, acct_cc_expmo);
                    preparedStatement.setString(8, acct_userpassword);
                    preparedStatement.setFloat(9, acct_userbalance);
              preparedStatement.executeUpdate();
                    connection.commit();
                System.out.println("1 account created.");
                preparedStatement.close();
                long stopTime = System.currentTimeMillis();
                System.out.println("Account table load complete.");
                System.out.println("Load time = " +
                                   ((stopTime - startTime)/(1000f)) + " seconds");
                System.out.println("Data insertion complete");
            } catch(Exception e) {
                System.err.println("System Exception in loadData");
                System.err.println(e);
                throw e;
      private Vector selectAccounts() throws Exception {
            try {
                // Create Vector to hold individual Account values
             Vector mainvector = new Vector();
             Vector values = new Vector();
             Statement statement = connection.createStatement();
                ResultSet rs = statement.executeQuery(
                    "Select ACCT_ID, ACCT_USERNAME, ACCT_USEREMAIL, ACCT_CC_TYPE, ACCT_CC_NUMBER, ACCT_CC_EXPYR, ACCT_CC_EXPMO, ACCT_USERPASSWORD, ACCT_USERBALANCE from ACCOUNT");
                System.out.println("Account ID   User Name     User Email     CC Type     CC Number     CC Expyr CC Expmo User Password     User Balance");
             // Iterate through result set
             while (rs != null && rs.next()) {
              // Make sure values is empty
              values.clear();
              int acct_id = rs.getInt(1);
                    String acct_username = rs.getString(2);
                    String acct_useremail = rs.getString(3);
                    String acct_cc_type = rs.getString(4);
                    String acct_cc_number = rs.getString(5);
                    int acct_cc_expyr = rs.getInt(6);
                    int acct_cc_expmo = rs.getInt(7);
                    String acct_userpassword = rs.getString(8);
                    float acct_userbalance = rs.getFloat(9);
              // Populate Vector values
              values.addElement(rs.getObject(1));
              values.addElement(rs.getObject(2));
              values.addElement(rs.getObject(3));
              values.addElement(rs.getObject(4));
              values.addElement(rs.getObject(5));
              values.addElement(rs.getObject(6));
              values.addElement(rs.getObject(7));
              values.addElement(rs.getObject(8));
              values.addElement(rs.getObject(9));
              mainvector.addElement(values);
                    System.out.println(acct_id + "         " +
                                       acct_username + "   " +
                                       acct_useremail + "   " +
                                       acct_cc_type + "   " +
                                       acct_cc_number + "   " +
                                       acct_cc_expyr + "   " +
                                       acct_cc_expmo + "   " +
                                       acct_userpassword + "   " +
                                       acct_userbalance);
                connection.commit();
                statement.close();
             return mainvector;
            } catch(Exception e) {
                System.err.println("System Exception in selectAccounts");
                System.err.println(e);
                throw e;
        }

    line 217 and 218 is
    Account anAccount = (Account) accounts.get(i);
    accountSequence[i-1] = anAccount.getAccountStruct();
    i realized that
    Account anAccount = (Account) accounts.get(i);
    was a typo. what it should have been was
    Account anAccount = (Account) results.get(i);
    so my getAllAccounts() method now looks like
       * getAllAccounts is used to retrieve all existing Accounts in the system
       * @return AccountStruct[] containing all existing Accounts.
       * @fyi returns an empty sequence if no Accounts exist
      // GetAllAcounts method v. 2 - rather than enumerating through the vector
      // call a method that returns a collection of objs in that method where
      // you do select stmts
      public AccountStruct[] getAllAccounts() {
        // Allocate the array of AccountStructs.
        Vector results = new Vector();
        try {
                results = selectAccounts();
        catch(Exception e) {
               e.printStackTrace();       
        //Vector results = selectAccounts();
        int lastKey = results.size();
        //int lastKey = accounts.size();
        AccountStruct[] accountSequence = new AccountStruct[lastKey];
        if (lastKey==0) {
          return accountSequence;
        // Create AccountStructs from Accounts.
        for (int i = 1; i <= lastKey; i++) {
          Account anAccount = (Account) results.get(i);
          accountSequence[i-1] = anAccount.however, i still get the same runtime errors.
    is my selectAccounts() method returning a null?

  • Getting Connected for the First Time with JDBC

    Hello everyone. I am trying to make my first database connection to a mysql database with Java. I am using jdk 1.5.0, MySQL 4.1.11 nt, and I think I have the freshly downloaded driver C:\jdk1.5.0\jre\lib\ext\mysql-connector-java-3.0.16-ga-bin.jar" installed in the right spot. When I try to run the following code...
    package dbfinder;
    import java.sql.*;
    import javax.sql.*;
    import com.sun.rowset.JdbcRowSetImpl;
    import javax.sql.rowset.JdbcRowSet;
    import java.sql.ResultSetMetaData;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class DatabaseConnector {
    public DatabaseConnector() {
    public static void main(String args[]){
    Connection connection;
    Statement statement;
    // ResultSet resultSet;
    // ResultSetMetaData metaData;
    String DATABASE_DRIVER = "com.mysql.jdbc.Driver";
    String DATABASE_URL = "jdbc:mysql://localhost/state_crime";
    String USER = "cis695d";
    String PASSWORD = "cis695d";
    JdbcRowSet rowSet = new JdbcRowSetImpl();
    try {
    Class.forName(DATABASE_DRIVER); // load database driver
    System.out.println("class loaded");
    rowSet.setUrl("DATABASE_URL");
    rowSet.setUsername(USER);
    rowSet.setPassword(PASSWORD);
    rowSet.setCommand("Select * FROM state_crime_rates");
    rowSet.execute();
    ResultSetMetaData metaData = rowSet.getMetaData();
    int numberOfColumns;
    numberOfColumns = metaData.getColumnCount();
    System.out.println(numberOfColumns);
    } catch(SQLException sqlException){
    sqlException.printStackTrace();
    System.exit(1);
    catch(ClassNotFoundException classNotFound){
    classNotFound.printStackTrace();
    System.exit(1);
    I get the following exception...
    java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getConnection(DriverManager.java:545)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at com.sun.rowset.JdbcRowSetImpl.connect(JdbcRowSetImpl.java:618)
         at com.sun.rowset.JdbcRowSetImpl.prepare(JdbcRowSetImpl.java:630)
         at com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:526)
         at dbfinder.DatabaseConnector.main(DatabaseConnector.java:44)
    Does anyone have any ideas? Is it my code? Is there a different driver I should use? Any help would be greatly appreciated.

    Hello everyone. I am trying to make my first
    database connection to a mysql database with Java. I
    am using jdk 1.5.0, MySQL 4.1.11 nt, and I think I
    have the freshly downloaded driver
    C:\jdk1.5.0\jre\lib\ext\mysql-connector-java-3.0.16-ga
    -bin.jar" installed in the right spot. You shouldn't be putting that JAR in jre/lib/ext, even if you've found some docs to tell you to do it. Only language extensions (e.g., packages that begin w/javax) belong there.
    I get the following exception...
    java.sql.SQLException: No suitable driver
    Does anyone have any ideas? Is it my code? Is there
    a different driver I should use? Any help would be
    greatly appreciated.The driver is correct. The class loader found it, even though I think you should use the -classpath option to find the JAR.
    It's your code.
    What are you doing with all that RowSet stuff?
    This works. Study it:
    import java.sql.*;
    import java.util.*;
    * Command line app that allows a user to connect with a database and
    * execute any valid SQL against it
    public class DataConnection
        public static final String DEFAULT_DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DEFAULT_URL      = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        public static final String DEFAULT_DRIVER   = "com.mysql.jdbc.Driver";
        public static final String DEFAULT_URL      = "jdbc:mysql://localhost:3306/hibernate";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        /** Database connection */
        private Connection connection;
         * Driver for the DataConnection
         * @param command line arguments
         * <ol start='0'>
         * <li>SQL query string</li>
         * <li>JDBC driver class</li>
         * <li>database URL</li>
         * <li>username</li>
         * <li>password</li>
         * </ol>
        public static void main(String [] args)
            DataConnection db = null;
            try
                if (args.length > 0)
                    String sql      = args[0];
                    String driver   = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
                    String url      = ((args.length > 2) ? args[2] : DEFAULT_URL);
                    String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
                    String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
                    System.out.println("sql     : " + sql);
                    System.out.println("driver  : " + driver);
                    System.out.println("url     : " + url);
                    System.out.println("username: " + username);
                    System.out.println("password: " + password);
                    db = new DataConnection(driver, url, username, password);
                    System.out.println("Connection established");
                    Object result = db.executeSQL(sql);
                    System.out.println(result);
                else
                    System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
            catch (SQLException e)
                System.err.println("SQL error: " + e.getErrorCode());
                System.err.println("SQL state: " + e.getSQLState());
                e.printStackTrace(System.err);
            catch (Exception e)
                e.printStackTrace(System.err);
            finally
                if (db != null)
                    db.close();
                db = null;
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection() throws SQLException,ClassNotFoundException
            this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection(final String driver,
                              final String url,
                              final String username,
                              final String password)
            throws SQLException,ClassNotFoundException
            Class.forName(driver);
            this.connection = DriverManager.getConnection(url, username, password);
         * Get Driver properties
         * @param database URL
         * @return list of driver properties
         * @throws SQLException if the query fails
        public List getDriverProperties(final String url)
            throws SQLException
            List driverProperties   = new ArrayList();
            Driver driver           = DriverManager.getDriver(url);
            if (driver != null)
                DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
                if (info != null)
                    driverProperties    = Arrays.asList(info);
            return driverProperties;
         * Clean up the connection
        public void close()
            close(this.connection);
         * Execute ANY SQL statement
         * @param SQL statement to execute
         * @returns list of row values if a ResultSet is returned,
         * OR an altered row count object if not
         * @throws SQLException if the query fails
        public Object executeSQL(final String sql) throws SQLException
            Object returnValue;
            Statement statement = null;
            ResultSet rs = null;
            try
                statement = this.connection.createStatement();
                boolean hasResultSet    = statement.execute(sql);
                if (hasResultSet)
                    rs                      = statement.getResultSet();
                    ResultSetMetaData meta  = rs.getMetaData();
                    int numColumns          = meta.getColumnCount();
                    List rows               = new ArrayList();
                    while (rs.next())
                        Map thisRow = new LinkedHashMap();
                        for (int i = 1; i <= numColumns; ++i)
                            String columnName   = meta.getColumnName(i);
                            Object value        = rs.getObject(columnName);
                            thisRow.put(columnName, value);
                        rows.add(thisRow);
                    returnValue = rows;
            else
                int updateCount = statement.getUpdateCount();
                returnValue     = new Integer(updateCount);
            finally
                close(rs);
                close(statement);
            return returnValue;
         * Close a database connection
         * @param connection to close
        public static final void close(Connection connection)
            try
                if (connection != null)
                    connection.close();
                    connection = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a statement
         * @param statement to close
        public static final void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
                    statement = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a result set
         * @param rs to close
        public static final void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
                    rs = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a database connection and statement
         * @param connection to close
         * @param statement to close
        public static final void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a database connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static final void close(Connection connection,
                                       Statement statement,
                                       ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
    }%

  • Use jdbc to connect servlet to oracle 8.1.6 database on win2k

    The code is below:
    package moreservlets;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Simple servlet used to test JDBC connection. */
    public class TitleQueries extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Connecting to Database";
    DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@pc840:1521:orcl", "scott", "tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery
    ("select ename from emp");
    while (rset.next()) {
    String name = rset.getString("ename");
    out.println(ServletUtilities.headWithTitle(title) +
    "<body bgcolor=\"#FDF5E6\">\n" +
    "<h1 align=\"center\">" + name + "</h1>\n" +
    "</body></html>");
    CLASSPATH=.;C:\J2ee;C:\j2sdkee1.3.1\lib\cloudscape;C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar;C:\Oracle\Ora81\orb\classes\yoj.jar;C:\Oracle\Ora81\orb\classes\share.zip
    My code cannot find the JDBC driver. Any suggestions?
    Thanks.
    I get the following errors:
    C:\J2ee\moreservlets>javac -d "C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\
    EB-INF\classes" TitleQueries.java
    TitleQueries.java:19: package oracle.jdbc.driver does not exist
    oracle.jdbc.driver.OracleDriver());
    ^
    TitleQueries.java:31: cannot resolve symbol
    symbol : variable name
    location: class moreservlets.TitleQueries
    "<h1 align=\"center\">" + name + "</h1>\n" +
    ^
    2 errors

    I changed my classpath variable and my servlet
    compiles okay with the:
    "import oracle.jdbc.driver.*" statement.
    However, I still get the following error.
    Why can't it find the jdbc driver, since it finds the
    import statement?
    Apache Tomcat/4.0.3
    Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.Oracl
    eDriver
    WebappClassLoader: Resource '/WEB-INF/classes/moreservlets/ServletUtilities.cl
    ass' was modified; Date is now: Tue Jul 02 09:57:26 CDT 2002 Was: Tue Jul 02 09:
    37:20 CDT 2002
    Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.Oracl
    eDriver
    CLASSPATH=.;C:\J2ee;C:\j2sdkee1.3.1\lib\cloudscape\RmiJdbc;C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar;C:\Oracle\Ora81\jdbc\lib\classes12.zip;C:\Oracle\Ora81\orb\classes\yoj.jar;C:\Program Files\Oracle\JDeveloper 3.2.3\jdbc\lib\oracle8.1.7\classes12.zip;C:\Oracle\Ora81\orb\classes\share.zip
    //code begins here
    package moreservlets;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jdbc.driver.*;
    public class TitleQueries extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@pc840:1521:orcl", "scott", "tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery
    ("select * from emp");
    out.println(ServletUtilities.headWithTitle(title) +
    "<body bgcolor=\"#FDF5E6\">");
    while (rset.next()) {
    out.println("<h1 align=\"center\">"
    + rset.getString("ename") + "</h1>\n");
    out.println("</body></html>");
    catch(ClassNotFoundException cnfe) {
    System.err.println("Error loading driver: " + cnfe);
    catch(SQLException sqle) {
    System.err.println("Error connecting: " + sqle);
    }

  • Workarounds of 32K-limitation in jdbc:kprb needed!

    Hello ALL.
    Can you help me with solution of workarounds the limitation in jdbc:kprb(internal driver) for stored java?
    I try to put large string more than 32K into LONG field type using internal driver and Java Stored Procedure.
    And I get the error: "Data size bigger than max size for this type"
    I get this error in oracle 9.2.0.1.
    But it works in oracle 10.2.0.1.
    =========================================================
    Here is the example:
    import oracle.sql.CLOB;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.io.Reader;
    import java.io.CharArrayReader;
    import oracle.jdbc.pool.OracleDataSource;
    public class LongTest {
    public static void insertLong(String source, int counts)
    throws Exception {
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    StringBuffer stringBuffer = new StringBuffer();
    for (int i = 0; i < counts; i++) {
    stringBuffer.append(source);
    Reader reader = new CharArrayReader(stringBuffer.toString().toCharArray());
    // String st = stringBuffer.toString();
    PreparedStatement pst = null;
    try {
    pst = conn.prepareStatement("insert into TEST_LONG (ldata) values (?)");
    pst.setCharacterStream(1, reader, stringBuffer.length());
    // pst.setString(1, st);
    pst.execute();
    } finally {
    if (pst != null) {pst.close();}
    =========================================================
    Here is table:
    create table test_long (ldata long)
    =========================================================
    Here is the procedure:
    create or replace procedure long_test (p_source varchar2, p_counts number) as
    language java
    name 'LongTest.insertLong(java.lang.String, int)';
    =========================================================
    Here is the test block:
    begin
    LONG_TEST('q', 33000);
    end;
    =========================================================
    Thanx!

    Please, help me with solution...
    Is it possible use oci driver from Java Stored Procedures? And how?
    Thanx

Maybe you are looking for

  • Links to launch Script Editor no longer work

    Links to launch Script Editor no longer work.

  • How add new Tab in XD01

    Hi Gurus, Good day. I have designed a screen in SE38 which has 2 tabs. Each tab contains 12 fields. According to the sales organization  number corresponding tab will appear. I am very much new to BAdI. Just i can find the BAdI. Now please tell me in

  • Is FF 3.6.13 a 32 or 64 bit browser?

    I have Windows 7 64 bit. I cannot play AVI videos now. Some suggestions were to convert the AVI to WMV format, or to fix the problem with FF 32 bit for Windows. I can't seem to find that information. I read that FF doesn't have a true 64 bit browser

  • Imported MP4 clip from my HD will not thumbnail

    I created a new project then imported an MP4 clip from my HD as a new event but it does not thumbnail. When the event is selected the event window says "video not found" The same clip  playsjust  fine on Quicktime. I tried closing iMovie and reopenin

  • Problem in register updation

    Hi All, The stock balance is not updating in RG23CPART1. The addition of stock is happening where as if you issue material it is not deducting. Please give your valuable solution. Regards, RB