Frequently Asked Questions

These pages contain answers to the most common questions asked of Servlets.Net. To read an answer to a question, first select the category on the left, then the question on the right. If you don't find what you're looking for, feel free to send e-mail to our Support Department. If you would prefer, the entire FAQ is available on a single page.


 
General
Virtual Server
Java Servlets
Java Server Pages
Database
Internet
Dynamic Configuration Files
 
 
 
What database server is available?
What JDBC drivers are available?
Can I connect to my database from Microsoft Access or Visual Basic via ODBC?
Why do I have more than one database connection?
How do I pool my database connections?
How do I change my MySQL database's password?
How do I install the PoolMan connection broker software?
 

 
 
 

It is important to properly use database connection pooling when you are developing servlets that communicate with your database. There are only a certain number of database connections available to you, so pooling the connections efficiently is very important. More information on database connection pooling can be found in the Database section of the FAQ.

In the past, we've recommended using the Java Exchange pooling classes. There is nothing wrong with that package, but there is no built-in way to use it in JSP documents. We found that many customers were having trouble sharing the same pool of connections across both servlets and JSP documents with the Java Exchange solution.

Furthermore, we provided sample code for doing connection pooling within a JSP document using Allaire's JSPDBConnection bean. We've discovered that there are problems with Allaire's bean and do not recommend using it.

At this time, we've had good success using the Poolman connection pooling software. This software not only pools database connections, but it can also pool any sort of Java resource that you would like pooled. The package includes easy to use pooling mechanisms for using the same connection pool from both JSP and servlets. We've also found it to be very reliable.

An older version of Poolman is probably already installed with your Professional package. It is best to upgrade to the latest version. Below, we provide you with the steps necessary to install the latest version of PoolMan and get it up and running smoothly. As you review these instructions, if you find that your account does not include jrun/classes and jrun/lib directories, nor does it have a classpath.properties file, please let support@servlets.net know. We will upgrade your account to the latest configuration.

  1. Log into your account via SSH or telnet. Make sure you are in your home directory:
    	cd /home/username
  2. Download PoolMan 1.4 (or latest version)
    	lynx http://download.sourceforge.net/poolman/poolman-1.4.tar.gz
  3. Install it into your home directory
    	tar xvzf poolman-1.4.tar.gz
  4. Install the JAR file (overwrite the old version)
    	cp PoolMan-1.4/lib/PoolMan.jar jrun/lib
  5. Install the poolman.props file into a directory in your classpath
    	cp PoolMan-1.4/lib/poolman.props jrun/classes
  6. Copy the PoolMan.jsp sample to your web root
    	cp PoolMan-1.4/samples/PoolMan.jsp www/servername
  7. Edit your poolman.props file to contain your database settings
    	vi jrun/classes/poolman.props

    You should only keep the sections that you can use. For instance, if you are using a MySQL database, get rid of the Oracle and Postgres sections. Here's an example of what it should look like. Make sure to set maximumsize to "2" so that you don't go over your maximum number of database connections. Put your password in place of the asterisks. You should also use your domain name, site alias, or IP number and the database name in the db_url.

    db_name.1=mySQL
    db_driver.1=org.gjt.mm.mysql.Driver
    db_url.1=jdbc:mysql://www.yourdomain.com/username_dbname
    db_username.1=username
    db_password.1=*****
    enableCache.1=true
    cacheSize.1=5
    cacheRefresh.1=10000
    connection_timeout.1=15000
    checkfrequency.1=30000
    usertimeout.1=10000
    maximumsize.1=2

  8. Download the JDBC 2.0 Optional Package from Sun that is required by PoolMan into your lib directory
    	cd jrun/lib
    	lynx http://java.sun.com/products/jdbc/download.html#binary
  9. Install jdbc2_0-stdext.jar at the beginning of your classpath
    	cd ../jsm-username-jsmname/properties
    	vi classpath.properties

    Add /home/username/jrun/lib/jdbc2_0-stdext.jar to be beginning of you classpath, making sure to point at your home directory, not "username". It is absolutely critical that your classpath stay on one line. Do not introduce any line breaks into it or it will not work. Here's an example of classpath.properties:

    java.classpath=/home/username/jrun/lib/jdbc2_0-stdext.jar\:/home/username/jrun/lib
    /jsp.jar\:/home/username/jrun/lib/xml4j.jar\:/home/username/jrun/lib/xt.jar\:/home
    /username/jrun/lib/fesi.jar\:/home/username/jrun/lib/WebL.jar\:/home/username/jrun
    /lib/jrun.jar\:/home/username/jrun/lib/servlet.jar\:/home/username/jrun/lib/cfanyw
    here.jar\:/home/username/jrun/lib/NetComponents.jar\:/home/username/jrun/lib/OROMa
    tcher.jar\:/home/username/jrun/lib/jrunadmin.jar\:/home/username/jrun/classes\:/ho
    me/username/jrun/jsm-username-jsmname/classes\:/home/username/jrun/lib/mail.jar\:/
    home/username/jrun/lib/activation.jar\:/home/username/jrun/lib/PoolMan.jar\:/home/
    username/jrun/lib/mysql_both_comp.jar\:/home/username/jrun/lib/swing.jar\:/home/us
    ername/jrun/lib/instantdb.jar\:/usr/local/jdk1.2/jre/lib/rt.jar

  10. Restart your JSM
    	cd ..
    	./stopjsm.sh
    	./startjsm.sh
  11. Test your PoolMan.jsp page in a web browser
    	http://www.yourdoamin.com/PoolMan.jsp

    You will need to have created a table in your database before you can actually execute any meaningful commands. Assuming you have a table called "test" in your database, you could type in a command like this: "select * from test". Your data should be displayed.

That's it! Now you can review the code in PoolMan.jsp to help you get your own application going. There are other examples of using PoolMan and more information in the /home/username/PoolMan-1.4 directory. Feel free to remove that directory whenever you don't need it anymore. If you've followed these directions, the necessary jar and props files to make PoolMan work have been copied from that directory and are now installed in your jrun areas.

Best of luck getting your application up and running! Please let support@servlets.net know if you need further assistance.

 


 
Copyright © 1998 - 2007 Servlets.Net Corporation. All rights reserved. Legal Notices.