java and mysql on FreeBSD
Maria Dolores Moral
yoyes at dif.um.es
Wed Aug 13 03:47:24 PDT 2003
Please, if you can help me :-(
I do not know anywhere where I can ask this question
I am working with java and mysql on FreeBSD 4.7
I have had a lot of problem with the java connection with mysql, but I do not
if a FreeBSD problem or mysql problem ??
When I compile my java program I obtain:
localhost# ./Server
Exception: java.sql.SQLException: Server configuration denies access to data
source
java.sql.SQLException: Server configuration denies access to data source
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:399)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562)
at com.mysql.jdbc.Connection.<init>(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
at java.sql.DriverManager.getConnection(DriverManager.java:450)
at java.sql.DriverManager.getConnection(DriverManager.java:130)
at Server.obtainPK(Server.java:45)
at Server.main(Server.java:145)
I use for compiling:
javac -classpath
/usr/ports/databases/mysql-java-3.0.8/mysql-connector-java-3.0.8-stable-bin.jar:.
Server.java
java -classpath
/usr/ports/databases/mysql-java-3.0.8/mysql-connector-java-3.0.8-stable-bin.jar:.
Server
/***************************************
And my program is:
/**********************/
/* Server.java */
/**********************/
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import org.gjt.mm.mysql.Driver;
import java.sql.*;
public static void main(String[] args) throws IOException{
...
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/Server:3306","testuser","");
}
catch (Exception E) {
System.err.println("Unable to load driver.");
E.printStackTrace();
}
...
}
/***************************************
But whe I execute mysql I can see the database and the table.
You can see it:
localhost# mysql -u testuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 3.23.52
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use Server
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+------------------+
| Tables_in_Server |
+------------------+
| Certificate |
+------------------+
1 row in set (0.00 sec)
Thanks a lot
More information about the freebsd-net
mailing list