[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Messages posted by: shivanigoyal
Forum Index » Profile for shivanigoyal » Messages posted by shivanigoyal
Author Message
Ok. My current requirement is only change of user to check Grant and Revoke.

But when I tried to disconnect and reconnect by specifying the new user in connection string it shows an error.

For example build is my Linux user.
When i tried to connect to database using this user in connection string as :

jdbc:postgresql://localhost:5432:test_db22 -user build -password password -c \;

Then I am able to connect.
But when I create a user through sql command as:

Create user A;

And then try to coonect through user A as:

jdbc:postgresql://localhost:5432:test_db22 -user build -password password -c \;

It shows an error : ERROR: database "A" does not exist ErrorCode: 0

I want to connect to database though user created by database.

Also while trying doing so, I found following things:

1) My user 'Build ' has a password, but i when I did not specify the password, it asked me for password with message: "hit enter for no password".
I hit enter it then too it connected me to database.

2) Also if i specify the wrong database name, then it connect to any running database.

example: jdbc:postgresql://localhost:5432:test_db22 -user build -password password -c \;

After connection when i do:

select current_database;
it shows: shivani_db.

While I connected to test_db22(which did not exists).


Regards,
Shivani


Hi,

I am new to JISQL.
Can anyone tell me how we can connect to another database or another user.
For example we have done create user A;
Now i want to change the user from current user to A.
How shall I do it.

In PSQL we do it like
\connect ot \c [DBNAME [USERNAME]]
 
Forum Index » Profile for shivanigoyal » Messages posted by shivanigoyal
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle