Re: Using JDBC

From: Eric B(dot)Ridge <ebr(at)tcdi(dot)com>
To: Marcelo Pereira <gandalf(at)sum(dot)desktop(dot)com(dot)br>
Cc: Fernando Nasser <fnasser(at)redhat(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Using JDBC
Date: 2003-01-14 16:43:40
Message-ID: 55C407DC-27DF-11D7-B02B-0003937E3354@tcdi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tuesday, January 14, 2003, at 10:58 AM, Marcelo Pereira wrote:
<snip>
> /*
> ** pgdbping.java - programa para testar uma conexo jdbc com PostGRES
> **
> ** Elielson - 24.07.2002
> */
>
> import java.sql.*;
>
> class pgdbping {

This is all going to be way OT for this list, but....

Is your file named "pgdbping.java"? There is a 1-to-1 relationship
(case *sensitive*) between class names and filenames.

<snip>
> $ java test.java

"java" runs *compiled* classes. Similar to how "perl" runs scripts.

> $ javac test.class

"javac" compiles java source code into java class files. Similar to
how "gcc" compiles C code into binaries.

> Exception in thread "main" java.lang.NoClassDefFoundError: test/class
>
> Is this the right way to compile/run the source codes?

nope.

> Any ideas??

Assuming your source is named pgdbping.java:

1) compile it:
# export CLASSPATH=.:/path/to/postgres.jar
# javac pgdbping.java

2) run it:
# export CLASSPATH=.:/path/to/postgres.jar
# java pgdbping

You really should read over the tutorials on Java at sun's site
(java.sun.com) They cover the basics of compiling/running classes,
setting classpaths, etc.

You can also just type "java" and "javac" to get help/usage information
for each tool.

eric

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Carlos Correia 2003-01-14 16:55:52 Re: Errors compiling Postgres (bison -maximum table size excceeded)
Previous Message Andrew Sullivan 2003-01-14 16:34:47 Re: Select * from users WHERE upper(lastName) = upper('Pringle')