I am total beginner in Flash CS3 and have some problems with my code.
This is my Flash code:
function vpisi() {
myClass = function()
{
this.stranka = "abc";
this.referent = "def";
this.datumInCas = "2008-09-11 12:00";
this.vsebina = "moj chat...";
}
//Register the class definition
Object.registerClass("chatClass", myClass);
netServices.setDefaultGatewayUrl("http://localhost:9081/VideoChat/
gateway");
var gatewayConn = Netservices.createGatewayConnection();
var service = gatewayConn.getService("videoChat.Chat", this);
service.vpisiVBazo(new chatClass());
}
And this is my Java code:
package videoChat;
import flashgateway.io.ASObject;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class Chat {
public void vpisiVBazo(ASObject as) {
System.out.println("Test Java");
String stranka = (String)as.get("stranka");
String referent = (String)as.get("referent");
String datumInCas = (String)as.get("datumInCas");
String vsebina = (String)as.get("vsebina");
// povezovanje na bazo MySQL
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://
localhost/db_chat?user=root&password=p");
Statement stmt = conn.createStatement();
int i = stmt.executeUpdate("INSERT INTO tbl_chat VALUES ('" +
stranka + "', '" + referent + "', '" + datumInCas + "', '" + vsebina +
"')");
stmt.close();
conn.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
When I go through code with debug movie, program doesn't show any
problems with code. Program execution enters vpisi() and exits at last
line without reporting any problems, even if I replace gateway address
with "blahblah". I always save and publish my code. Also, I am sure
that function vpisi() is being called. Why there is no any exception
during program execution? Please help.
Marko