*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 15960
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sql exception : user property is missing ???
 
Similar Threads
insert query not working
update to database problem
JDBC and JApplet
Can't connect to Oracle database
postgres connectivity failure with jdbc