Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems connecting to a remote database from a Java desktop application
    primarykey
    data
    text
    <p>I have a desktop Java application, provided via Web Start, that I need to modify to add some authentication capabilities. We have a MySQL database for our website that hosts the authentication details that I need to connect to in order to verify that the user has a current subscription to the software. I understand it's not popular to be coding user authentication, but that's the framework I have to fit in to.</p> <p><strong>Issue 1:</strong></p> <p>So the first step was to try using the MySQL Connector/J to connect to the database, submit a query and process the result. This works brilliantly in Eclipse, but as soon as it is built and run from the JNLP file outwith the IDE it doesn't work. I get the following error in the console:</p> <pre><code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) </code></pre> <p>the error is caught at the code below:</p> <pre><code>Class.forName("com.mysql.jdbc.Driver"); </code></pre> <p>I have configured the project build path in Eclipse to include the MySQl connector jar file, it is in the CLASSPATH environment variable, and it is included as an external jar in the JNLP configuration. So I think I have covered all the usual bases, but still no luck.</p> <p><strong>Issue 2:</strong></p> <p>To get around issue 1, I decided to create a web service in PHP using nuSoap and consuming that service from within my application. Building the web service was straightforward, but figuring out how to consume it in my application is turning out to be much more difficult. Bearing in mind that I don't have anything like tomcat or glassfish, I'm struggling to figure out exactly how to submit a value to the web service and handle a response. It's a very simple web service - it submits a user ID, and gets a return value to indicate whether the user has a valid subscription. Any suggestions would be much appreciated, even if it's a better method of getting the result I need!!</p> <p>Thanks, Alan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload