Two Laptop Bag
The moose likes Linux / UNIX and the fly likes sql exception : user property is missing ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "sql exception : user property is missing ???" Watch "sql exception : user property is missing ???" New topic
Author

sql exception : user property is missing ???

mudassir shahab
Ranch Hand

Joined: Oct 13, 2003
Posts: 54
hi

i am using postgres on redhat 9 ...i have written a jdbc code for connection with postgres...when i run it ....it gives the following error


SQL EXCEPTION The user property is missing. It is mandatory.


the code is as follows :

import java.sql.*;

class mydb

{

public static void main(String [] args)

{
Connection dbconn ;
Statement stmt ;
ResultSet author ;
String sourceURL = "jdbc ostgresql://localhost/synergy";
try
{

Class.forName("org.postgresql.Driver");

dbconn = DriverManager.getConnection(sourceURL);
stmt = dbconn.createStatement();
author = stmt.executeQuery("SELECT * FROM cust_info");


while(author.next())
{

System.out.println(author.getString("cust_id"));
}


dbconn.setAutoCommit(true);

stmt.close() ;

}


catch(ClassNotFoundException cnfe){

System.out.println("CLASS NOT FOUND EXCEPTION "+cnfe);

}

catch(SQLException sqle){

System.out.println("SQL EXCEPTION "+sqle);

}
}
}

plz solve it out.....
Nicolas Taillepied
Greenhorn

Joined: Jul 23, 2004
Posts: 8
Hi, I hope that you've solved your problem.
If you don't, try :
dbconn = DriverManager.getConnection(sourceURL,"your user name for postgres","your password");
instead of dbconn = DriverManager.getConnection(sourceURL);
Good luck
Nicolas
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17145
    
  27

PostgreSQL, like many modern DBMSs is designed with the idea that many users/applications will be sharing the same database(s) and that some should be allowed to do things that other aren't. A good example I saw the other day was in a financial system, where users could add transactions, but not update or remove them (in accounting, you should always add a cancelling transaction, not simply delete a bad one, so that a full audit trail is preserved).

So what a userid/password gives you is a way of attaching to a specific set of security rules. It often does other things as well, but security is one of the more important reasons.


An IDE is no substitute for an Intelligent Developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sql exception : user property is missing ???
 
It's not a secret anymore!