Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Jun 2004

    Default Java/JSP/Servlet Connect To MySQL database

    I just use west host service recently.

    I want to run a jsp/java/servlet application in tomcat connected to a MySql db.

    Current status:
    java/jsp/servlet work fine.
    mysql db works fine.
    but I cannot let them connect to each other.

    I tried to place mysql-connector-java......jar file into /var/tomcat4/common/lib, then restart the virtual server of westhost,
    but my program still not run.

    What I have set:
    driverName = "com.mysql.jdbc.Driver";
    dbURL = "jdbc:mysql://"

    Where should I place the mysql connector jar file in tomcat4.
    What dbURL should I use.

    If possible, please help.
    Many thanks in advance.



  2. #2
    Junior Member
    Join Date
    Jul 2004

    Default JDBC connection.


    Well this should make it work. (maybe)

    Set MySQL to use the TCP/IP option (WARNING: Security issue)
    Then make your connection use the IP address of your domain, or the domain name (not, Port# is optional.

    I would recommend updating your mysql tables of db, host, and user, to only allow from your 3 known servers (localhost, <domain name>, <domain ip>). Do not know if this will work on anything less than a Value package (value is the last one with static IP).

    Now backup your /etc/my.cnf file somewhere (maybe /etc/my.old.cnf)
    then remove the [client] section, remove in the [mysqld] section port, user, and bind-address lines. Then save it. Kill your sql server (both the safe-mysqld, and the first process of the mysqld processes)
    Maybe /etc/rc.d/init.d/mysqld restart will do the trick.

    the start the mysqld server (unless you tried the restart option) /etc/rc.d/init.d/mysqld start.

    Seems to do the trick..... YMMV.


Similar Threads

  1. Replies: 3
    Last Post: 09-13-2007, 12:10 PM
  2. Replies: 16
    Last Post: 05-10-2006, 07:29 PM
  3. PHP connect to MySQL database
    By robert6040 in forum PHP / MySQL
    Replies: 2
    Last Post: 08-17-2005, 02:49 PM
  4. Replies: 3
    Last Post: 04-08-2005, 06:02 AM
  5. Can't connect to MySQL database.. Newbie!
    By jhmisa in forum PHP / MySQL
    Replies: 3
    Last Post: 05-20-2004, 10:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts