Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2007

Tip: Looking for answers? Try searching our database.

problem regarding dBase connectivity with Applet

Thread view: 
HESH - 19 Sep 2007 12:36 GMT
Hello,

Regarding: Airline Information system project dBase connectivity.
Initially we made GUIs using swing in 1st Iteration.
we tried different layout, & we are ok with that.

But as project demand is to make Airline System online.
We were left only with two options to make project either in Applet
or
JSP.
Because by using swings we can make only applications (standalone-
not
web based)

Sir, will it be possible to make online application using swing?

Secondly we don't have that much time to make AIS in JSP as members
require from learning -to-implement.
So finally we decided to make it in Applet, & for back end we are
using MS-Access or SQL, please suggest us which one will be better to
use.

Now we have all the GUIs in applet, but problem arise at the time of
data base connectivity in applet.
I tried by using following code:

Following code I just made for Demo purpose as application
System DSN is: AIS
Table Name is: Name

import java.sql.*;

public class JDBCDemo
{
               public static void main(String args[])

               {               try
                               {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                   Connection c =
DriverManager.getConnection("jdbc:odbc:AIS");
       // connecting with AIS.mdb
                                   Statement st =
c.createStatement();

                                   ResultSet rs =
st.executeQuery("select fName,lName FROM
Name");                    // shoot query

                                   while(rs.next())
                                   System.out.println(" name :"
+rs.getString("fName")+"
"+rs.getString("lName"));

                       c.close();
                       st.close();
                        }
                       catch(ClassNotFoundException cnf)
                       {

                               System.out.println("..Cnf
Exception");
                       }
                       catch(SQLException sql)
                       {
                               System.out.println("..SQL
Error"+sql);
                       }

               }
       }

And this code is absolutely working...
It means there is no problem in connectivity
I have already worked with JDBC by using Swing & SQL, but not by
using
applet.

Now when I use above code after Submit Button performed action.... In
applet
I also tried connection code in different methods in init(), run(),
paint() & still
I got same error as:

Exception in thread "AWT-EventQueue-1"
java.security.AccessControlException: acc
ess denied (java.lang.RuntimePermission
accessClassInPackage.sun.jdbc.odbc)

       at
java.security.AccessController.checkPermission(AccessController.java:
427)
       at
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)

       at
sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:190)

       at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
       at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

       at java.awt.EventDispatchThread.run(EventDispatchThread.java:
110)

Is there any security issues regarding applet connectivity with
dBase?

Please Help & give guide regarding this

Thank You,

HESH
GArlington - 19 Sep 2007 16:02 GMT
> Hello,
>
[quoted text clipped - 11 lines]
>
> Sir, will it be possible to make online application using swing?

Yes, applet can be based on swing too.

> Secondly we don't have that much time to make AIS in JSP as members
> require from learning -to-implement.
[quoted text clipped - 4 lines]
> Now we have all the GUIs in applet, but problem arise at the time of
> data base connectivity in applet.

Before you look at your own code again you should ask yourself - what
is the main difference between application and applet?
(one runs locally, the other runs on remote client)

> I tried by using following code:
>
[quoted text clipped - 12 lines]
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

You are trying to load applet local (i.e. remote client)
JdbcOdbcDriver

>                                     Connection c =
> DriverManager.getConnection("jdbc:odbc:AIS");
[quoted text clipped - 30 lines]
>
> And this code is absolutely working...

Your code is working in application, it does not mean that it will
work in remote applet - different security settings.

> It means there is no problem in connectivity
> I have already worked with JDBC by using Swing & SQL, but not by
[quoted text clipped - 38 lines]
>
> HESH

I suggest you read
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.
udb.doc/ad/samples/jdbc/s-Applt-java.htm

and change the code to suit your needs.
Andrew Thompson - 19 Sep 2007 16:26 GMT
...
>Regarding: Airline Information system project dBase connectivity.
>Initially we made GUIs using swing in 1st Iteration.
[quoted text clipped - 4 lines]
>or
>JSP.

'Wrong'.  You can also go with a web start launched
applet or application, or a plain old application.

Any of the above can connect back to the server.

(Oh, and personal opinion, but the 'JSP option' sucks in
comparison to a rich client as might be coded in Swing.)

>Because by using swings we can make only applications (standalone-
>not
>web based)

Rubbish.  Applets are every bit capable of using Swing.

>Sir, will it be possible to make online application using swing?

Sure is, but for the sake of low maintenance, applets
are best avoided completely.  Use a web start based app.

>Secondly we don't have that much time to make AIS ...

'ANTARES PHARMA INC'?  Australian Institute of Sport?
WTF are you on about?

>..in JSP as members
>require from learning -to-implement.
>So finally we decided to make it in Applet, & for back end we are
>using MS-Access or SQL, please suggest us which one will be better to
>use.

Umm.. it seems to this feeble mind that one is a DB, whereas
the other is a DB access (scripting?) language?
Perhaps you need to hire someone that has a clue.

>Now we have all the GUIs in applet, but problem arise at the time of
>data base connectivity in applet.
...
>java.security.AccessController.checkPermission(AccessController.java:
>427)
..
>Is there any security issues regarding applet connectivity with
>dBase?

If the applet (or web start application) originates from that
server, no, otherwise, it will need to be signed (by the
developer) and accepted as 'trusted' code by the user.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Lew - 20 Sep 2007 02:13 GMT
HESH wrote:
>> So finally we decided to make it in Applet, & for back end we are
>> using MS-Access [sic] or SQL, please suggest us which one will be better to
>> use.

> Umm.. it seems to this feeble mind that one is a DB, whereas
> the other is a DB access (scripting?) language?
> Perhaps you need to hire someone that has a clue.

HESH wrote:
>> Is there any security issues regarding applet connectivity with
>> dBase?

> If the applet (or web start application) originates from that
> server, no, otherwise, it will need to be signed (by the
> developer) and accepted as 'trusted' code by the user.

I am confused about the reference to dBase - is that product still extant?

To the OP: If you're using dBase, what's this about MS Access?  The two
products are quite disparate.  Last I knew, dBase didn't support SQL, and I'd
be astounded if there were a JDBC driver for it, although you might be able to
use JdbcOdbc.  Really, dBase is just a file format - I don't think even when
it was marketed that it worked as a database engine for remote connection.

Unless it's been reborn and I missed it?  Please explain.

Signature

Lew

Qu0ll - 20 Sep 2007 05:20 GMT
> I am confused about the reference to dBase - is that product still extant?
>
[quoted text clipped - 6 lines]
>
> Unless it's been reborn and I missed it?  Please explain.

"dBase" here may simply be a trendy shorthand abbreviated truncated
SMS-style form of "database".  The entire post makes no sense otherwise.

Signature

And loving it,

-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)

Lew - 20 Sep 2007 05:51 GMT
HESH wrote:
> Is there any security issues regarding applet connectivity with
> dBase?

"Lew" wrote:
>> I am confused about the reference to dBase - is that product still
>> extant?

> "dBase" here may simply be a trendy shorthand abbreviated truncated
> SMS-style form of "database".  The entire post makes no sense otherwise.

Precision of expression is a necessary characteristic of an engineering
discussion, especially when troubleshooting.

Interpreting "dBase" as you suggest, there are still aspects of the post that
are difficult to interpret.

Does "SQL" refer to Microsoft SQL Server?

With respect to
> Secondly we don't have that much time to make AIS in JSP as members
> require from learning -to-implement.
> So finally we decided to make it in Applet [sic]

It's Hobbes choice whether applets or JSP are harder to grok.  For me it's
applets - those things are just god-awful.  But even Tomcat takes a little
thought to deploy, albeit a whole lot less than applets do.

I really think the OP should go with Andrew's suggestion of Java WebStart (JWS).

They are really going to have to go through the Sun tutorials on Swing to
write this thing - GUI development generally is tricky, and the Event Dispatch
Thread (EDT) requires that programmers understand a modicum of concurrent
programming technique.

Signature

Lew

Qu0ll - 20 Sep 2007 09:01 GMT
>> "dBase" here may simply be a trendy shorthand abbreviated truncated
>> SMS-style form of "database".  The entire post makes no sense otherwise.
>
> Precision of expression is a necessary characteristic of an engineering
> discussion, especially when troubleshooting.

I absolutely agree!

> Interpreting "dBase" as you suggest, there are still aspects of the post
> that are difficult to interpret.

The entire post is difficult to interpret but that may be a result of the OP
not having English as their first language... or their second for that
matter.

Signature

And loving it,

-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)

Lew - 20 Sep 2007 13:45 GMT
> The entire post is difficult to interpret but that may be a result of
> the OP not having English as their first language... or their second for
> that matter.

That is nice of you to make excuses for them, but that doesn't explain how
they got proper nouns wrong.

Saying "dBase" for "database" or "SQL" instead of a brand name is not a
language problem, is a carefulness problem.

EFL is no excuse.  None.  They would have been just as imprecise in Esperanto
or whatever their language is.

Signature

Lew

Qu0ll - 20 Sep 2007 05:17 GMT
>>Secondly we don't have that much time to make AIS ...
>
> 'ANTARES PHARMA INC'?  Australian Institute of Sport?
> WTF are you on about?

OP's first line reads:

"Regarding: Airline Information system ..."

Signature

And loving it,

-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)

Andrew Thompson - 20 Sep 2007 07:44 GMT
>>>Secondly we don't have that much time to make AIS ...
>>
[quoted text clipped - 4 lines]
>
>"Regarding: Airline Information system ..."

Oh right.. (weakly) You mean I was supposed to
remember that, all the way from the *first* line?

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Andrew Thompson - 20 Sep 2007 07:40 GMT
>...
...
>>Because by using swings we can make only applications (standalone-
>>not
>>web based)
>
>Rubbish.  Applets are every bit capable of using Swing.

