473,394 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Database storage

11
verify and tell me what runtime error in this pgm

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.sql.*;

public class screen extends Applet implements ActionListener
{
TextField t1,t2,t3;
Label l1,l2,l3;
Button b1;




public void init()
{
t1=new TextField();
t2=new TextField();
t3=new TextField();
l1=new Label("Enter A:");
l2=new Label("Enter B:");
l3=new Label("Result is:");
b1=new Button("ok");
add(l1);
add(t1);
add(l2);
add(t2);
add(l3);
add(t3);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
String a1=t1.getText();
String a2=t2.getText();
System.out.println(a1);
System.out.println(a2);
int c=Integer.parseInt(a1)+Integer.parseInt(a2);
String c1=String.valueOf(c);

t3.setText(c1);
System.out.println(c);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:bb");
Statement stmt=conn.createStatement();
stmt.executeUpdate("Insert into screen values('"+a1+"','"+a2+"')");
System.out.println("Records are added");
conn.close();
stmt.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
}


//<applet code="screen" width="400" height="300"></applet>
May 7 '07 #1
6 1662
haran22
11
In this program consists of two textfields and one button. when i click the button the data in the 2 textfields wants to store in a datatbase MsAccess.
Plz tell what is that run time error.. any one plz do this.

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;

public class screen extends Applet implements ActionListener
{
TextField t1,t2,t3;
Label l1,l2,l3;
Button b1;



public void init()
{
t1=new TextField();
t2=new TextField();
//t3=new TextField();
l1=new Label("Enter A:");
l2=new Label("Enter B:");
//l3=new Label("Result is:");
b1=new Button("ok");
add(l1);
add(t1);
add(l2);
add(t2);
//add(l3);
//add(t3);
add(b1);
b1.addActionListener(this);
}

public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
String a1=t1.getText();
String a2=t2.getText();
System.out.println(a1);
System.out.println(a2);
/*int c=Integer.parseInt(a1)+Integer.parseInt(a2);
String c1=String.valueOf(c);
t3.setText(c1);
System.out.println(c);*/
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:bb");
Statement stmt=conn.createStatement();
stmt.executeUpdate("Insert into screen values('"+a1+"','"+a2+"')");
System.out.println("Records are added");
conn.close();
stmt.close();
}
catch(Exception e1)
{
System.out.println(e1);
}
}
}
}



//<applet code="screen" width="400" height="300"></applet>
May 7 '07 #2
r035198x
13,262 8TB
verify and tell me what runtime error in this pgm

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.sql.*;

public class screen extends Applet implements ActionListener
{
TextField t1,t2,t3;
Label l1,l2,l3;
Button b1;




public void init()
{
t1=new TextField();
t2=new TextField();
t3=new TextField();
l1=new Label("Enter A:");
l2=new Label("Enter B:");
l3=new Label("Result is:");
b1=new Button("ok");
add(l1);
add(t1);
add(l2);
add(t2);
add(l3);
add(t3);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
String a1=t1.getText();
String a2=t2.getText();
System.out.println(a1);
System.out.println(a2);
int c=Integer.parseInt(a1)+Integer.parseInt(a2);
String c1=String.valueOf(c);

t3.setText(c1);
System.out.println(c);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:bb");
Statement stmt=conn.createStatement();
stmt.executeUpdate("Insert into screen values('"+a1+"','"+a2+"')");
System.out.println("Records are added");
conn.close();
stmt.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
}


//<applet code="screen" width="400" height="300"></applet>
What exception are you getting?
May 7 '07 #3
r035198x
13,262 8TB
ps. please use code tags each time you need to post code. Do not double post questions.


Deleted one of your threads and merged two of them.
May 7 '07 #4
haran22
11
I am getting the runtime Exception.
Access denied<java.lang.RunTimePermissionaccessClassInPac kage.sun.jdbc.odbc>
This is the exception occuring while running the program
May 7 '07 #5
r035198x
13,262 8TB
I am getting the runtime Exception.
Access denied<java.lang.RunTimePermissionaccessClassInPac kage.sun.jdbc.odbc>
This is the exception occuring while running the program
An applet does not have access to the file system or databases on your computer by default. You need to sign your applet first for it to be granted permission. Google "how to sign java applets".
May 7 '07 #6
haran22
11
I didnt find in google search. If any one can plz try that n tell me.. plz plz
May 14 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: cjl | last post by:
Hey all: I know that it is silly in the age of Google to 'lose' something on the internet, but I recently checked out a project that had implemented a database with a subset of SQL in pure...
2
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
6
by: kaming | last post by:
Dear all, I would like to ask is there any DB2 SQL statement that can be used to show the overall database size? (i.e. display the allocated/used data files or tablespaces (either SMS or DMS)...
27
by: Brett | last post by:
If I want to easily swap the database I'm using, what is the best method for developing that tier in my application? I'll have basically a 4 tier app: 1. presentation 2. business logic 3. data...
2
by: Mike | last post by:
I running MySQL locally and have the following dir setup C:\wamp\mysql\data\mike - This is where the tables for the database mike are stored C:\wamp\mysql\data - This is where I think the...
4
by: danthrom | last post by:
Hi, I have a database with four tables. tbl_Client client_alias (PK, text) tbl_Matters matterID (PK, autonumber) matter (text) client_alias (foreign key, tbl_Client)
14
by: vunet.us | last post by:
Hi, I would like to use flat file data storage instead of database. Since I am new to it, I am wondering: What text file extension is a safe one to store my data online and how cost- and...
10
by: Jay | last post by:
In C# I can set up an Enum so that number are represented as keywords, which is very useful. Is there such a datatype in a database? I suppose I could use an extra table, with the ID column as...
1
by: TheTeapot | last post by:
I'm looking for a PHP database class which allows database connections to mysql, AND (text/XML) files to store information. I'm looking to use the file storage in a small intranet usage of my...
10
by: Les Desser | last post by:
In article <fcebdacd-2bd8-4d07-93a8-8b69d3452f3e@s50g2000hsb.googlegroups.com>, The Frog <Mr.Frog.to.you@googlemail.comMon, 14 Apr 2008 00:45:10 writes Not sure if I quite follow that. 1....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.