procedure TForm1.Button1Click(Sender: TObject);
var
str1:string;
begin
//ODBC
//Provider=MSDASQL.1;Password=yantian_password;Persist Security Info=True;User ID=yantian_name;Data Source=ecpuser str1:='Provider='+proveiderEdit.text+';Password='+passwordEdit.Text+';Persist Security Info=True;User ID='+loginnameEdit.Text+';Data Source='+serverEdit.Text;
ADOConnection1.Close;
ADOConnection1.ConnectionString:='';
ADOConnection1.ConnectionString:=str1;
try
ADOConnection1.Connected :=true;
showmessage('连接数据库成功');
except
application.MessageBox('连接数据库失败,','连接错误',0);
end;
end;
请问上面的代码有误吗?
我只想用ODBC方式连接ORACLE数据库,请问有些什么步骤,比如:首先安装ORACLE的客户端,再设置数据源 ...
小弟没有做过与ORACLE 的连接,请指教。
var
str1:string;
begin
//ODBC
//Provider=MSDASQL.1;Password=yantian_password;Persist Security Info=True;User ID=yantian_name;Data Source=ecpuser str1:='Provider='+proveiderEdit.text+';Password='+passwordEdit.Text+';Persist Security Info=True;User ID='+loginnameEdit.Text+';Data Source='+serverEdit.Text;
ADOConnection1.Close;
ADOConnection1.ConnectionString:='';
ADOConnection1.ConnectionString:=str1;
try
ADOConnection1.Connected :=true;
showmessage('连接数据库成功');
except
application.MessageBox('连接数据库失败,','连接错误',0);
end;
end;
请问上面的代码有误吗?
我只想用ODBC方式连接ORACLE数据库,请问有些什么步骤,比如:首先安装ORACLE的客户端,再设置数据源 ...
小弟没有做过与ORACLE 的连接,请指教。
如果你用odbc去连接oracle,客户端是必须的,oracle有专门的客户端工具,先建好数据实例的别名,再在odbc中设数据源
强烈建议用ADO直接连ORACLE,虽然它也要装客户端,但至少不用在odbc中设数据源,少了一个环节,效率及可用性应该更好些