Bug 78301

Summary: JDBC not supported by Red Hat 8/Postgresql7.2
Product: Red Hat Database Reporter: Need Real Name <d_r_king>
Component: JDBCAssignee: Fernando Nasser <fnasser>
Status: CLOSED NOTABUG QA Contact: Permaine Cheung <pcheung>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-01-15 22:15:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2002-11-20 22:31:16 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901

Description of problem:
Driver can't be created for sourceURL with the new installation.

I installed 8.0 clean with the server option, all packages. I set
/var/lib/pgsql/data/postgresql.conf's tcpip_sockets=true (and uncommented the
line). I also changed the /etc/rc.d/init.d/postgresql script to pass in the -i
parameter. I created a test database, with a best user, and confirmed that I
could get there with psql -U testuser -d testdb. I updated
/var/lib/pgsql/data/pg_hba.conf to allow connections all kinds of ways, one at a
time: localhost at 127.0.0.1 using password, using trust, localhost at
192.168.0.0 using password and trust, host using trust and password. I put the
.jar file in my classpath and compiled a sample script per the example online,
using Class.forName("org.postgresql.Driver") to register the class, which succeeded.

But Connection dbConnect = DriverManager.getConnection("jdbc:postgresql:testdb",
"testdb", "password") failed with an SQLException: can't find driver for URL
jdbc:postgresql:testdb. 

I've shown everything I did to the pgsql-jdbc mailing list at postgresql.org. No
one can find anything wrong after many suggestions.

I tried disabling the firewall through the security manager, but every time I
return to it, it is on the default High setting. I don't believe this should be
an issue since this is all on one machine.

Help! Thanks!

d_r_king

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Configure postgres for tcp/ip in .conf file and init.d script
2. put distribution jar file into classpath
3. Compile this program (from memory here, excuse typos, they're not in the
original):

import java.sql.*;

public class HiDB {
 public static void main (String[] args) {
  try {
   Class.forName("org.postgresql.Driver");
   System.out.println("Got driver.");
  } catch (SQLException (e) {
   System.out.println("No registered driver.");
  Connection dbConnect=null;
  try {
   dbConnect = DriverManager.getConnection("jdbc:postgresql:testdb", "username",
"password");
  } catch SQLException (e) {
   System.out.println(e);
   System.out.printStackTrace(e);
  }
 }
}

4. Compile and run. You won't get a connection. libgcj.something is mentioned;
someone asked why that showed up, but that's deep in the internals. ???

Actual Results:  SQLException from Java program.

Expected Results:  Connection object returned by function call getConnection().

Additional info:

I have seen a few other notes on the archive of pgsql-jdbc at the postgresql
site from others having problems with Red Hat 8 and JDBC with postgresql. We
also can't compile from source to get around this problem.

Comment 1 Need Real Name 2002-11-22 19:46:15 UTC
I upgraded to the 7.2.3 PostgreSQL version using the Redhat downloads. Still no
luck. I tried uninstalling the packages, and building from the 7.2.3 source from
PostgreSQL, but all the configure options I wanted broke the build. I finally
had to reinstall 8.0 without the database. PostgreSQL 7.2.3 then build and
installed perfectly, and I have it up and running. It cost me days trying to
figure this out. I think that the database isn't fully supported for 8.0 yet,
just 7.3, and shouldn't have been distributed with 8.0.

Comment 2 Patrick Macdonald 2003-01-15 19:47:07 UTC
Reassigning this bug to new owner.



Comment 3 Patrick Macdonald 2003-01-15 19:48:32 UTC
Fernando,

Eventhough this is not an RHDB problem, please have a look.
Maybe it's something in the path.

Cheers,
Patrick

Comment 4 Fernando Nasser 2003-01-15 22:15:21 UTC
Dennis and I have already worked out the problem.  The jdkgcj-0.2.3-1 package
adds  a java command to /usr/bin that actually uses GNU Java.  So, if this is
installed, one has not only to set the JAVA_HOME variable but also make sure the
PATH has the Java SDK ahead of /usr/bin.  This is not a problem with the IBM JRE
(which sets the path correctly) but the Sun ones are not that smart.

We would like to see the need for setting the PATH documented in some more
general place, but the only place we have control of is the JDBC documentation
of the Red Hat Database.  I am filing a request that a paragraph be added to the
"Installing the Driver" section (Programmers Guide and HOWTO JDBC document) to
suggest that the user check if the proper java is being used and if not that the
PATH be corrected.

As there is no change in the code I am closing it as NOTABUG (I could not find
anything else more appropriate anyway).

Thanks again to Dennis for spotting this and for helping me track down the problem.