hai,
i am trying to connect from applet to mysql database.for that i am using mm.mysql.jdbc-1.2c driver .i put the driver's jar file mysql_jar in public_html file.
my class file is also there in public_html.i set the archive parameter in html file.
this entire thing works on local mechine i.e means when i put in local directory(c drive)and access from browser.but it is not working when i put on java webserver.
please help me.
code is given below.
public void connectDBase()
{
String sHost = getCodeBase().getHost();
try{
Class.forName("org.gjt.mm.mysql.Driver".newInstance();
}
catch(Exception e)
{
System.out.println(e.toString());
}
try{
con = DriverManager.getConnection("jdbc:mysql://"+sHost+"/dbname"
}catch(Exception e){
System.out.println(e.toString());
}
}
and html file is
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.3 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = "300" HEIGHT = "100" NAME = "timer" codebase="<PARAM NAME = CODE VALUE = "p1.TimerApplet" >
<PARAM NAME = ARCHIVE VALUE = "mysql_comp.jar" >
<PARAM NAME = NAME VALUE = "timer" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="false">
<PARAM NAME = username VALUE =player_name>
<COMMENT>
<EMBED type="application/x-java-applet;version=1.3" CODE = "p1.TimerApplet" ARCHIVE = "mysql_comp.jar" NAME = "timer" WIDTH = "300" HEIGHT = "100" username = player_name scriptable=false pluginspage="
</NOEMBED></EMBED>
</OBJECT>
<!--
<APPLET CODE = "p1.TimerApplet" ARCHIVE = "mysql_comp.jar" WIDTH = "300" HEIGHT = "100" NAME = "timer">
<PARAM NAME = username VALUE =player_name>
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</BODY>
</HTML>
thank you
i am trying to connect from applet to mysql database.for that i am using mm.mysql.jdbc-1.2c driver .i put the driver's jar file mysql_jar in public_html file.
my class file is also there in public_html.i set the archive parameter in html file.
this entire thing works on local mechine i.e means when i put in local directory(c drive)and access from browser.but it is not working when i put on java webserver.
please help me.
code is given below.
public void connectDBase()
{
String sHost = getCodeBase().getHost();
try{
Class.forName("org.gjt.mm.mysql.Driver".newInstance();
}
catch(Exception e)
{
System.out.println(e.toString());
}
try{
con = DriverManager.getConnection("jdbc:mysql://"+sHost+"/dbname"
}catch(Exception e){
System.out.println(e.toString());
}
}
and html file is
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.3 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = "300" HEIGHT = "100" NAME = "timer" codebase="<PARAM NAME = CODE VALUE = "p1.TimerApplet" >
<PARAM NAME = ARCHIVE VALUE = "mysql_comp.jar" >
<PARAM NAME = NAME VALUE = "timer" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="false">
<PARAM NAME = username VALUE =player_name>
<COMMENT>
<EMBED type="application/x-java-applet;version=1.3" CODE = "p1.TimerApplet" ARCHIVE = "mysql_comp.jar" NAME = "timer" WIDTH = "300" HEIGHT = "100" username = player_name scriptable=false pluginspage="
</NOEMBED></EMBED>
</OBJECT>
<!--
<APPLET CODE = "p1.TimerApplet" ARCHIVE = "mysql_comp.jar" WIDTH = "300" HEIGHT = "100" NAME = "timer">
<PARAM NAME = username VALUE =player_name>
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</BODY>
</HTML>
thank you