logo       

Re: forName finds Driver but getConnection doesn't: msg#00235

Subject: Re: forName finds Driver but getConnection doesn't
On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> Hi All. I can't get to my carefully set-up database through java with
> a simple test program. I think I've hit most of the required set-up
> points:
>
> * I've got all the postgresql packages installed (checked with rpm
> -qa | grep -i postgres; they're there, including the jdbc one).
> * I set tcpip_socket = true in /var/lib/pgsql/data/postgresql.conf.
> * I also updated /etc/rc.d/init.d/ so that postmaster gets -o "-i";
> this means that the "pg_ctl -D /var/lib/pgsql/data status" command
> shows the -i flag was passed in.
> * I have the right driver in the classpath (I pass in -classpath
> /usr/share/pgsql/pgjdbc2.jar when compiling and running; for some
> reason, copying the jar to /jre/lib/ext doesn't work with any jars
> for me).
> * I added the lines "host all 127.0.0.1 255.255.255.255 trust" and
> "host all 192.168.0.0 255.255.0.0 trust" to
> /var/lib/pgsql/data/pg_hba.conf
> * I created a new database, "webdb"
> * I added the user "xxx" with the password "yyy" to the database, and
> verified by logging into psql with -U xxx (had pg_hba.conf set to
> password so was challenged and succeeded)
>
> With all of this, my java program has these lines:
>
> Connection dbConnection = null;
> try{
> Class.forName("org.postgresql.Driver");
> dbConnection = DriverManager.getConnection("jdbc:postgresql:webdb",
> "xxx", "yyy");
> }
>
> I get the error "java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql:webdb". (Note it's finding the driver with the
> forName() method call).
>
> I've tried using jdbc:postgresql://localhost/webdb.
>
> I have, of course, restarted the box several times.
>
> Any pointers you have would be extremely gratefully received.
>
Hello Dennis,
  jdbc:postgresql:webdb is not good URL
If you database webdb and server localhost then second URL is good
and problem is in TCP connection - what is your port ?

regards
Haris Peco

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe