Applet to database error
Hi...
I had an application where i need to connect to the database for the values to display in the applet....
Following is a part of that...
The code works fine in the local system..
but when its not working over the net..
When i placed this in the server,
The local system is displaying null values as the result...
<code>
public class circuit extends Applet implements MouseListener{
boolean rect1Clicked,rect1Clicked1,mouseEntered;
RTextLine text = new RTextLine();
Connection con=null;
Statement stmt,stmt1,stmt3;
ResultSet rs,rs2;
String str1,str2,str3,str4,s1,str5,str6;
public void init(){
setBackground(Color.black);
addMouseListener(this);
text.setDrawingComponent(this);
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb","username","password";);
stmt=con.createStatement();
stmt1=con.createStatement();
stmt3=con.createStatement();
}
catch(Exception e){
e.printStackTrace();
}
}
public void mouseClicked (MouseEvent me) {
int xpos= me.getX();
int ypos= me.getY();
if(xpos>=25 && xpos<=35 && ypos>=540 && ypos<=645)
{
s1="Feeder";
rect1Clicked=true;
}
else
rect1Clicked = false;
res(s1);
repaint();
}
public void paint(Graphics g) {
....Some Painting Lines Code Here....
if (rect1Clicked)
{
g.setColor(Color.red);
g.drawString("("+str1+", ",80,690);
...Some Painting Lines Code Here...
}
public void res(String s) {
try{
str1=null;;
String mid=null;
ResultSet rs3=stmt3.executeQuery("select mid from table1 where lname='"+s+"';");
if(rs3.next()){
mid=rs3.getString("mid");
}
ResultSet rs = stmt1.executeQuery("select Frequency,RPhaseVoltage,ActivePower from mydb.instantaneousdata where meterid='"+meterid+"';");
rs2 = stmt.executeQuery("SELECT ActiveExportTotal,StartDate,StartTime FROM mydb.energysnapshotdata where mid='"+mid+"';");
while(rs.next()){
str1 = rs.getString("Frequency");
str2 = rs.getString("RPhaseVoltage");
str3= rs.getString("ActivePower");
}
while(rs2.next())
{
str4=rs2.getString("ActiveExportTotal");
str5= rs2.getString("StartDate");
str6= rs2.getString("StartTime");
}
}
catch(Exception e){
}
}
}
</code>
This is my code....
There r some code left which i didn't included in the above code...as it is a very large code which isn't necessary for finding the error...
as itz only drawing strings or lines...
PLs help..
thanx in advance
View Answers
Related Tutorials/Questions & Answers:
Applet to database error - AppletApplet to
database error Hi...
I had an application where i need to connect to the
database for the values to display in the
applet....
Following...
Applet implements MouseListener{
boolean rect1Clicked,rect1Clicked1,mouseEntered
Applet Error - AppletApplet Error Hi...
I had an application where i designed an
applet to get the
database values into the
applet when i clicked a line...
It works...
Applet implements MouseListener{
boolean
Advertisements
Applet database access - AppletApplet database access HI...
I'm having an
applet where we should display the
database values in the
applet...
It works fine in the local system...
but when its in the server, we r getting null values in the local system..
I
applet security error - Appletapplet security error HI,
Thanks for your reply.
In the sample plugin code, the URL(nspluginurl) you have specified is for netscape navigator.
------------
-----------
Can you please tell me the same for IE url
applet security error - Securityapplet security error hi,
i am using netbeans 6.0,apache tomcat server. I implemented the
applet in my jsp page using plugin. when i execute my jsp page, the following security
error occured.
ERROR:
Java Plug
java compilation error - Appletjava compilation error I am getting compilation
error in the following code.:
public void paint(Graphics g)
{
switch(screen...;
}
}
Error is:
Illegal start of expression
Plz. find why am I getting this
error java compilation error - Appletjava compilation error hi friends
the following is the awt front design program
error, give me the replay
E:\ramesh>javac product.java
Note: product.java uses or overrides a deprecated API.
Note
java applet run time error - Appletjava
applet run time error Hi,
Im new to java applet.please help me. i have create a MPEG movie player in
applet. when i run that program it show the
error that,"javax.media.NoPlayerException:
Error instantiating class
how to access database in applethow to access
database in applet HI...
I'm having an
applet where we should display the
database values in the
applet...
It works fine in the local... in java.security but came
error below...
java.sql.SQLException: JZ006: Caught IOException
error in compiling j2me apllication - Appleterror in compiling j2me apllication hi,
in my j2me application for video,m getting only the audio.i ll send the code.
package src.video_streaming;
import javax.microedition.media.Manager;
import
how to add database in Java Applet to add
database in Java
Applet below this code is my
applet source code .
thank...how to add
database in Java Applet hi every java master or Java...
Applet implements ActionListener{ TextField
Database error - WebSevicesDatabase error Hello,
How i connect my
database file& tables to Zend library file Using PHP language. In which library file i should change that code. Any one know the exact changes. Tell me.
http
Database Error - HibernateDatabase Error Hi,
I am working with Struts 1.2---- AJAX-----Hibernate 3.0 --- MySQL 5.0.
At the time of inserting/fetching from
Database... exceeded; try restarting transaction
That means the
database becomes locked.
Can
error while running the applet - Java Beginnerserror while running the applet import java.applet.Applet;
import...);
++num;
}
}
}
}
i have problem while running the code ,
error... prompt.
You will be got definitily your output in a
applet viewer.
Thanks
Error with LogIn with mysql databaseError with LogIn with mysql database Hi,
I have followed steps from your tutorial titled SpringMVClogin with
database. I am not using Jetty, as I... 404 page
error. In Tomcat console it states the reason as:
"
Error creating bean
error oracle database connection?error oracle
database connection? hi now i am trying to connect oracle
database and also insert my data into table, but it's not working.. I created one user registration form. when i give values in the form, i want stored data
java database error - JDBCjava
database error hi all i am writing one swing application where i want to insert data into
database(MS-Access) but dont know how to do... the following code to insert the data into MS-Access
database:
import java.sql.
connection database errorconnection
database error import java.awt.EventQueue; // import packages
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener...;which type of
error occurs? Specify it.
Is NWIND is your dsn
Oracle Database error - JDBCOracle
Database error String query11 = "SELECT product_code, product_quantity, price FROM o"+orderid;
ResultSet rs11 = stmt.executeQuery(query11);
while(rs11.next()){
product_code[j
error log and send Databaseerror log and send Database hi
my requirement is validate xml and xsd in java.If there is an errors then i will log
error and
store into
error table. so plz if any one knows send code urgent.
error table details
applet connected to table in MS Access database applet connected to table in MS Access
database i have connected my java code with the MS access
database and this is my code, can anyone tell me how to show the table in an
applet...pls
import java.sql.
error in accessing database - JSP-Servleterror in accessing database hiiii im tanushri im tryng to connect my
database to the servlet i hv succeeded in connectivity but im stuck to nother
error called Got minus one from read call although i hv feeded data to my
AppletApplet Write an
applet to display a string in an
applet. String should be passed as a parameter to an
applet appletapplet What is the immediate superclass of the
Applet class
AppletApplet how to run an
applet on a web browser
appletapplet Explain different stages in the lifecycle of an
applet with figure.
Stages of
Applet:
Life cycle of an
Applet:
init(): This method is called to initialized an
applet
start(): This method is called after
AppletApplet Give the class hierarchy of an
Applet class
AppletApplet Write a ava
applet that sets blue color foreground and yellow color background at the start of an
applet AppletApplet Explain the start() and stop() methods of
applet life cycle.
Start and Start method of
Applet Life Cycle
Start () method: The start method of an
applet is called after the initialization method init
AppletApplet Write a short note on
applet life cycle
AppletApplet I have a java
applet that has a button. On clicking the button it should disappear and another
applet should appear. How to write this code???? Also in login
applet after successful login it should display admin
applet AppletApplet Draw the class hierarchy of an
Applet class. Also explain how to set background and forground colors in java
appletapplet what is
applet in java
An
applet is a small program that can be sent along with a Web page to a user. Java applets can perform... the following link:
Applet Tutorials
AppletApplet Write a Java
applet that drwas a line between 2 points. The co-ordinates of 2 points should be passed as parametrs from html file. The color of the line should be red
appletapplet
applet to open new tab not working.here's my code
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
public class NewURL extends
Applet implements ActionListener{
public void init
getting error while inserting values in database) {
out.println("An
Error Had occurred while accessing the
database...getting
error while inserting values in database AddUser.java...");
if (envContext == null)throw new Exception("
Error: No Context
java - Appletjava how to connect
database table with scrollbar in java
applet java - Appletjava how to connect
database table with scrollbar in java
applet applet - Applet. Hi Friend,
Try the following code:
1)Create an
applet... extends
Applet{
public void paint(Graphics g){
g.drawString("Welcome in Java
Applet.",40,20);
}
}
2) Call this
applet with html code
Applet - AppletApplet what is the concept of
applet?
what is different between the
applet concept and HTML?
what is mean by swing? Hi friend,
Applet
Applet is java program that can be embedded into HTML pages. Java applets
applet - Applet*;
import java.awt.*;
public class CreateTextBox extends
Applet implements.../
applet/
Thanks
java appletjava applet If i insert in
database from
applet this work, but from applet.html don't
Applet - AppletApplet Namaste, I want to create a Menu, the menu name is "Display... java.awt.event.*;
public class menu2frame extends
Applet implements WindowListener...------------------------");
g.drawString("Demo of Java
Applet Window Event Program");
g.drawString("Java
applet problem - Appletapplet problem How can I create a file in client side by a java
applet . Surely it will need a signed
applet .But how can a signed
applet create a file in the client side