File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes please I urgently need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "please I urgently need help" Watch "please I urgently need help" New topic

please I urgently need help

Dan Dales

Joined: Jul 20, 2011
Posts: 8
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)
I agree. Here's the link:
subject: please I urgently need help
It's not a secret anymore!