• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

tomcat on windows and database on linux

 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right now we have 2 Win2K boxes for our web server and database server. We're thinking about moving our database to a Linux machine, and we're wondering if it should be a piece of cake to find the DSN or if we might have trouble getting our Tomcat on the Windows box to find the database on the Linux box. Thanks...
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use ODBC, perhaps.
For JDBC, you don't need DSN at all, I guess, but servername,port,database or ip,port,database.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The db has no driver for JDBC, so we have to reach it over ODBC.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're planning on using the JDBC-ODBC bridge, DON'T!

A, it's not a very high performance interface (though tht may not be an issue)

B, it's not Thread-Safe. A web server using this channel to do database updates risks corruption of the database.

Just about all the major and many minor DBMS's have at least one JDBC driver available to them. The only exceptions I know of are MS-Access and MS-FoxPro. Neither of those 2 products was designed with multithreaded access in mind anyway. There's no master server program to co-ordinate concurrent requests, so the only protection they have against data corruption is whatever filesystem locking they choose to take advantage of.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whoa, I've never heard of this! I mean, I knew that folks in the Java community highly encouraged using a type 4 JDBC driver when available, but I didn't know the bridge was that bad. We've been using it for well over a year with our web app because this vendor supposedly only has an ODBC driver. The whole reason we're moving our db server to a Linux box is because they finally admitted that the Windows version of their ODBC driver has always had problems. We often have to restart Tomcat and/or the ODBC driver to get our web app talking to the database again, and this can sometimes happen several times during the day. I'm not sure if this is considered a heavy load for a single pair of servers (web server and db server), but our web app has about 2000+ concurrent users at peak times at various points throughout the day.

However, my question is--do you think it's the JDBC-ODBC bridge that's causing these problems? I was new at this when I got here, but the original developer who is no longer with us was always convinced it was their driver, not our textbook connection pooling code or anything like that (I heard he even dropped in the Apache group's connection pooling package in place of his to make sure). However, if Sun's bridge is actually the problem...that would be very interesting. What do you think?
[ August 12, 2004: Message edited by: Stephen Huey ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think by moving to linux you might think of moving to another database too.
I don't know how much vendor-specific functions you rely on, but if possible I would move to postgresql, oracle, ...
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephen Huey:

However, my question is--do you think it's the JDBC-ODBC bridge that's causing these problems?

While that's a possibility, it's hard to tell without more information. Given that your database vendor admits to a problem, it could be the database - I'd second Stefan's recommendation to look into PostgreSQL (free) or Oracle (not free). You could also look into Resin (inexpensive) instead of Tomcat as your JSP server; last I checked, Resin was a little more solid in things like connection pooling. Or it could be that some page in your own code doesn't properly release database connections. It could be more than one of these things.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JDBC-ODBC bridge was AFAIK never intended for heavy-duty production work, only as a conduit for working with legacy databases and an aid to helping people get familiar with JDBC.

If you have problems with your ODBC driver, expect to have at least that many problems using the JDBC-ODBC bridge, because it's exactly what its name implies: something that translates JDBC calls into ODBC calls and end up calling your same old flakey ODBC driver.

Tomcat supports pluggable database connection pools. By default, it uses the Apache DBCP pooler, but others can be/have been used. DBCP, BTW has a convenient option where you can make it indicate connection leaks. It synthesises an exception (in order to capture a stack trace) when the connection is drawn from the pool, and prints the exception's stack trace if the connection doesn't get returned. I believe you'll find the details in the Tomcat docs.
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic