This week's book giveaway is in the Security forum.
We're giving away four copies of Penetration Testing Basics and have Ric Messier on-line!
See this thread for details.
Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please I urgently need help

Dan Dales
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Am trying to query mysql data base using an aglet.
At compilation, there is no error but each time load it to tahiti server
the error below keep coming up at the console.

Please can some one help me out. Time is no longer on my side.

I need it to work so that I can move on with my project

Thanks in anticipation.

The code is as follows:
package aglettest;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;

public class ContTest extends Aglet{

//static String url = "jdbc:mysql://localhost:3306/pos?user=root&password=daniel";
static String driver = "";
static String user = "root";
static String pw = "daniel";
static Statement stmt;
static Connection con;

// public Engine() {

//Establish connection to database
public static Statement getConnected() {
try {
try {
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pos?user=root&password=daniel");
stmt = con.createStatement();
} catch (SQLException ex) {
//JOptionPane.showMessageDialog(null, "Problem loading driver\n" + ex.getMessage());
System.out.println("Problem loading driver\n" + ex.getMessage());
} catch (Exception ex2) {
JOptionPane.showMessageDialog(null, "Problem establishing connection\n" + ex2.getMessage());

return stmt;

public void onCreation(Object o){
String role;

String st="SELECT * FROM `role`";

stmt = getConnected();
try {
ResultSet rs = stmt.executeQuery(st);

while ( {
role = rs.getString("role");

}catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Problem executing Query\n" + ex.getMessage());


The error message that keep coming up is:
Problem loading driver
Unable to connect to any hosts due to exception: java.
security.AccessControlException: access denied ( 127.0.
0.1:3306 connect,resolve)

MESSAGE: access denied (
mission connect,resolve)

STACKTRACE: access denied (j connect,resolve)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
at com.mysql.jdbc.MysqlIO.<init>(
at com.mysql.jdbc.Connection.createNewIO(
at com.mysql.jdbc.Connection.<init>(
at com.mysql.jdbc.NonRegisteringDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at aglettest.ContTest.getConnected(
at aglettest.ContTest.onCreation(
at Source)
at Source)


at aglettest.ContTest.onCreation(
at Source)
at Source)
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic