Subject Re: [Firebird-Java] Can't connect to DB
Author William L. Thomson Jr.
On Tue, 2002-07-16 at 11:31, Rick Fincher wrote:
> 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 am waiting for Tomcat 4.1.x to make it past beta stages before I
upgrade to it. As I do run Tomcat on a production server, as well as my
development server.

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

Yes, except I am all Linux, from development to deployment.

> I don't run FB on the Windows box at all, it isn't needed to access
> the server.

Didn't think so, but at this point I am looking at everything.

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

Yes I did and I can connect.

> You can do the same for Interserver's port 3060 that Interclient uses.

InterClient is what I have been using, and it still works fine. Although
I did get some funkiness one day, but it has not occurred again.

> There may be a firewall or proxy problem.

Nope, the machines are all on a Lan behind two consecutive firewalls. So
unless you are the outside world getting in, that's the only direction
that is firewalled. All my machines have access to each other via a Lan.

> 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 saw some funky stuff, but it did not kick me off. Although I did not
give it time to. Once I was able to open the port with telnet, that was
good enough for me.

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

Yes, I am the admin, and everything else. So no firewall.

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

Yes, this is true, but 3050 is accessible to all in the Lan and in the
domain.

> If you do decide to use the driver's built in pooling you can do so
>with code like the following replacing your

Thanks for the code below. I like allot, and am very happy pooling was
added to Firebird's driver.

Now which is a better way to go, Tomcat pooling, or the drivers own
internal pool.

I most use pools in web apps, that will run under Tomcat.


> "Class.forName.("org.firebirdsql.jdbc.FBDriver")" code.
>
> import javax.resource.ResourceException;
> static protected org.firebirdsql.jdbc.FBWrappingDataSource fbwds;
>
> try
>
> {
>
> 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
> "host.domain.com/3050:/dir/subdir/dbName.gdb"
>
> fbwds.setUser(userName);
>
> fbwds.setPassword(password);
>
> fbwds.setIdleTimeoutMinutes(30);
>
> fbwds.setPooling(true);
>
> fbwds.setMinSize(5);
>
> fbwds.setMaxSize(20);
>
> }
>
> try
>
> {
>
> c = fbwds.getConnection();
>
> }
>
> catch (SQLException e)
>
> {
>
> System.out.println("getting new fbwds connection failed! Error:
> "+e+"\n");
>
> }
>
> Hope this helps.
>
>
>
> Rick
>
>
>

--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone 707.766.9509
Fax 707.766.8989
http://www.obsidian-studios.com