Re: Possible JDBC installation or usage problem in OS X



barry_normal wrote:
So should I just alter that same file to include the following?

CLASSPATH="/usr/mysql-connector-java-3.1.14/mysql- connector-java-3.1.14-bin.jar" export CLASSPATH


Well, I tried googling but just couldn't find an explanation which
was more specific than just 'edit the file' not what to put in it.

I'm not familiar with OS X but since it is allegedly partly BSD based I am sure you can persuade it to open a command shell and pretend it's Unix.

In which case something like this will work:

# MYSQLDIR=/usr/mysql-connector-java-3.1.14
# CLASSPATH=$MYSQLDIR/mysql-connector-java-3.1.14-bin.jar
# export CLASSPATH
# java myapp

(I only introduced MYSQLDIR to keep line lengths short for newsgroups)


Also, I wasn't sure if it could be some slight syntactical difference
which OS X exhibits in this department. All the instructions seem to
assume a Windows machine.

The instructions for generic unix may be usable on OS X.

I did try putting the text in as above but that didn't have any
effect. Still getting the same message so I was unclear as to whether
it needed some other info in there or something I've no clue about at
all.

OK. Your original merror essage was
SQLException: No suitable driver

I'm not familiar with MySQL but you might like to double check this line in your code:

String conStr = "jdbc:mysql://http://mywebsite.net/myDatabase";;

The "http://"; bit looks suspicious to me. I'd guess at

String conStr = "jdbc:mysql://servername.eg.net:3306/myDatabase/";

Note the trailing slash!

Servername.eg.net is the name of the server and 3306 is whatever port MySQL is configured for (I guess the default might be 3306?)

The next step is for you to write a 10-20 line Java program that simply attempts to open a connection and close it again. If it doesn't work post the whole Small Self-Contained/complete Compilable Example program here.

I imagine MySQL includes such an example.
.


Quantcast