Clustering and database design question

Hi,
          One of the things we are seeing with running clusters is that, reasonably,
          as we get more users (due to increased capacity of the cluster), we get more
          hits on the database. As these are now coming from multiple servers it is
          more likely they are in separate transactions and so are less coordinated.
          As a result, what we see, is more deadlocks at the database( Sybase 11.9.2).
          We have introduced row-level locking and this helps, also stored procedures
          have shown some improvement in really over-used tables, but I can't help
          thinking this is a general design concern.
          The way I have been intending to scale our cluster is to have identical
          server deployments of all beans and use load-balancing for the client
          connections to the cluster. However, all our cluster members will be using
          the same database so the chance of deadlocks must increase for each server I
          add.
          Is this a general design problem or are there design solutions I can adopt
          to help with this? Can anyone give some good advice, highlight specific
          weblogic features, discuss similar designs or point to some good documents
          on such scalability issues? Perhaps I should add the majority of our
          database access is by entity beans using bean managed persistence.
          Thanks
          Sioux
          

          Give TopLink a try:
          Clustering - Refresh Yes
          Ability to refresh cached beans and objects between nodes of a cluster of application
          servers
          Clustering - Synchronization Yes*
          TopLink WebLogic contains support for synchronous or asynchronous cache synchronization
          between nodes in a cluster. TopLink WebSphere cache synchronization will be supported
          01Q1
          Cocobase has a similar distributed caching scheme. But WebGain should be a better
          bet because they are 40% owned by BEA (better integration with WebLogic)
          Jim Zhou.
          "Mike Reiche" <[email protected]> wrote:
          >
          >
          ><whine>
          >I haven't seen a solution to this yet. Clustering prevents the application
          >server
          >from caching database data - which is the reason we use applications
          >in the first
          >place. All data is read from the db at the beginning of a transaction
          >and written
          >back at the end of a transaction.
          ></whine>
          >
          >We are trying to avoid this by pinning entity bean instances to a single
          >WL instance,
          >then we can set db-is-shared=false and the WL instance can cache the
          >entity bean.
          > Stateful session beans seem more suited to scaling than entity beans
          >- there
          >is only ever one instance of a session bean - if you access it from a
          >different
          >WL instance, it is accessed via RMI. For entity beans - multiple copies
          >exist
          >on the different servers.
          >
          >Read-only entity beans are ok if your data is truly read-only. Still,
          >each WL
          >instance will need to read the data from the DB and each copy of the
          >same entity
          >bean instance on each WL instance takes up memory. From the db's point
          >of view
          >- the more you scale, the worse things get. The only thing that WL clustering
          >scales is CPU. WL clustering does not really help to scale the number
          >of entity
          >beans instances.
          >
          >The Read-Mostly pattern exists - but I find this gives me the worst of
          >both worlds.
          >My beans are not always up-to-date and I have all these duplicate instances.
          >
          >Said that, I would love for someone from BEA to contradict me - and tell
          >me how
          >I can make entity beans scale in a WL cluster.
          >
          >
          >- Mike
          >
          >"Sioux France" <[email protected]> wrote:
          >>Hi,
          >>One of the things we are seeing with running clusters is that, reasonably,
          >>as we get more users (due to increased capacity of the cluster), we
          >get
          >>more
          >>hits on the database. As these are now coming from multiple servers
          >it
          >>is
          >>more likely they are in separate transactions and so are less coordinated.
          >>As a result, what we see, is more deadlocks at the database( Sybase
          >11.9.2).
          >>We have introduced row-level locking and this helps, also stored procedures
          >>have shown some improvement in really over-used tables, but I can't
          >help
          >>thinking this is a general design concern.
          >>The way I have been intending to scale our cluster is to have identical
          >>server deployments of all beans and use load-balancing for the client
          >>connections to the cluster. However, all our cluster members will be
          >>using
          >>the same database so the chance of deadlocks must increase for each
          >server
          >>I
          >>add.
          >>Is this a general design problem or are there design solutions I can
          >>adopt
          >>to help with this? Can anyone give some good advice, highlight specific
          >>weblogic features, discuss similar designs or point to some good documents
          >>on such scalability issues? Perhaps I should add the majority of our
          >>database access is by entity beans using bean managed persistence.
          >>Thanks
          >>Sioux
          >>
          >>
          >
          

Similar Messages

  • When to use FileTable, and DB design questions

    I have a kind of interesting scenario- lets say I have a list of people I wish to store in the database, so I create a table 'Person'.  Now lets say each person has a 2000 large image files (say high res photos or something).  Each image is >
    5M.  What I need to do at the end of the day is retrieve a person, and upon selection display a selected photo (or photos) in my C# WPF app.
    I was looking at FileTable to store the data on the disk, as this would be preferable to storing all these images as blobs.  But I wasn't sure how to associate the Person with their images through the FileTable.
    Can I add additional columns to a file table (like an fk to Person)?  Not sure if that is the right approach.  Maybe FileStream is better?  Is it better in a case like this to just store a path in the database?  Which leads to the next
    question...
    I also need to store other kinds of data, like DeepZoom data- this is interesting stuff, as its about 600M of data, and exists in a single directory structure with multiple levels of data (and images).  Apps able to read this need extremely fast access
    to the data to render it quickly.  I think in this case I would need to just store the location of the DZ data on disk.  But that seems fragile.  Is there a standard accepted way to store file locations in the DB?
    Thoughts and advice appreciated!

    Okay, filestream it is.
    What about storing file locations?   Also, if I write a 10M file to a filestream- do I write this to the DB as if it were a blob?  Is it slower to write to the DB than directly to the filesystem using filestream?
    I read the whitepaper on filestream and hunted around but couldn't seem to find this info...
    Since a FileTable appears as a folder in the Windows file system, you can easily load files into a new FileTable by using any of the available methods for moving or copying files. These methods include Windows Explorer, command line options including xcopy
    and robocopy, and custom scripts or applications.
    Please read the below URL. It clearly explains answer for your question.In the below url  script example also given
    http://technet.microsoft.com/en-us/library/gg492083.aspx#HowToMigrateFiles
    Loading or Migrating Files into a FileTable
    The method that you choose for loading or migrating files into a FileTable depends on where the files are currently stored.
    Current location of files
    Options for migration
    Files are currently stored in the file system.
    SQL Server has no knowledge of the files.
    Since a FileTable appears as a folder in the Windows file system, you can easily load files into a new FileTable by using any of the available methods for moving or copying files. These methods include Windows Explorer, command line options including xcopy
    and robocopy, and custom scripts or applications.
    You cannot convert an existing folder to a FileTable.
    Files are currently stored in the file system.
    SQL Server contains a table of metadata that contains pointers to the files.
    The first step is to move or copy the files by using one of the methods mentioned above.
    The second step is to update the existing table of metadata to point to the new location of the files.
    For more information, see Example: Migrating Files from the File System into a FileTable in this topic.
    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. By ganeshk

  • Database design question about historical data in a group of tables

    Hi Folks,
    I have a group of tables having relationships among them. In order to keep the change history, we can not update the data, instead, we add new data to the table(s) and mark older data as whatever non-current status. They all have timestamps in these tables.
    For example, If table Parent changes, we add new record Parent(new) and keep older record(s). But the table child has not changed, so how could we link the parent and child table(s)?
    One solution is to use a unique sequencial number to identify the snapshot of all these group of tables, so the FK contains this sequencial number to keep all tables in sync from point of time t1 to t2 and so on.
    But the problem is if only one table changes, we have to insert new records to ALL tables with the new sequencial number to indicate a new snapshot of all group of tables, this obviously has lots of redundancy when change occurs in one place only.
    However, If we only adds new records to a changed table, lets say Parent, how could we distinguish the current record in Parent table and its child tables to reflect a consistent snapshot of all tables? Because the record in parent table Parent(t2), Parent(t1) all associate to child(t1), since at time of t2, child table has not changed, only Parent table changed.
    Your opinions are appreciated!
    Thanks a lot.

    There are books on the subject of dealing with time series data. You may need to read one or two as this is a very complex topic. Though not applications of time series classification are complex it is difficult to tell based on what information can go in a post.
    What has to be reflected on the parent when a child row is changed? Do both the old child row and the new child row belong to the same parent?
    What activity at the parent level would affect the child rows? That is, is there any activty on the parent that requires new child rows to be populated?
    One way of tying the child rows to a specific set of parents would be to carry the parent key, timestamp to the child as a begin_parent_timestamp and then also potentially have a end timestamp if a change to a parent ends the relationship. If changes to the parent do not ever end the relationsip then the end_timestamp would not be necessary. In this case if you want to join a parent to only the most recent version of a child you can perform a select parent kye, child key, max(parent_timestamp) from child group by parent key, child key. One child row would match serveral parents.
    Without more specifics it is hard to make suggestions that might prove usable but your table relationships might be too complex to deal with in this kind of forum.
    There is a newsgroup on database theory that may be a good place to seek ideas on this type of problem.
    HTH -- Mark D Powell --

  • Newbie's DAO and database design

    I have NodeDAO (which creates Node objects from a 'node' table). Node objects have a NodeType object which is handeled by the NodeTypeDAO (acessing 'node_type'
    table). For the NodeDAO to return a fully populated Node object, it must first give it a NodeType.
    Now should I:
    a) Let NodeDAO use NodeTypeDAO to handle NodeTypeObjects?
    b) Let NodeDAO use 'node_type' table, which should normally only be handeled by the NodeTypeDAO?
    c) Let NodeDAO return an incomplete Node object, and let the complete assembly/disassembly be handeled elsewhere (eg. TransferObjectAssembler)?
    I think option c) is most obvious as it gives the clearer design. I'm going to need a TransferObjectAssembler eventually because I need to access different type of NodeDAOs for each kind of NodeType (Category, Image, Document, etc.). It's that part of returned a not fully populated object that seems not quite right.
    Have I overlooked another solution to this problem?
    Any advice is appreciated, thanks.
    --Zta.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Zta,
    There are a number of new techniques to Java EE 5 that can be used. DAO's and DTO's may longer be required in your application is you are using the Java Persistance APIs.
    Please take a look at the Java EE 5 tutorial located at http://java.sun.com/javaee/5/docs/tutorial/doc, specifically in the Persistence section located at http://java.sun.com/javaee/5/docs/tutorial/doc/PersistenceIntro.html to help inform you of the latest methods and technologies.
    Hope this helps - Thanks - Mark

  • Page personalization and database table question

    Using E-business Suite, when personalizing a page, where can you find what table the information is pulling from in the database? Thank you for your help, it is appreciated.

    Check the following Tables
    FND_FORM_CUSTOM_RULES
    FND_FORM_CUSTOM_SCOPES
    FND_FORM_CUSTOM_ACTIONS
    FND_FORM_CUSTOM_PARAMS

  • Foreign keys without ON DELETE CASCADE; Database Design question

    This is the 3rd company i am working, where i see Foreign Keys created without
    ON DELETE CASCADEclause.
    My colleague says that it is created without ON DELETE CASCADE clause in order to make deletion of data (child records) difficult. So, for Purge/Archive codes, before we delete from Parent table we have to delete from the Child table first.
    Occasinaly , something goes wrong and we'll end up disabling all FKs and then do Purging, Archiving, etc..
    So, isn't it better to create Foreign keys with ON DELETE CASCADE clause rather than having all these hassles?
    From you experience, what do you guys think?

    ON DELETE CASCADE is usually not a good idea - something 'magical' happens in the background and rows go away. Instead, consider making the FK DEFERRABLE INITIALLY DEFERRED. That way you can delete the parent and child rows in any sequence and the constraint will not be checked until commit time. You want to use an API (stored procedure/package) to make sure DML is executed in the proper sequence and in the proper way for your business rules.

  • Web Page and Database Design Problem

    Ok, so I'm trying to develop an app, but am having a few problems and need some advice/help.
    I have a webpage made up of jsp pages. These pages will contain forms that will either list info from the databse, or allow users to enter data to submit to the DB.
    So I will have Servelts that will process the form information.
    I also have written DAO interfaces for different tables. For example I have a config table which olds keys and there values.
    This information will only ever be displayed so I have an interface which getAll() and get(String key).
    I want to avoid putting code like below going into the DAO
    ctx = new InitialContext();
    javax.sql.DataSource ds
    = (javax.sql.DataSource) ctx.lookup (dataSource);
    conn = ds.getConnection();
    PreparedStatement stmt = conn.prepareStatement(query);
    ResultSet records = stmt.executeQuery();
    I'd prefer to make calls from my DAO getAll() method to another class which would create the connection, and query the db, and return the ResultSet, so that I can store/manipulate it anyway I wish, before passing the results back to the servlet.
    Problem is the records seem to come back null!

    ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup (dataSource);
    conn = ds.getConnection();You should have a Connection Pool to create a connection and hand it out to whoover ask for it.
    Check out Hibernate
    Hibernate can manger your connection (you need to set the xml configuration first) .. It's another layer to encapsulate your JDBC connection, request, etc..
    Also check out Spring Framework. Spring can makes Transaction much more easy to implement (using aspect)
    It provides a handful of useful api for you to work with. like JdbcTemplate, HibernateTemplate.

  • Difference between database design and schema design

    Hi i have visited so many database websites and i found so many people saying we can design a data base for you. Is schema designing and database designing is the same. so many palces i find people saying we have to design data base first in order to create a physical databse. so i am little bit confused. are they same? and also what is the difference between data model and schema?

    > the definition i found for logical data model, physical data model and the definition you
    gave for logical database design, physical database design are the same.
    Not correct. The physical design is the implemetation of the logical design. These two designs are at different levels. Also, the logical design will be the same. irrespective of the RDBMS product use.
    What is incorrect is a designer/architect designing a logical design specifically for Oracle.. or specifically for SQL-Server. A logical design has nothing to do with the RDBMS product (or h/w platforms. app servers, web severs and operating systems used).
    So the logical design will always be the same - it is RDBMS independent.
    The physical design is fully dependent on the RDBMS product used. The same logical design will be implemented as different physical designs for Oracle and for SQL-Server.

  • Suggestion:  Create a Database Design Forum

    I recommend the creation of a new forum dealing exclusively with database design questions, such as setting Primary Keys, Unique constraints, Check constraints, Indexes, schema-creation scripts, etc. There is no forum devoted exclusively to this topic now and I feel it would be very helpful to the user community. It would certainly make searching for answers to design questions much easier.

    Billy  Verreynne  wrote:
    Prohan wrote:
    I don't agree there.
    1. How to create a relational model certainly IS relevant to Oracle, which is a RELATIONAL DBMS.Oracle also supports data warehousing (star schema designs), network/hierarchical designs, object-relational designs - or pretty much any data model that you may come up with. Calling it just a relational DBMS is incorrect.
    2. Your point that logical models are independent of specific technology is correct. What you're missing is that if a specific technology makes use of a certain foundational body of knowledge, that knowledge is a legitimate topic for a forum whose users use that specific technology.That is putting the cart in front of the horse IMO.
    I would rather see data modeling and logical database design being done in a way that is untainted with specific vendor implementations and technology used. There needs to be a clear line dividing the design from the implementation. If not, then design decisions can (and will) be made based not on the correct logical data modeling principles, but whether it can be "handled" by the technology. A design that is tainted like that, will always be less than optimal (especially as technology is continually evolving and changing).
    An OTN forum for database design will invariable be tainted with Oracle technology - and instead of learning sound data modeling fundamentals, a warped view of data modeling will be conveyed. Where doing abc will be acceptable (when it is not), because Oracle has feature xyz that can make the flawed design work (in a fashion).Excellent points. I think (or at least hope) such a forum would attract some number of pure theorists to straighten out the view. This might make for a lively forum, and might actually influence the real products, and might even get the cart on the right side of the horse.
    Hmmm, I guess I do sound hopelessly optimistic.

  • I have some database related questions

    hey all
    i am currently designing a java GUI program for a dvd renting shop.
    this program obviously needs a databse, i was just wondering how much possibly a database on a home pc could hold data because this shop have about 15000 DVD title and about 1500 client so i was wondering how much a mySQL databse table could hold....
    i also have another question...this shop have an access database...my question is can i use the existing database and querie it from my java program??? do i need a driver ??? can i querie an acces databse just like a regular SQL databse(e.g. SELECT * FROM TABLENAME) ????

    hey all
    i am currently designing a java GUI program for a dvd
    renting shop.Why not simply download JBoss Seam's DVD store example. It's fully coded for you already!
    this program obviously needs a databse, i was just
    wondering how much possibly a database on a home pc
    could hold data because this shop have about 15000
    DVD title and about 1500 client so i was wondering
    how much a mySQL databse table could hold....
    You will not have issues even with Access with that few a number of rows. Disk is really the only limitation on the size of the database. (There can be O/S or database specific limitations, such as 2GB of total size). So, do not worry about how many records.
    When you truly get a large number of records (tens of millions plus) or you are joining two large tables, then you can have performance issues. Good use of primary keys, indexes and database design can limit this issue.
    i also have another question...this shop have an
    access database...my question is can i use the
    existing database and querie it from my java
    program??? do i need a driver ??? can i querie an
    acces databse just like a regular SQL databse(e.g.
    SELECT * FROM TABLENAME) ????You can use Access, mySQL, Postgres or any number of other databases. Each will require (and will have on their site) a JDBC driver that you need to have on your application's CLASSPATH. My recommendation would be mySQL or Postgres. Both are free and excellent quality.
    As an aside, you should rarely SELECT * from any table (other than a code or lookup table). Use a WHERE clause to limit results. What user would possibly want to scroll through ALL 15,000 records? :^)
    - Saish

  • Multi-lingual Software & Database Design

    I am interested in how the industry is approaching multi-lingual software and database design. Specifically, I would like to know if there are any good resources (whitepapers, web sites, books) that get into the details of what the object model and data model of a multi-lingual design would look like and how the two fit together. I am working on a project that requires Product information to be stored in both English and French. Thank you.

    http://java.sun.com/j2se/1.3/docs/guide/intl/

  • Logical Database design and physical database implementation

    Hi
    I am an ORACLE DBA basically and we started a proactive server dashboard portal ,which basically reports all aspects of our infrastructure (Dev,QA and Prod,performance,capacity,number of servers,No of CPU,decomissioned date,OS level,Database patch level) etc..
    This has to be done entirely by our DBA team as this is not externally funded project.Now i was asked to do " Logical Database design and physical Database
    implementation"
    Even though i know roughly what's that mean(like designing whole set of tables in star schema format) ,i have never done this before.
    In my mind i have a rough set of tables that can be used but again i think there is lot of engineering involved in this area to make sure that we do it properly.
    I am wondering you guys might be having some recommendations for me in the sense where to start?are there any documents online , are there any book on this topic?Are there any documents which explain this phenomena with examples ?
    Also exactly what is the difference between logical database design vs physical database implementation
    Thanks and Regards

    Logical database design is the process of taking a business or conceptual data model (often described in the form of an Entity-Relationship Diagram) and transforming that into a logical representation of that model using the specific semantics of the database management system. In the case of an RDBMS such as Oracle, this representation would be in the form of definitions of relational tables, primary, unique and foreign key constraints and the appropriate column data types supported by the RDBMS.
    Physical database implementation is the process of taking the logical database design and translating that into the actual DDL statements supported by the target RDBMS that will create the database objects in a target RDBMS database. This will generally include specific physical implementation details such as the specification of tablespaces, use of specialised indexing (bitmap, clustered etc), partitioning, compression and anything else that relates to how data will actually be physically stored inside the database.
    It sounds like you already have a physical implementation? If so, you can reverse engineer this implementation into a design tool such as SQL Developer Data Modeller. This will create a logical design by examining the contents of the Oracle data dictionary. Even if you don't have an existing database, Data Modeller is a good tool to use as a starting point for logical and even conceptual/business models.
    If you want to read anything about logical design, "An Introduction to Database Systems" by Date is always a good starting point. "Database Systems - A Practical Approach to Design, Implementation and Management" by Connolly & Begg is also an excellent reference.

  • Design question for database connection in multithreaded socket-server

    Dear community,
    I am programming a multithreaded socket server. The server creates a new thread for each connection.
    The threads and several objects witch are instanced by each thread have to access database-connectivity. Therefore I implemented factory class which administer database connection in a pool. At this point I have a design question.
    How should I access the connections from the threads? There are two options:
    a) Should I implement in my server class a new method like "getDatabaseConnection" which calls the factory class and returns a pooled connection to the database? In this case each object has to know the server-object and have to call this method in order to get a database connection. That could become very complex as I have to safe a instance of the server object in each object ...
    b) Should I develop a static method in my factory class so that each thread could get a database connection by calling the static method of the factory?
    Thank you very much for your answer!
    Kind regards,
    Dak
    Message was edited by:
    dakger

    So your suggestion is to use a static method from a
    central class. But those static-methods are not realy
    object oriented, are they?There's only one static method, and that's getInstance
    If I use singleton pattern, I only create one
    instance of the database pooling class in order to
    cionfigure it (driver, access data to database and so
    on). The threads use than a static method of this
    class to get database connection?They use a static method to get the pool instance, getConnection is not static.
    Kaj

  • Requirements for database design and installation

    Hi,
    As a database administrator, how to find out whether the database is design and installed properly?
    Can you please what would be the requirements to be considered towards the databse design for application developer ?
    thanks heaps !!!!

    Mohamed ELAzab wrote:
    regarding that the number of execution is the main thing that affects the performance i said that already above " the application executed it 30 000" but you didn't read my answer correctly. I did not respond to that "answer" of yours as it was not part of your posting that I responded too. In your response, which I quoted, talked about non-sharable SQL retrieving 20 rows and after 3 years it retrieving a million rows. This has no bearing on whether the SQL is sharable or not.
    I don't agree with you regarding that the design is not being done regarding considering the performance bottlenecks.So you decide on what the bottlenecks are up front, and then use these as database design considerations? I fail to see any logic or merit in such an approach.
    i want to let you know that we in the telecoms environment have many problems in our databases because the people who designed those applications didn't take performance in consideration.I understand too well - and it is not that they did not take performance into consideration when designing the database, it is because the design is just plain wrong from the start.
    You do not need to consider amount of memory available, number and speed of CPUs, bandwidth and speed of the I/O system, in order to design a database. These have no relevance at all during the design phase. Especially as the h/w that will run the design in production in a year's time can be drastically different from the h/w that will be used today.
    No, instead you use a proper and correct design methodology and data modeling approach. Why? Because such a design by its very nature will make optimal use of h/w resources and will provide data integrity, scalability and performance.
    Again i think design of the database application must take database performance bottlenecks in consideration like application which doesn't use bind variables if they took into consideration to avoid that it will help the DBA in the future but unfortunately most people doesn't do that. And as I said - using bind variables or not has absolutely nothing to do with the basic question asked in this thread: "+what are the requirements of database design+".
    How does using/not using bind variables influence the design of a table? Determine whether an entity is in 3NF? What the unique identidiers are for an entity? These are the design considerations for a database.. not bind variables.
    Yes, SQLs not using bind variables can cause performance problems. Not paying the electricity bill can cause a power outage for the database server. So what? These issues have no relevance to database design.

  • Database Connection design question

    Hello, I have a design question. Awhile back I needed to create a database connection to SQL Server, so I created a class to do it
    import java.sql.*;
    import java.io.*;
    import java.net.MalformedURLException;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class SQLServerConnection
         private static Connection connection = null;
         public SQLServerConnection(String user, String password, String dbName) throws java.sql.SQLException
              getDBConnection(user, password, dbName);
         public SQLServerConnection(String configFileName) throws java.sql.SQLException
              getDBConnection(configFileName);
         private void getDBConnection(String user, String password, String dbName) throws java.sql.SQLException
             DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
             connection = DriverManager.getConnection(
                  "jdbc:microsoft:sqlserver:" + dbName, user, password);              
         private void getDBConnection(String configFileName) throws java.sql.SQLException
              String user;
              String password;
              String dbName;
              try
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = factory.newDocumentBuilder();
                   Document doc = db.parse(configFileName);
                   doc.getDocumentElement().normalize();
                   // get the configuration information
                   password = getConfigParameter("password", doc);
                   user = getConfigParameter("username", doc);
                   dbName = getConfigParameter("databasename", doc);
                   getDBConnection(user, password, dbName);
              catch (MalformedURLException murle)
                   System.out.println("Unable to connect to: " + configFileName + " -- " + murle);
                   System.exit(1);
              catch (FileNotFoundException fnfe)
                   System.out.println("Configuration file " + configFileName + " not found.");
                   System.exit(1);
              catch (IOException ioe)
                   System.out.println("IOException: " + ioe);
                   System.exit(1);
              catch (javax.xml.parsers.ParserConfigurationException pce)
                   System.out.println ("Parser Configuration Error: " + pce);
              catch (SAXException saxe)
                   System.out.println ("SAXException: " + saxe);
         private String getConfigParameter(String paramName, org.w3c.dom.Document doc)
              NodeList nl = doc.getElementsByTagName(paramName);
              if(nl != null)
                   Node n = null;
                   for (int i = 0; i < nl.getLength(); i++)
                        n = nl.item(i);          
                        if(n.hasChildNodes())
                             NodeList children = n.getChildNodes();
                             return ((Node)children.item(0)).getNodeValue();
              else
                   System.out.println ("nl is null");
              return "";          
         public void setCatalog(String catalogName) throws java.sql.SQLException
              connection.setCatalog(catalogName);
         public Connection getConnection()
              return connection;
         public void closeConnection()
              try
                   connection.close();
              catch(java.sql.SQLException sqle)
                   System.err.println ("SQL Server Connection failed to close: " + sqle);
    }Later on, I needed to do the same thing for MySQL, so I created a class for that, MySQLServerConnection which is exactly the same as above, except for:
    private void getDBConnection(String user, String password, String dbName) throws java.sql.SQLException
              try
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   connection = DriverManager.getConnection(dbName, user, password);     
              catch(java.lang.ClassNotFoundException cnfe)
                   System.out.println (cnfe);
              catch(java.lang.InstantiationException ie)
                   System.out.println (ie);
              catch(java.lang.IllegalAccessException iae)
                   System.out.println (iae);
         }Later, on, I did the same thing with OracleServerConnection. My question is, I know this is probably not optimal code. For example, I didn't originally have a close connection method, so I had to go in and code one for all 3. I'm assuming that an interface would be a good idea so that if I have to code another database connection class I make sure and include all of the appropriate methods. I'm also assuming that it would have been smart to have a master class, maybe something like DatabaseConnection and extended these classes from that. Am I on the right track? Totally offbase?

    @nclow - I will work on trying the Factory Pattern for this over the weekend and post when I finish to see what you think.
    @abillconsl - just to make sure I understand, you're saying that I just try to connect and it will cycle through the different database connection possibilities and connect when it finds the right one? If it fails all 3, log an appropriate message. One question I have about this is, I thought I was being object oriented by separating the different types of db connections (Oracle, SQL Server, MySql) into different classes. Am I missing the point of OOP by what I was/am trying to accomplish? Going overboard? Also, does your way try and connect to all 3 even if I connected to one already?
    Thx, Grantarchy
    Edited by: grantarchy on May 9, 2008 9:50 PM

Maybe you are looking for

  • Custom Bios for GX740

    Hi Svet Is it possible to get a Custom BIOS for the GX740, that have the hidden options unlocked e.g. HPET 32/64, and advanced settings? Thank You in advance Regards Alfi

  • Is ripping DVD's to an iPod Legal?

    I've used Handbrake to rip my DVD movies onto my iPod Video. I would like to know if it is legal or not. If possible, please have proof. Conditions: -I only use it for myself -I don't copy the movie to anyone else's iPod (even if they have the movie)

  • Print Services not logging pages printed

    When setting up a print queue, we seem to have two options: 1 - Press the plus button, enter the printer's IP address and give the new queue a name. 2 - Add the printer to the print server, then share it using the queue that appears in Server Admin/P

  • Spry collapsable panel transparency

    hey all, i have a spry collapsable panel, when it drops down, i want it to have a 100% opacity white background. when i simply code background:#FFF, it is completely transparent. when i use a different color (i.e. #666), the color still exists, but i

  • Final Cut Pro 7 keyboard problem, losing key commands/shortcuts

    Hi Everyone, I installed Final Cut Studio 3 on my new iMac. When i open FCP 7 I assign a shortcuts to keyboard layout, but when I close and re-open FCP 7 my commands/shortcuts will be lost... If I save my layout and I load the profile saved, same thi