Missing parameter in Jdbc Ms access connection

hi everybody?

how are you doing?

i have a small problem

i hope helps me get rid of it

the problem is:

i wrote a servlet which makes a connection to an MS access database and retreives a data.

I am having an exception saying that one parameter is missing ?Can someone tell me what is wrong with this code? Thanks :)

here is the code snippet:

import java.io.*;

import java.sql.*;

public class dbconn {

Connection con = null;

String user="yilmaz";

String username,userpassword="";

String sql="select pass from members where user='yilmaz'";

Statement st=null;

ResultSet rs=null;

//public String main(St

public String connectDatabase() {

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con = DriverManager.getConnection("jdbc:odbc:focus&userid=&password=");

st=con.createStatement();

rs=st.executeQuery(sql);

while(rs.next()) {

username=rs.getString(1);

userpassword=rs.getString(2); }

return userpassword;

} catch (SQLException e) {

System.out.println("Could not connect database :"+e.getMessage());

return userpassword;

}

catch (IOException ioe) {System.out.println(" IOexception "+ioe.getMessage()); }

}

public void closeConnection() {

try {

if (con != null)

con.close();

} catch (Exception e){

System.out.println("error: can not close database connection"+e.getMessage());

}

}

}

[1630 byte] By [yilmazay] at [2007-9-26 5:40:32]
# 1

Use

e.printStackTrace()

This will tell you the line that the error occurs on.

I would suspect that the error is on the getConnection() line. I have never seen '&' used in a connection string. I have seen ';'. And usually user/pwd a just passed in as argements to the getConnection() rather than putting it in the connection statement.

jschell at 2007-7-1 13:55:49 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...