[HELP] aglet using mysql-connector-java-5.1.14

scifo anggy yudianto <[email protected]> Thu, 28 Apr 2011 03:01:07 -0700
Newsgroups gmane.comp.db.mysql.java
Message-ID <[email protected]>
--001636d34a2bd5fdde04a1f7a2e8
Content-Type: text/plain; charset=ISO-8859-1

hi all, iam developing mobile agent using aglet 2.0.2 and
mysql-connector-java-5.1.14 to connect database mysql.
i was create simple code to insert some data to database.
then i compile it and its work, but when i running with tahiti server there
is error and no data insert to my database.
anyone know the problem??

regards,
scifo

*this is error message in console:*

database failure: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The
driv er has not received any packets from the server.


*this is source code :*

 public void run() {
    System.out.println("Tampil no pencarian");
    String mysqldriver = "com.mysql.jdbc.Driver";
    Connection conn = null;
    Statement st = null;
    ResultSet rset = null;
    String sqlQuery = "INSERT INTO `cobadb`.`customer` (`nama` ,`alamat`
,`umur` ,`email` ,`telepon`) VALUES ( 'dudul', 'tegal', '21', '
[email protected]', '12234567')";

    try
    {
        Class.forName(mysqldriver);    // koneksi driver database

        conn =
DriverManager.getConnection("jdbc:mysql://localhost/cobadb","root","scifoanggi");
// koneksi ke mySQL
        st = conn.createStatement();
        rset = st.executeUpdate(sqlQuery);    // ekseskusi quey SQL
    }

    catch(ClassNotFoundException e) {
        System.err.println("drive failure: " + e.getMessage());
    }
    catch (SQLException e)
    {
        System.err.println("database failure: "+ e.getMessage());
    }

    finally {
        try
        {    if (rset !=null) rset.close();    }
        catch (SQLException sqle) {}

        try
        {   if (st != null ) st.close();    }
        catch (SQLException sqle) {}

        try
        {   if (conn != null ) conn.close();    }
        catch (SQLException sqle) {}
    }
 }

--001636d34a2bd5fdde04a1f7a2e8--