How can i create Database Connection in Swing Applet?
A DESCRIPTION OF THE PROBLEM :
I am unable to connect to oracle database using thin driver
in Swing Applet.
ENVIRONMENT:
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
FULL OPERATING SYSTEM VERSION : NT 4.0
Java file:-
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.awt.*;
public class SwingApplet extends JApplet
public void init(){
public void start(){
JTextField txf=new JTextField();
JButton btn=new JButton("Click Me");
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
try{
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@orasrv:1521:oracledb","hrisadmin","hrisadmin");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from applicant");
}catch(Exception e){JOptionPane.showMessageDialog
(null,e.toString());}
JOptionPane.showMessageDialog(null,"Hai Swing is cool");
getContentPane().add(txf,BorderLayout.NORTH);
getContentPane().add(btn,BorderLayout.CENTER);
public void stop(){
public void destroy(){
html file:-
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="120" height="160" align="middle"
codebase="http://java.sun.com/products/plugin/1.1.2/
jinstall-12-win32.cab#Version=1,2,0,0">
<PARAM NAME="code" VALUE="SwingApplet.class">
<PARAM NAME="codebase" VALUE=".">
<PARAM NAME="archive" VALUE="classes111.zip">
</OBJECT>ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.security.AccessControlException:access denied(java.net.SocketPermission or
asrv resolve)
if the applet runs locally, and you want to connect to your DB locally with the applet, it won't work (except if you adjust the security settings of your browser, maybe). That's because applets don't have access to the computer they're running on (except some information), since that would mean that any applet could just access your computer, so, it's not possible for security purposes.
On the other hand, they don't have to right to connect to anything, except the server they're downloaded from ( so the webserver's ip).
But I'm not sure about connecting to a DB through JDBC that way.
Tom
Similar Messages
-
How can i Create Database Link
Dear Expert,
I have two servers on that there are two databases then
how can i create database link.CREATE [SHARED][PUBLIC] DATABASE LINK link_name
[CONNECT TO user IDENTIFIED BY password]
[AUTHENTICATED BY user IDENTIFIED BY password]
[USING 'connect_string'] -
TP4: Can't create database connection
I have just installed JDeveloper TP4 and run it for the first time. When I try to create database connection, nothing happens. Specifically, I right click on "IDE Connections" and select "New Connection" - and nothing happens; no messages, no dialogs, nothing. Is there something I have to have installed before this will work? I have Sun's Java 6 installed - I noticed that JDeveloper warns about this. Would it cause this problem?
Hi,
can you try with JDK 5 to exlude and issue with JDK 6. It works for me with JDK 5 so, there might be an issue with you Java runtime
Frank -
How can I create JScrollPane in my swing application with scroll bars movin
Hi,
How can we create scrollpanes moving with scrollbars.I tried many times with custom layout.but it does not work if i set custom layout.I hope that I will get my problem solved.
Thanks and Regards,
Rameh RKThis means it is not possible to create a pure unicode file without the byte order mark?
You wouldn't happen to know how a file with byte order mark should read on a Linux system?
Or if this possible or not?
Regards
Christian -
How can i improve database connectivity with connection pool
Hi,
I used to create a connection to DB per session since the application is pretty small. Now i want to improve the db connectrion with connection pool. However, i am still confused since the book i read says that i have to change something in server.xml in the tomcat server while other people in this forum actually implement a connection pool class. Isnt it has been built into the servlet container? if yes, how can i use it? I suppose i only have to open the connection and the connection pool will reclaim the resource when the session is terminated in the same way the gabage collector reclaim resource when no reference is associated to object, am i correct?
Thaithe documentation for Tomcat 5 DB pooling can be found at:
http://jakarta.apache.org/tomcat/tom...les-howto.html
Here are the Tomcat 4 docs:
http://jakarta.apache.org/tomcat/tom...les-howto.html
The administration console can be found at (under default install):
http:localhost:8080/admin
But, you have to set up a user and password in your
<tomcat-install>/conf/tomcat-users.xml file.
You need to add an "admin" role and a user that will be assigned this
role like this (obviously you won't be using "tomcat" as your password):
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="admin"/>
</tomcat-users>
So, I can log in as Tomcat and have admin privs.
Tomcat 5
http://jakarta.apache.org/tomcat/tom...ger-howto.html
Tomcat 4
http://jakarta.apache.org/tomcat/tom...ion%20A ccess
i'm sure this helps u -
How can I kill database connections
I would like to know how can I kill all the database connexion at the end of an application. I'm using acces
thxuse con.close() in a finally statement after your catch blocks that tests whether con equals null. If con != null, then con.close();
example:
finally {
//close the database connection.
try {
if (con != null) con.close();
catch (SQLException e) {
} -
How can i include database connection in an EP development
Does any body knows what are the steps to include database connection in an EP development in NWDS?
Hi Jose.
http://help.sap.com/saphelp_nw04/helpdata/en/30/a0f17aacb34b108b39a96acc33da3f/frameset.htm
or
http://help.sap.com/saphelp_nw04/helpdata/en/fe/9e362f3d954e8e8555007d8030df63/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
Regards, Karsten -
How can I create a database connection to Cloudscape database in 9iJDeveloper?
How can I create a database connection to Cloudscape database in
9iJDeveloper?
thanks.Hi,
I assume you have a JDBC driver for Cloudscape.
1. In the IDE System Navigator, expand the Connections Node.
2. Right-click on the Database Connection and choose New
Connection .. .
3. Click pass the welcome screen.
4. In Step 1, name your connection and choose "3rd party JDBC
Driver"
5. Follow the rest of the steps and provide username/password,
class name and URL, test and you should be ready to go.
Good luck. -
How can i create a new usb connection (service) on my iMac for sharing internet from my iPhone5 ( i seem have to deleted it )
i know its not a problem whit my carrier o data plan or sharing preferences on the ipone because when i use it un my laptop it works perfectly through
the usb and even works on the Imac through wifi and bluethood tethering but NOT through usb!!.
the problem is that trying to make it work i deleted the "profile" usb iphone on the network prefereces panel. Now i only have 3 options: ethernet / wifi / bluetooth
but not the usb iPhone i used to have.
And when i try to add a new one i dont get a USB option.
can some one help me please??
this is how it looks (after the bluetooth PAN i used to have USB iPhone option)The question would be more appropriate in the Mac forums as it is not really related to the iPhone.
-
How can I create an EntityStore for a Database? Advice on DB strategy?
Hello All,
How can I create an com.sleepycat.persist.EntityStore for a com.sleepycat.db.Database? Advice on DB strategy?
I'm looking to create an application prototype that creates a database dynamically and can delete it programatically. Is openDatabase/removeDatabase what I'd want to use for that?
So far, the Direct Persistence Layer is an amazing piece of technology and has the potential to make my team's application faster than we every though possible, so kudos to the author.
I've built a high-security application using the DPL and a single database for hundreds millions of users. I'd like to attempt to create a database for each user for security and manageability purposes. Our mission statement doesn't allow us to execute queries for sensitive data across more than one user account at a time, so I don't get any benefit from having every user's objects in a single database. I'm investigating if giving each user their own database will speed up insert times and SecondaryIndex queries. It'll certainly be more secure as each database will be encrypted with a unique password.
My design is that I have an app with dozens of com.sleepycat.persist.model.Entity beans which I persist and query on their Primary and secondary indexes. I've been accessing things through an EntityStore as illustrated in the Getting Started Guide. Can I access a database created with openDatabase through an EntityStore and com.sleepycat.persist.PrimaryIndex?
Thanks in Advance,
Steven
Harvard Childrens Hospital Informatics ProgramI closed this as I found another way to solve my issue.
Thanks,
Steven -
How can I create a pdf-report in a database trigger
Hi,
how can I create a pdf-file with Reports 9i in a database trigger ?
Where can I find informations about it?
Thanks
FriedholdHere would be the place to start.
If you have existing reports to call, take a look at the JRC -
How can i create a new and tableless database using database configuration
How can i create a new and tableless database using database configuration
How can i create a new and tableless database using database configuration
Just don't install the sample schemas. See the installation guide
http://docs.oracle.com/cd/E11882_01/server.112/e10831/installation.htm
Using the Database Configuration Assistant
When you install Oracle Database with the Oracle Universal Installer, the sample schemas are installed by default if you select the Basic Installation option. Selecting the sample schemas option installs all five schemas (HR, OE, PM, IX, and SH) in the database. If you choose not to install the sample schemas at that time, you can add them later by following the instructions in section "Manually Installing Sample Schemas".
Choose a custom install and don't install the sample schemas.
All other schems/tables installed are REQUIRED by Oracle -
How can I create a new folder in an external disk that is connected via USB to my Mac?
How can I create a new folder in an external disk that is connected via USB to my Mac?
Just like you would create a new folder anywhere. Open the drive's icon from your desktop or the Finder, and click shift-command-N. (Or use the Finder menu if you prefer - File - New Folder).
If you can't create a folder, your drive may be the wrong format (you can't write to a Windows/NTFS formatted drive, for example). You'll have to back up any files you have on there, and then use Disk Utility to reformat it to Mac Extended (if it will only be used on a Mac) or MS-DOS format (if you want to share it with a PC).
Matt -
How can I create a my own dialog in awt or swings
How can I create a my own dialog in awt or swings instead of JDialog,Joption.
if possible some example.
Thanks in advance
bhaskarhi,
just use the building blocks of of GUI components and their methods. For examlpe u want to write a Font Dialog box,
use Frame with lists , thers is classes by which u can pick the all fonts installes on ur system. Do appropriate programming to event handlers . On last in event handler of 'OK' button get the selected item from list and assign to wht u want thats all........... -
How Can I create a database?
How can I create a database to store registered members info
(member id, password and other information?) I have the scripts for
member login, member signup, etc.. I understand that I will have to
deploy the database, once it is created, in the same folder where I
have all other scripts (PHP.)
Thank you, in advance.Hey,
basically you should start with an empty SharePoint 2010 project where you add an List-EventReceiver. This Receiver should point to the url of the list and handle the ItemAdded-Event. In this method you place the code to create the database, for example
with a SQL-Statement.
Maybe you are looking for
-
How to connect my HP MFP M127?
-
Hi All Need your help, scheduled process order which have one operation say 100 and three phases 110,120,130. Phase 110 starts at 10/22/08 , 13:56:50 and end at 10/22/08 14:28;25 Phase 120 starts at 10/22/08 14:28;25 and end at 10/22/08 24:00:0
-
Hello, We are using the free, cloud based version of Cisco Jabber video for telepresence. In the 4.8 user guide for Windows, on page 22, it states to move the mouse pointer over to the Calls on Hold panel and click "Join all" in order to join those
-
[BPC 7.5] or [BPC 10] Validate data from different periods
Hi, is it possible to use the standard validation business rule to validate data in different periods? I need a rule that validates the total in my flow dimension from last year end to the value in the opening flow in the current period. Is that poss
-
My daughters 4s has frozen. Displays the 'slide to unlock' message but is unresponsive. Online help says resart device but I can't power off as the slide function does not work. Any ideas?? Thanks.