connection problem in postgresql

Started by Majo George Cheruvathurabout 20 years ago3 messagesbugs
Jump to latest
#1Majo George Cheruvathur
majogeorges@gmail.com

Dear Sir/Madam,
I am a programmer in sharjah,uae.
Now i am working in postgresql.
I cannot able to connect to postgresql.I am pasting my code here.

Class.forName("org.postgresql.Driver");
Connection conn=DriverManager.getConnection("jdbc:postgresql://127.0.0.1/*
postgres*", "*postgres*", "sadeen");

here sadeen is my password.
But i don't know what to give where i underlined.
I am working as postgres# prompt in database.

I have created database with -- create database mydatabase;
how to use that database as use mydatabase in mysql.

Looking forward to hear from you,
Yours truly,
George

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Majo George Cheruvathur (#1)
Re: connection problem in postgresql

"Majo George Cheruvathur" <majogeorges@gmail.com> writes:

I cannot able to connect to postgresql.I am pasting my code here.

Class.forName("org.postgresql.Driver");
Connection conn=3DDriverManager.getConnection("jdbc:postgresql://127.0.0.1=
/*
postgres*", "*postgres*", "sadeen");

here sadeen is my password.
But i don't know what to give where i underlined.

This is not a bug.

For help with using the JDBC driver I'd suggest the pgsql-jdbc list;
you're more likely to find people who know about jdbc there. The
people who read pgsql-bugs are mostly core-database hackers.

regards, tom lane

#3Luckys
plpgsql@gmail.com
In reply to: Tom Lane (#2)
Re: connection problem in postgresql

String url = "jdbc:postgresql://localhost/test";
Properties props = new Properties();
props.setProperty("user","fred");
props.setProperty("password","secret");
props.setProperty("ssl","true");
Connection conn = DriverManager.getConnection(url, props);

although there are different forms for the url connection string.

Do no forget to have the *.jar in your classpath.

You'd even like to look at this, http://pugs.postgresql.org/uae/

As rightly pointed out by Tom, please choose appropriate mailing list for
the respective problem,

cool.

Luckys.