Question: JDBC connection to mySQL database from MapleNet

I am trying to establish communication with a mySQL database from a maplet provided over the Internet.

It's my understanding that the classpath for the JDBC must reside on the same filesystem as the maplet.

When I test my maplet on any of my computers (all Windows) I have not problem. Because I know exactly where the JAR file is located the following LoadDriver command works:

  JDBC_MySQLdriver:=LoadDriver('driver'="com.mysql.jdbc.Driver",
    'classpath' = "C:\\Documents and Settings/Doug/Desktop/mysql-connector-java-5.1.13-bin.jar");

But, if I put this maplet on one of my websites for others to download, then this path will be meaningless for other users - and even if the path were somehow valid, there is no guarantee they have the right JAR file in this location.

If I serve the maplet with my MapleNet server, then I am (in principle) back in the first case. I can put the JAR file almost anywhere on the MapleNet server. A natural place seems to be in /root/maplenet/jar/. This would mean the following should work:

  JDBC_MySQLdriver:=LoadDriver('driver'="com.mysql.jdbc.Driver",
    'classpath' = "/root/maplenet/jar/mysql-connector-java-5.1.13-bin.jar");

Alas, this is not successful, complaining that the driver com.mysql.jdbc.Driver cannot be found. In case it matters, the MapleNet server is running under Linux and the other setups are different varieties of Windows.

Can anyone give me some pointers on how to make this work? In particular,

  1. is it possible to allow users to use a remotely served JAR file?
    Maybe with a reference to the file given along the lines of
    'classpath'="http://maple.math.sc.edu:80/maplenet/jar/mysql-connector-java-5.1.13-bin.jar"
  2. What is the correct syntax to specify the classpath on a Linux system that includes a MapleNet server?
  3. Can I put the JAR file in the CLASSPATH environment variable on the MapleNet server (in /etc/profile)?

The mySQL database is on a completely separate website. This is not a problem when I attempt to connect using a local copy of Maple and the JAR file, so I expect it should not be a problem when trying to establish a connection from the MapleNet server.

Any help will be most appreciated. Let me know if you need any more information, or have other questions.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
Please Wait...