104 const Text_t* usr=
"scott",
105 const Text_t* pwd=
"tiger")
111 if(!myConnection)
return -1;
115 if(!myStatement)
return -1;
121 Bool_t success = myStatement->
Execute(
"select * from EMP" );
122 if(!success)
return -1;
126 if(!mySet)
return -1;
129 while ( mySet->
Next() ) {
132 int empno = mySet->
GetInt(
"empno" );
133 TString ename = mySet->
GetString(
"ename" );
134 long salary = mySet->
GetLong(
"sal" );
137 printf(
"%d - %s - %ld\n",empno,ename.Data(),salary );
141 myConnection->
Close();
151 printf(
"SQL Error: %s\n",str.Data());
164 TROOT
root(
"RDBCfirst",
"My first program with RDBC");
166 int main(
int argc,
char **argv)
168 if(argc!=3 && argc!=4) {
169 cerr <<
"Usage: " << argv[0] <<
" url username" << endl
170 <<
"or " << argv[0] <<
" url username password" << endl;
174 gSystem->Load(
"libRDBC");
177 if(argc==3) ret=
RDBCfirst(argv[1],argv[2],
"");
178 else ret=
RDBCfirst(argv[1],argv[2],argv[3]);