adding test scripts
[csql.git] / test / sqlapi / Csql / Connect / userauthentication.c
blobd9e0101c279cbef4888c56069b0ba3217965f457
1 /*
2 Pass correct username and incorrect password, it should fail.
3 Pass incorrect user name, it should fail.
4 Pass correct username and correct password, Connection should be established.
5 */
7 #include"common.h"
9 int main()
11 DbRetVal rv = OK;
12 AbsSqlConnection *con = createConnection();
13 //Incorrect Password
14 rv = con->connect("root","manager123");
15 if(rv==OK) {
16 printf("Test script failed with error%d\n",rv);
17 con->disconnect();
18 delete con;
19 return 1;
21 printf("Connection is not opened due to Incorrect password\n");
22 //Incorrect user name
23 rv = con->connect("root123","manager");
24 if(rv==OK) {
25 printf("Test script failed with error%d\n",rv);
26 con->disconnect();
27 delete con;
28 return 2;
30 printf("Connection is not opened due to Incorrect Username\n");
31 //Correct user name and correct password
32 rv = con->connect("root","manager");
33 if(rv!=OK) {
34 printf("Test script failed with error%d\n",rv);
35 delete con;
36 return 3;
38 printf("Connection is opened with correct Username and password\n");
40 con->disconnect();
41 delete con;
42 return 0;