Re: Using JDBC
| От | Eric B.Ridge |
|---|---|
| Тема | Re: Using JDBC |
| Дата | |
| Msg-id | 55C407DC-27DF-11D7-B02B-0003937E3354@tcdi.com обсуждение исходный текст |
| Ответ на | Re: Using JDBC (Marcelo Pereira <gandalf@sum.desktop.com.br>) |
| Список | 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
В списке pgsql-jdbc по дате отправления: