• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using JDBC.ODBC Driver with an applet

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.I tried to connect to a database through a java class and I successfully extracted the required results.
2. When I try to connect to a database using an
Applet I am getting the following error:
"on the applet it is printing sun.jdbc.odbc.JdbcOdbcDriver"
Hear is the code:
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnectio("jdbc dbc:sampleDSN","system","manager");
s = con.createStatement();
}catch (Exception e)
{results.setText(e.getMessage());}
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Applets are run on the client machine.
You are using the jdbc dbc bridge the datasource
sampleDSN you set up on your machine is not set on
the machine of the client.
As you are using the jdbc dbc bridge I assume you are using access or some local Database if you
want to run Jdbc code in an applet it must connect to a proper database server.
 
Rama Reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,
thanks for ur response.
I am trying it on my local machine and the database is on the local machine(it is MS access).
it is throwing exception at Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
do i need to set something else.
Thanks
Venkat
 
Rama Reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
==>
When I run using appletviewer this is the error I am getting:
access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic