I have this code but it have the problem about load file. Please help me load the file I need("ODBC-JDBC Driver.properties")
import java.io.*;
import java.sql.*;
import java.util.*;
public class TestCode {
static final String PROPERTY_FILE="ODBC-JDBC Driver.properties";
String driverName, url, user, password;
public void Test() {
try{
Properties prop=new Properties();
prop.load(new FileInputStream(PROPERTY_FILE));
driverName=prop.getProperty("driver"); // Retrieve driver information.
url=prop.getProperty("url"); // Retrieve JDBC URL.
user=prop.getProperty("user"); // Retrieve user name.
password=prop.getProperty("password"); // Retrieve password.
Class.forName("driverName");
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT * FROM Registered_Users_Information");
while(rs.next()){
System.out.println(rs.getString("UserName"));
System.out.println(rs.getString("Password"));
}
}catch(Exception ex){
ex.printStackTrace();
}
}
public static void main(String args[]){
TestCode t=new TestCode();
t.Test();
}
}
Thanks.