hi,
I use an applet as a client to get mysql data in my linux server( apache and mysql in the same pc), in my local lan, the result is fine, but failed in the dial-up method ( outside my local lan), only empty chartpanel shows ..
JAVA shows the warning below:
Cannot connect to MySQL server on 61.xxx.xxx.xxx:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (java.net.ConnectException)
why? local lan works, but outside local lan fail.......
code -------------------------------------------------------------------------------
public class JChartApplet extends JApplet {
// Constructs the applet
public JChartApplet() {
JDBCXYDataset data = null;
// Connect to the MySql database
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://xx.xx.xx.xx/data";
Connection con = DriverManager.getConnection(url, "root", "3687");
data = new JDBCXYDataset(con);
data.executeQuery("Select ptime, last, reg, (reg+ser*2) AS high, (reg-ser*2) AS low from MTXK3Clt0509");
con.close();
}
catch (Exception e) {
System.err.println(e.getMessage());
}
JFreeChart chart1 = ChartFactory.createTimeSeriesChart("MTX Graph", "Time", "MTX", data, true, true, false);
ChartPanel panel1 = new ChartPanel(chart1);
getContentPane().add(panel1);
}
}
------------------------------------------------------------------------------
jdbc mysql connection
-
- Posts: 26
- Joined: Fri May 09, 2003 4:55 am
- Location: Tasmania, Australia
- Contact:
RE : jdbc mysql connection
Tau
Have you tested your mysql connection from your dialup connection?
That is can you run a simple connection without JFreeChart?
Have you tested your mysql connection from your dialup connection?
That is can you run a simple connection without JFreeChart?
Bryan
Application also failed
I wrote a Borland8-made jdbe-mysql database application, without JfreeChat, only text query function, I got the same result, the querys work
in my local lan pcs, (I try on 2 pcs with winXP, 1 notebook with win98), but till I change one pc's connection method in dial-up ( also I asked my friend to tried for me, he use Adsl in his company), failed, what on earth the problem is!!! jdbc-mysql applet and application only can work on my local lan, or it is the firwall issue on JAVA made application???
in my local lan pcs, (I try on 2 pcs with winXP, 1 notebook with win98), but till I change one pc's connection method in dial-up ( also I asked my friend to tried for me, he use Adsl in his company), failed, what on earth the problem is!!! jdbc-mysql applet and application only can work on my local lan, or it is the firwall issue on JAVA made application???
-
- Posts: 26
- Joined: Fri May 09, 2003 4:55 am
- Location: Tasmania, Australia
- Contact: