problem in accessin table values from access database..

Reply

Join Date: Apr 2007
Posts: 26
Reputation: BalagurunathanS is an unknown quantity at this point 
Solved Threads: 0
BalagurunathanS's Avatar
BalagurunathanS BalagurunathanS is offline Offline
Light Poster

problem in accessin table values from access database..

 
0
  #1
Aug 25th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

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

 
0
  #2
Aug 25th, 2007
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).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC