Subject Re: [Firebird-Java] Can't connect to DB
Author Rick Fincher
Hi William,
I'm using Tomcat too.  4.1.3 or 4.1.7 is best for JNDI stuff and connection pooling.  evidently some people have had trouble with 4.1.7 but fixed it by putting the 4.1.3 DBCP jars into 4.1.7. 
I've had good luck with 4.1.3 but 4.1.7 is still a little flakey.  If I use Java in the server mode to run Tomcat, I have problems, but Java in the client (default) mode seems to work OK (on a sun server).  This is probably a Java problem, not Tomcat.
The manager webapp is very handy in 4.1.7, though.
I presume you are on the Tomcat mailing lists, if not i can send you the address for that.  It's VERY active and Tomcat is changing rapidly, so it helps a lot.
As for your problems with FB, it sounds like we have a similar setup.  I do the webapps on a Win 2000 box and deploy on a Sun server.
I don't run FB on the Windows box at all, it isn't needed to access the server.
One thing you can try it to Telnet into the port on your FB server to see if you can get to it from the box that can't connect.
Win 2000 and UNIX has telnet but i don't know about others.  From a commanline prompt type:
telnet 3050
This should connect you to the Firebird/Interbase port. If you get a message like:
Connecting To not open a connection to host on port 3050 : Connect failed
then, either the port isn't open or there's a network problem of some type.
You can do the same for Interserver's port 3060 that Interclient uses.
There may be a firewall or proxy problem.
If you connect to the port and try to type anything it will kick you off because it is looking for specific stuff from the driver, but at least you'll know the port is up and accepting requests.
I don't know if you are doing the system admin on your servers but you may need to explicitly enable port 3050 through a firewall for it to work.
Interclient may work because it is using port 3060 to talk to 3050 on the local host (the server), which may work even if 3050 isn't accessible with other systems.
If you do decide to use the driver's built in pooling you can do so with code like the following replacing your "Class.forName.("org.firebirdsql.jdbc.FBDriver")" code.
import javax.resource.ResourceException;

static protected org.firebirdsql.jdbc.FBWrappingDataSource fbwds;



   fbwds = new org.firebirdsql.jdbc.FBWrappingDataSource();


catch (ResourceException e)


   System.out.println("Could Not create org.firebirdsql.jdbc.FBWrappingDataSource, error: "+e+"\n");

   return null;


fbwds.setDatabaseName(connectionURL); // in the format  ""










c = fbwds.getConnection();


catch (SQLException e)


System.out.println("getting new fbwds connection failed! Error: "+e+"\n");


Hope this helps.




On Mon, 2002-07-15 at 16:23, Rick Fincher wrote:
> Hi William,
> This is very strange.  When I switched to the FB SQL driver (on both
> Windows and Solaris)  I just put in the new jar, changed the driver
> name to FBDriver, changed the url appropriately, and it worked.

This is exactly what I did on my Laptop and it worked, but on my
development production servers it does not. So I am looking for some
sort of explanation, but have not come up with one yet?

> You might try putting in a bad db filename that you know should fail
> and see if you get the same error.  If so it would indicate something
> wrong with the filename (case, underscore problem, etc).

A possibility, but I have verified, and even copy/pasted the url used in
my client side GUI to be the same as the on in the connection pool.

> I didn't see your earlier posts so I don't know the specifics of the
> problem.  Can you check to see if the driver is loading (non null) and
> see if you are getting a live connection (get.connection() not null).

I know the driver is loaded, because I do not get an exception when
doing so. It's when I try to establish a connection I have problems.
Instead of getting a null connection, an exception occurs.

Here is a snippet of the base class that the connection pool just calls
multiple times.

try {
catch(ClassNotFoundException cnfe) {
      System.err.println("Database Exception\nDriver Class Not Found
try {
      connection = DriverManager.getConnection(url,name,passwd);     
catch(SQLException sqle) {
      System.err.println("Database Exception\nCould not connect this
database,\n"+url+"\nwith the following

So it's the exception above that keeps getting thrown.

> You may also want to use FBWrapping data source instead of FBDriver
> and get connection pooling in the bargain. I can give you the
> specifics on this if you like. It's pretty easy and it may work around
> your problem.

I will consider this, but I was planning to drop my connection pool for
one inside of Tomcat. Do you use Tomcat, and if so which one is the
preferred one to use for an app that requires a connection pool?

> Sorry if you have gone through this drill, like I say I didn't see
> your earlier posts.

It's cool, you are not really covering anything that has been discussed,
so it counts as new input.

Also I forgot to mention one other difference in the machines. My
laptop  has Firebird installed but not running. I have a dedicated
Firebird server that houses the DB's I am trying to connect to. My
development and production servers do not have Firebird installed in
anyway. Could that be the problem? It would seem very strange if it was,
but I am looking for anything at this point.

William L. Thomson Jr.
Obsidian-Studios, Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone  707.766.9509
Fax    707.766.8989
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone  707.766.9509
Fax    707.766.8989

To unsubscribe from this group, send an email to:

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.