#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    SLC, UT, USA
    Posts
    47
    Rep Power
    15
    I've gotten JServ installed with Apache on a Unix box and I've been playing around with some servlets. Now I want to tie in to some MySQL and Oracle databases. I've already got PHP accessing the MySQL databases without JDBC. Is there a ./configure option to add support for MySQL or Oracle when building JServ? Or do I need a JDBC driver on my Unix box to make it work. If so can someone recommend a JDBC driver for Solaris?

    I need of a clue,

    Robman

    Comments on this post

    • JimmyGosling agrees
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    SLC, UT, USA
    Posts
    47
    Rep Power
    15
    OK I've got everything working just not all working together. I've installed the MM.MySQL JDBC driver and I can get to the MySQL database from the command line by running "java servletname" but my servlet tells me it couldn't connect to the database when I run it from the browser. It's giving me the "No Suitable Driver" error which apparently means that the driver isn't being loaded.

    Hold on there's a tutorial here at Devshed that looks like it may have what I need.

    Robman
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    1
    Rep Power
    0
    Move the mm.Mysql drivers to classes directory of Apache Jserv or add the path in zope.properties file.

    I've a different problem, whenever I post details from a form thru servlets into Mysql database, the data goes in as Null. The solution I got is to use Prepared Statement of Java. I've tried that but in vain. If any one has an example of data being posted into Mysql database using servlets please share it with me.

    Thanx.

    Seshan.

    Comments on this post

    • BaronVonDoppleG agrees
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    SLC, UT, USA
    Posts
    47
    Rep Power
    15
    Thanks Seshan,

    I added the directories to the CLASSPATH in the jserv.properties file and I've since got the driver loading but I still cannot get a connection. Are you saying I need to add the CLASSPATH in the zone.properties file as well?

    Here is a more detailed description of the situation as I posted on Sun's Java discussion list.

    "This is my setup/configuration:
    Sun UltraSparc 2
    Solaris 7
    Apache 1.3.12 with JServ
    ApacheJserv 1.1
    JSDK2.0
    java1.2
    jdk1.2.2 mm.mysql.jdbc-1.2c (was using b but just switched thinking maybe it would fix it)

    I'm fairly new to Java and servlets. So I've been working with some of the demo apps and servlets available from Sun, here and other sites on the net. Applications seem to load the driver and connect with no problems but servlets either don't load the driver (I've checked for it with a DriverManager.getDrivers() call and then iterate through the enumeration) or the connection is null. The driver is loaded on the first instantiation (call to the servlet) but if I refresh the browser it disappears. Isn't it supposed to persist once loaded? At first I didn't RTFM so I hadn't put the driver directory in the jserv.properties file. Once I did that the driver started showing up but the connection is always null. I've also tried putting my servers IP number in instead of localhost but then apache returned an internal server error problem. Seems to work sortof with localhost or *."

    I've since determined that the driver is staying loaded but the connection isn't connecting.

    Robman

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    SLC, UT, USA
    Posts
    47
    Rep Power
    15
    OK I figured it out. The example I was using showed something like:

    Connection dbConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_name?username=nobody");

    so that was what I put in. What it should be is
    Connection dbConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/error_report?nobody");

    Could have sworn I tried that but perhaps had something else wrong somewhere. Or perhaps the network gods smiled upon me. Anyway I'm off and running. Extracting data but will soon be trying to post data to the database.

    More to follow or perhaps we should start a new thread on posting data into mysql.

    Robman.

IMN logo majestic logo threadwatch logo seochat tools logo