Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Access in Applet

 
Aphsal Viking
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.
 
Philip Pross
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
 
jared jorgenson
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic