[prev in list] [next in list] [prev in thread] [next in thread] 

List:       msql
Subject:    [mSQL] MsqlJava applet can't run !
From:       "Vu Quoc HUNG" <hung () vsb ! cz>
Date:       1996-08-30 15:25:55
[Download RAW message or body]

Hi every body,

I use MsqlJava-1.1.3 to access msql database named "nobody" as user
"test", to write some things from "phone" table. The application followed
can run, but when I try write the same thing in applet, the applet can't
run. I don't know where the error is. I hope, someone of you, who has
experiences with MsqlJava-1.1.3 can help me.

Here is application code:
// Demo app from MsqlJava-1.1.3
import java.awt.*;
import java.lang.*;
import msql.*;

public class Test extends java.applet.Applet {

	public static void main(String[] args) {

		Test d = new Test();
	}

	public Test() {

		Msql msql;

		try {
			msql = new Msql();
			msql.Connect("sun.vsb.cz", "nobody");

			String dbName[] = msql.ListDBs();

			System.out.println("Databases");
			for(int i=0; i<dbName.length; i++)
				System.out.println("\t"+dbName[i]);

			msql.SelectDB("test");

			String tableName[] = msql.ListTables();

			System.out.println("Tables in phone");
			for(int i=0; i<tableName.length; i++)
				System.out.println("\t"+tableName[i]);

			MsqlFieldDesc fieldDesc[] = msql.ListFields("phone");

			System.out.println("Fields in phone");
			for(int i=0; i<fieldDesc.length; i++)
				System.out.println(fieldDesc[i].toString());

			MsqlResult result = msql.Query("select * from phone ");
			
			String row[];

			while((row = result.FetchRow()) != null) {
				for(int i=0; i<row.length; i++)
					System.out.print("\t"+row[i]);
				System.out.println();
			}

			MsqlFieldDesc field;
			while((field = result.FetchField()) != null) 
				System.out.println(field.toString());

			fieldDesc = result.ListFields();
			System.out.println("Fields in phone");
			for(int i=0; i<fieldDesc.length; i++)
				System.out.println(fieldDesc[i].toString());


			msql.Close();
		} catch(MsqlException e) {
			System.out.println(e.getMessage());
		}
	}
}

Here is code for applet, I can't run it in Netscape, and Netscape no send to
me any message.

        import java.awt.*;
        import java.lang.*;
	import msql.*;
        public class test extends java.applet.Applet {

                public test() {

                        Msql msql;
                        MsqlResult result;

                        try {
                                msql = new Msql();

				try {
                                msql.Connect(
                                        "sun.vsb.cz",
                                        "nobody",
                                        true
                                );
				}
				catch(MsqlException e) {
					// System.out.println("Can't connect db");
					showStatus("Can't connect db");
				}

                                msql.SelectDB("test");

                                result = msql.Query(
                                        "select * from phone"
                                );

                                String row[];
                                int rows = result.NumRows();
                                int cols = result.NumFields();

                                while((row = result.FetchRow()) != null) {
                                        for(int i=0; i < cols; i++)
                                                System.out.println(row[i]);
                                        System.out.println();
                                }

                                msql.Close();
                        } catch(MsqlException e) {
                                System.out.println("Oops: "+e.getMessage());
                        }
                }
        }

mSQL Version Details :-

	msqladmin version 	1.0.16
	mSQL connection 	Localhost via UNIX socket
	mSQL server version 	1.0.16
	mSQL protocol version 	6
	mSQL TCP socket 	1112
	mSQL UNIX socket 	/dev/msql
	mSQL root user 		root
	Host Architecture	Solaris-2.4-Sparc
msql.acl file:
#
# Access control for mSQL
#
# Entries are of the form
#

database=test
read=hung,root,nobody
write=hung,root
host=*
access=local,remote

database=nobody
read=hung,root,nobody
write=hung,root
host=*
access=local,remote

Thank you for any idea.
								Hung.

================================================================================
	Ing. Vu Quoc HUNG       Technical university of Ostrava. 

private:			office:
	Kolej VSB - E337	VSB-TU, centrum vypocetni techniky.
	Ostrava - Poruba	phone: (0042) (069) 699 3479
	70833 - Czech republic.
	E-mail : hung@vsb.cz


--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to msql-list-request@bunyip.com.  Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic