Sitanshu Bhusan Nanda wrote:
> Hi
> My problem is using JDBC(ODBC) in POSTGRESQL. My machine has Red Hat
> Linux 5.2. In the Howto Postgres document it is written that JDBC driver
> is supplied with this CD. I created Database and tabels using psql
> interactive prompt. Then I wrote one java program to access the tabels
> created before.
> The statements in the java program are:
> String url ="jdbc:postgres95:mydb?user=postgres&passwd=pass";
> String query="select * from emp;
>
> (I have created emp tabel and it has also some rows inserted.)
>
> To load the driver the statement is
> Class.forName("postgress95.PGDriver");
> To connect to the database
> Connection con = DriverManager.getConnection(url);
>
> There is no error message when I compile using javac. But when run this
> program using java I get a error message as :
> Java.lang.ClassNotFoundException: postgres95/PGDriver
> at SimpleSelect.main(41)
> In one website of FAQJDBC it is written that one must have postgers.jar
> file in the current directory to load the driver. But I didn't
> get that file anywhere in my system.
Yeah you must, yesterday I compiled postgres 6.5 and in fact it didn't
generate the postgres.jar, so asuming your postgres source code is in
/usr/src/pgsql you must cd to /usr/src/pgsql/src/interfaces/jdbc with the
postgres account and then do a
gmake all
your java settings must be configured as this step will compile the classes in
postgres.jar.
after gmake finishes if it was successful it tell you a little of using
postgres.jar, then for more help compile the examples
gmake examples
and try it.
Note that some examples fails to run as it assume you have a database named
test with some tables, so if it happens, first create that database and try
again.
>
>
>
> Please help me to solve this problem.
> Is there any other way I can use JDBC to access the tabels created
> in Postgres.
>
> Sorry for inconvenience
> With regards
> -Sitansu
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]