Help !!!

N

Neil Bisby

Hi

I wondered if you could throw some light on a problem I am having.

I have written some code to access a mysql database (shown below). It
runs fine on the Forte development environment with the mysql.jar file
alongside the applet, however, when I copy the files to a web server,
it does not work. I am not sure waht is wrong, but everything I have
read, indicates that it should work.

If this is the wrong group for this question, and I should be posting
it elsewhere, please let me know and I will use that group instead.

Enjoy

Neil

Connection con = null;
// Load class
try
{
// Package "com.mysql.jdbc.Driver"
Class.forName("com.mysql.jdbc.Driver").newInstance();
label1.setText( "SQL Driver loaded sucessfully");
}
catch (java.lang.Exception e)
{
String sqlError = new String("SQL Class.forName Failed - "
+ e.getMessage());
label1.setText(sqlError);
}
try
{
con = DriverManager.getConnection(url, "root", "");
//con = DriverManager.getConnection(url, "root", "");
label2.setText("Got Connection");
// Create a statement
stmt = con.createStatement();
// Issue a query
rs = stmt.executeQuery("select * from org");
while (rs.next())
{
sResult += rs.getString("orgname") + ">>> ";
}
// Put the result in a label
label2.setText(sResult);
}
catch (java.sql.SQLException e)
{
label2.setText(e.getMessage());
}

if (con != null)
{
try
{
con.close();
label3.setText("Connection Opend and Closed");
}
catch (Exception e)
{
label3.setText(e.getMessage());
}
}
 
L

Lothar Kimmeringer

I have written some code to access a mysql database (shown below). It
runs fine on the Forte development environment with the mysql.jar file
alongside the applet, however, when I copy the files to a web server,
it does not work. I am not sure waht is wrong, but everything I have
read, indicates that it should work.

Without more information, I can only guess that the database-
server is different from the server, the applet is loaded from.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top