Re: JDBC APPLET Problem

From: "S(dot)A(dot)Pamungkas" <moenk_2000(at)yahoo(dot)com>
To: v j <jvs_a(at)yahoo(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: JDBC APPLET Problem
Date: 2001-02-02 05:21:42
Message-ID: 20010202052142.878.qmail@web4903.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-jdbc

Hi VJ,

I had experience that connecting Postgresql (JDBC) by
Applet has several (many) problems. The most problem
is about driver such as "no suitable driver".

So, I decided to use Java Servlet in the server side
instead of Applet. Applet is used only in the client
side.

And Applet-Servlet-JDBC-Postgresql communication
provides good system for data collection and(or) data
retrieval (including BLOB).

Hope that this information helps you.

Regard.

-S.A.Pamungkas-

--- v j <jvs_a(at)yahoo(dot)com> wrote:
> Dear Sir,
> Now I try to run the Java Program by using JDBC
> PostgreSql through Web Browser.
> I set the file pg_hba.conf as
>
> local all trust
> host all 127.0.0.1 255.255.255.255 trust
> host all 0.0.0.0 0.0.0.0 trust
>
> and the java code as shown below .....
>
> import java.sql.*;
> import java.applet.*;
> import java.awt.*;
> import java.awt.event.*;
> import java.net.*;
> import java.io.*;
>
>
> public class SampleApplet extends Applet implements
> ActionListener
> {
> Connection conn;
> Statement stmt;
> String state_code;
>
> private TextField Tinput;
> private TextField Toutput;
> private TextField Terror;
>
> private Button sqlprocess;
>
>
>
> public void init(){
>
>
> try{ Class.forName ("org.postgresql.Driver");}
> catch(Exception ex){
> ex.printStackTrace();}
>
> setFont(new Font("TimesRoman",Font.PLAIN,15));
> setLayout(null);
>
> Label Linput = new Label("Enter a state code: ");
> Tinput = new TextField(10);
> Label Loutput = new Label("Sql Output");
> Toutput = new TextField(30);
> Terror = new TextField(100);
> sqlprocess = new Button("SqlQuery");
>
> Linput.setBounds(10,30,150,30);
> Tinput.setBounds(170,20,100,30);
> Loutput.setBounds(10,80,100,30);
> Toutput.setBounds(110,80,100,30);
> Terror.setBounds(10,150,200,30);
> sqlprocess.setBounds(50,210,80,30);
>
> add(Linput);
> add(Tinput);
> add(Loutput);
> add(Toutput);
> add(Terror);
> add(sqlprocess);
>
> sqlprocess.addActionListener(this);
>
> }
>
> public void start() {
> try{ conn =
>
DriverManager.getConnection("jdbc:postgresql://fmlhost.fml.t.u-tokyo.ac.jp/test","postgres","");
> stmt = conn.createStatement();
> }
> catch(Exception ex){
>
> ex.printStackTrace();
> Terror.setText(ex.getMessage());
> }
> }
>
> public void actionPerformed(ActionEvent ae) {
>
> if(ae.getActionCommand()=="SqlQuery"){
>
>
> state_code = Tinput.getText();
>
> try{ ResultSet res = stmt.executeQuery( "Select
> name "+"From statename "+"Where code =
> '"+state_code+"'");
> if(res!=null)
> while(res.next())
> {String state_name = res.getString(1);
> Toutput.setText(state_name);}
>
> res.close();
> stmt.close();
> conn.close();
> }
>
> catch(Exception ex){
> ex.printStackTrace(); }
>
>
> }
>
> }
>
>
> }
>
> and I get the error message as
>
> "No suitable driver"
>
> Please advice me for this problem.
>
> Thank you
>
>
>
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail -
> only $35
> a year! http://personal.mail.yahoo.com/

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message v j 2001-02-02 06:22:13 Re: JDBC APPLET Problem
Previous Message PostgreSQL Server 2001-02-02 05:11:22 Re: JDBC APPLET Problem

Browse pgsql-jdbc by date

  From Date Subject
Next Message v j 2001-02-02 06:22:13 Re: JDBC APPLET Problem
Previous Message PostgreSQL Server 2001-02-02 05:11:22 Re: JDBC APPLET Problem