944,098 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1122
  • Java RSS
Aug 25th, 2007
0

problem in accessin table values from access database..

Expand Post »
Hi all..

I am having a table named "login" in MS access..
I am connecting it to a java application with th help of the following code..

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Driver loaded");
// Establish a connection
connection = DriverManager.getConnection("jdbc:odbc:ESMDB");
System.out.println ("Database connected");
String result="";
st = connection.createStatement();
rs = st.executeQuery("SELECT * FROM Login");

while(rs.next())
{

String user= rs.getString(1);
String pw=rs.getString(2);
System.out.println(username+password);

I am getting null value when i try to execute "select * from Login"..
what could be the reason..?Someone help in this regard as early as possible.


Regards,
Balagurunathan S
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
BalagurunathanS is offline Offline
26 posts
since Apr 2007
Aug 25th, 2007
0

Re: problem in accessin table values from access database..

what "null value"?
It's highly unlikely the ResultSet will be null, though with that bad driver you're using it could maybe happen (as it was never intended to be more than a technology demonstrator, and possibly poorly written).
The database could contain NULL values for you to retrieve, if so you will indeed get them back.
It's your responsibility to handle those in some way appropriate to the data you're retrieving (maybe you get NULL for a password if it's not been set for example).
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Please Help me......error in compiling
Next Thread in Java Forum Timeline: How to learn Java





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC