连接数据库问题(急)
我的数据库连接有用户名和密码的配置文件,但连接数据库的时候会弹出窗口让你输入密码,怎么样才能让这个窗口不弹出来,系统能直接连接数据库?
部分代码如下:
配置文件:[DB]
UrlOfCpss=Provider=OraOLEDB.Oracle.1;Password=pwdofums;Persist Security Info=True;User ID=ums;Data Source= "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=191.168.10.104)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=ums))) ";Extended Properties= "PLSQLRSet=1 ";
下面是代码:
DataBase g_CPSSDB( Option::getConnectionString( "UrlOfCpss " ) );
DataBase::DataBase(String url):m_DBUrl(url)
{
CoInitialize(NULL);
m_ADOConnection = new TADOConnection(Application);
}
void DataBase::dbConnect()
{
try
{
if ( m_ADOConnection-> Connected ) return ;
m_ADOConnection-> ConnectionString = m_DBUrl ;
m_ADOConnection-> Connected = true;
}
。。。。。。
}
Template TemplateManager::findById(String id)
{
String sql = "select template_id,template_name,title,header,footer,isSeal,isLogo,seal,logo,seal_Show,logo_Show from T_FAX_TEMPLATE where template_id= "+id ;
try
{
RecordSet rs ;
g_CPSSDB.dbConnect() ;
g_CPSSDB.query( sql,rs ) ;
g_CPSSDB.dbDisConnect() ;
TemplateVector vec = translate(rs) ;
if ( vec.size() <=0 ) return Template() ;
return vec[0] ;
}
catch(Exception& ex)
{
throw new Exception(ex.Message) ;
}
}
[解决办法]
连接字符串里放好用户名和密码。
把ADOConnection-> LoginPrompt = false;
[解决办法]
ADOConnection-> LoginPrompt = false;