Re: cannot find org.postgres.Driver

Lists: pgsql-jdbc
From: Felipe <pipojmr(at)yahoo(dot)com(dot)mx>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: cannot find org.postgres.Driver
Date: 2004-05-25 22:44:12
Message-ID: 20040525224412.79785.qmail@web50507.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi everybody

I'm trying to write an applet to acces postgres but when I load the applet in a web browser doesn't seems to work. In the JVM console I obtain an error that says something like this

Cannot find "/home/applets/org/postgresql/Driver"

the code I use to load the postgres driver is as follows

Class.forName("org.postgresql.Driver");
Connection db = DriverManager.getConnection("jdbc:postgresql:arl",user,password);

where arl is the database name

for you anwser thanks

---------------------------------
Do You Yahoo!?
Yahoo! Net: La mejor conexión a internet y 25MB extra a tu correo por $100 al mes.


From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Felipe <pipojmr(at)yahoo(dot)com(dot)mx>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: cannot find org.postgres.Driver
Date: 2004-05-26 00:53:27
Message-ID: 1085532807.1652.4.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Felipe,

from the http://jdbc.postgresql.org/doc.htm site

So our url? It's one of the following:

jdbc:postgresql:database
jdbc:postgresql://host/database
jdbc:postgresql://host:port/database

where database is the database to connect to, host the server to connect
to, and port the port number.

If left out, host defaults to localhost (not 127.0.0.1 see applets!) and
port to 5432 (configurable at build time).

Dave

On Tue, 2004-05-25 at 18:44, Felipe wrote:
> Hi everybody
>
> I'm trying to write an applet to acces postgres but when I load the
> applet in a web browser doesn't seems to work. In the JVM console I
> obtain an error that says something like this
>
> Cannot find "/home/applets/org/postgresql/Driver"
>
> the code I use to load the postgres driver is as follows
>
> Class.forName("org.postgresql.Driver");
> Connection db =
> DriverManager.getConnection("jdbc:postgresql:arl",user,password);
>
> where arl is the database name
>
> for you anwser thanks
>
>
>
> ______________________________________________________________________
> Do You Yahoo!?
> Yahoo! Net: La mejor conexión a internet y 25MB extra a tu correo por
> $100 al mes.
> !DSPAM:40b3cd80232576939882854!
--
Dave Cramer
519 939 0336
ICQ # 14675561


From: Ulrich Meis <kenobi(at)halifax(dot)rwth-aachen(dot)de>
To: Felipe <pipojmr(at)yahoo(dot)com(dot)mx>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: cannot find org.postgres.Driver
Date: 2004-05-26 14:35:31
Message-ID: 40B4AB33.3040001@halifax.rwth-aachen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Felipe wrote:

> Cannot find "/home/applets/org/postgresql/Driver"
>

Did you extract the jdbc classes or are you using the postgresql.jar file?
If you use the jar, did you mention it in the archive property of your
applet/object/embed tag?

Your html page and your directory structure would help.

Greetings,

Uli


From: Felipe <pipojmr(at)yahoo(dot)com(dot)mx>
To: Ulrich Meis <kenobi(at)halifax(dot)rwth-aachen(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: cannot find org.postgres.Driver
Date: 2004-05-26 22:06:11
Message-ID: 20040526220611.32358.qmail@web50505.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I'm using the file pg73jdbc3.jar which is included in my classpath

well, my directory structure is:

/home/Documents/dbConnection/classes/dbconnection
here are all classes

and html file is in
/home/Documents/dbConnection/classes/

my source code is as follows

package dbconnection;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import java.sql.*;

public class Conectame1 extends JApplet {

//Construct the applet
public Conectame() {
}

//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}

//Component initialization
private void jbInit() throws Exception, ClassNotFoundException, SQLException{
conexion esta = new conexion();
jLabel1.setText("database name: "+esta.db.getDatabaseProductName());
this.setSize(new Dimension(400,300));
this.getContentPane().add(jLabel1, BorderLayout.CENTER);
}
}

class conexion {
Connection db;
DatabaseMetaData dbmd;
public conexion() throws ClassNotFoundException, SQLException
{
Class.forName("org.postgresql.Driver");
db = DriverManager.getConnection("jdbc:postgresql:arl","pipo","jamara16");
dbmd = db.getMetaData();
}
public static void main(String[] args) throws SQLException, ClassNotFoundException
{
conexion conexion1 = new conexion();
}
}

my html code is as follows
html>
head>
title>
HTML Test Page
/title>
/head>
body>
dbconnection.Conectame will appear below in a Java enabled browser.<br>
applet
codebase = "."
code = "dbconnection.Conectame.class"
name = "TestApplet"
width = "400"
height = "300"
hspace = "0"
vspace = "0"
align = "middle"
>
/applet>
/body>
/html>
(I erased the '<' for my mail manager)
thanks for your answer

---------------------------------
Do You Yahoo!?
Yahoo! Net: La mejor conexión a internet y 25MB extra a tu correo por $100 al mes.


From: Ulrich Meis <kenobi(at)halifax(dot)rwth-aachen(dot)de>
To: Felipe <pipojmr(at)yahoo(dot)com(dot)mx>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: cannot find org.postgres.Driver
Date: 2004-05-28 02:01:35
Message-ID: 40B69D7F.9050406@halifax.rwth-aachen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Felipe wrote:

> I'm using the file pg73jdbc3.jar which is included in my classpath
>

And here's the problem. Your browser uses the Java Plugin and that has a
different classpath. You can set it on your machine, but you can't set
it on everyone's machine who's going to visit your page.
You need to include the jar file in your applet tag. I am not sure if it
is possible with a plain <applet> tag, but you can try to add
codebase="pg73jdbc3.jar".
That might fail, but with JDK 1.2 applets you shouldn't use that tag
anyway. Unfortunately it depends on the browser if you need to use an
<object> or an <embed> tag, but the whole matter is best discussed here:
http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/contents.html
where you can find a solution for both major browser families out there.

Greetings,

Uli