Hai all,
AM trying to connect java with database .I created class called data manager with several methods like setdburl(), getdnurl() ,etc..
i called the set functions inside another class and assign values. in set method i assigned LOCAL VARIABLE. when i call get url method it shows null value.. this my code
public class DataManager
{
Connection con = null;
private String dbURL = "";
private String dbUserName = "";
private String dbPassword = "";
private String jdbcDriver = "";
/*
* setting the values for connection elements
*/
public void setDbURL(String dbURL)
{
this.dbURL = dbURL;
}
/*
* retrieve the values of connection elements
*/
public String getDbURL()
{
return dbURL;
}
public openConnection{
con = DriverManager.getConnection(getDbURL(),root,"");
}
Thanks in advance