gentoo +jdbc errors with sun examples?
hello all im trying to get this bloomin jdbc example from the sun website working but all i get is a load of errors, do you know what could be causing this and how to solve it? please also i am on a very tight schedule cheers.
the sun example: Code:
package JDBC.IncertionClass; Code:
SQL Error: Communications link failure due to underlying exception: |
-------
Updated ------- I left the original message below just for memory. In fact, after checking the error code corresponding to the sqlstate, it comes out its a socket error. I just came accross the following page in the mysql doc: http://dev.mysql.com/doc/refman/5.0/en/cj-faq.html From what you will read there, jdbc driver for mysql needs to connect over the network and cannot use a socket connection. So you need to make sure network is enabled for your mysql server and you should connect to 127.0.0.1 (or localhost.localdomain) instead of localhost. You will probably have to add some grants as well. All is explained on the above link. Good luck ---- Original message ---- Well, the exception message pretty much says it all: "connection refused". 1- check that the mysql server is running 2- if it is, check it is accepting connection on a socket (and not only on network) 3- if it is accepting socket connections, see if it accepts anonymous connections on the "test" database. 4- if it does not accept anonymous connections, add a login/pass to the line: Connection connection = DriverManager.getConnection(url, "login", "password"); Good luck |
cheers, nice signature btw!!
|
do you have the mysql jar in your classpath?
|
yea you have to emerge jdbc-mysql otherwise it says invalid driver path or something, cheers trscookie.
|
All times are GMT -5. The time now is 02:55 AM. |