Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Database Access in Applet

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All. I want to connect my applet with backend database. What should I do? I have deployed my application on a shared server and not able to access it with odbc.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very simple answer to a simple question, try using servlets to connect to your database. In your applet call the servlet by ...
try
{
url = new URL ("http://yourServer:8080/examples/servlet/yourServlet?para="+para2 +);
}
catch(MalformedURLException e)
{
System.out.println("error url " + e.getMessage());
}
catch (IOException e)
{
System.out.println("error io " + e.getMessage());
}
then in your servlet connect to the database by ...
String url = "jdbc dbc:vigie";
String nom="JAVA";
String pw="JAVA";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
c = DriverManager.getConnection(url, nom, pw);
}
catch (ClassNotFoundException e)
{
System.out.println(e.getMessage() );
}
catch (Exception ee)
{
System.out.println(ee.getMessage() );
}
I hope this help .... just check out JDBC tutorials on java.sun.com, it helped alot when I started
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jared.
I'll suggest you to take a look to SwingML.
This is a project that solves this kind of situation.
http://swingml.sourceforge.net
 
mooooooo ..... tiny ad ....
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic