Need help to connect to a database on a web server
Posted by: Ryan Lee
Date: October 08, 2009 10:11AM

Firstly, I need to login to the server using a SSH client

Server: myAccountName@abc.no-ip.org
password to login to the server: abc123

port: 4321
database name: db123

To start a mysql client, I need to type the cmd:
./mysql/bin/mysql --defaults-file=$HOME/mysql/my.cnf -u aSQLUsername -p123456

Then I can create new databases/ tables/ execute query...etc

But now I want to write a Java program to access the database.
I've download 'mysql-connector-java-5.1.10.tar.gz' and extracted the files
and I've set the CLASSPATH

And I don't know what parameters should I put in getConnection() in my Java Program,

I've tried:
conn = DriverManager.getConnection("jdbc:mysql://myAccountName@abc.no-ip.org:4321/db123", "aSQLUsername", "123456");

BUT the Java program output something like --

SQLException: No suitable driver found for jdbc:mysql://myAccountName@abc.no-ip.org:4321/db123
SQLState: 08001
VendorError: 0

Do I need to enter the password of the server(abc123)? OR
Do I need to specific the location of the file 'my.cnf'?

Thanks for help.

Options: ReplyQuote


Subject
Written By
Posted
Need help to connect to a database on a web server
October 08, 2009 10:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.