To clarify, one would start making a Swing based applet
using javax.swing.JApplet, as opposed to java.applet.Applet.
It is best not to mix Swing with AWT.

And in case nobody has mentioned it before, Swing
is a proper name, so the first letter should be Upper
Case, and it is not plural (so "Swing", not "Swings").

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Lew - 20 Sep 2007 13:48 GMT
> And in case nobody has mentioned it before, Swing
> is a proper name, so the first letter should be Upper
> Case, and it is not plural (so "Swing", not "Swings").

Precision of expression is a necessary characteristic of an engineering
discussion, especially when troubleshooting.

"swings" for "Swing" is getting up there with "it's" for "its" as one of my
bugbears.  The latter can be excused by a lack of familiarity with English
where that fits, but that excuse breaks down on proper nouns.

Signature

Lew

Roedy Green - 19 Sep 2007 17:17 GMT
>Sir, will it be possible to make online application using swing?


If this is a real airline reservation system, surely you have to tie
into the existing network. Else how can travel agents deal with you?

You don't want to expose your database to the outside world.  You
normally write servlets that modify the database, and communicate with
transactions to the outside world.

You have a choice of at least  five ways your clients may attach.

HTTP browser, Applet,  signed Applet, Java Web Start, and application.

http://mindprod.com/jgloss/http.html
http://mindprod.com/jgloss/applet.html
http://mindprod.com/jgloss/signedapplet.html
http://mindprod.com/jgloss/javawebstart.html
http://mindprod.com/jgloss/remotefileaccess.html

to help you decide the best route.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Rogan Dawes - 20 Sep 2007 15:50 GMT
> Hello,
>
> Is there any security issues regarding applet connectivity with
> dBase?

If you are planning to allow direct access to your database, you had
better trust your users not to tamper with the database directly. Or
else be VERY sure to set up table and column permissions appropriately
so that they cannot get access to data that they should not be able to
view using the GUI.

As mentioned by Roedy, the typical approach is to have a server side
component (Servlet, typically), that receives requests from the client
(whatever it may be - Swing applet, Web Started application, Browser UI,
etc), processes the request, and returns an appropriate response.

Regards,

Rogan


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.