Subject Re: [firebird-support] Re: Database already exist when testing example - api1.c
Author Yu Ang Tan
Thanks for the reply,

I had to make sure, because I didn't know that I have to modify the examples before trying them.
It seems like I have difficulty with the isc_attach_database() as well. Here is my test code:


char user[] = "sysdba"; 
char password[] = "pass123"; 

    /*
     *    Create DPB
     *    
     */
char dpb_buffer[256], *dpb, *p;
char *loc_username;
char *loc_password;
short dpb_length;
/* Construct the database parameter buffer. */
dpb = dpb_buffer;
*dpb++ = isc_dpb_version1;
*dpb++ = isc_dpb_num_buffers;
*dpb++ = 1;
*dpb++ = 90;
dpb_length = dpb - dpb_buffer; 
isc_expand_dpb(&dpb, &dpb_length,
isc_dpb_user_name, user,
isc_dpb_password, password,
NULL);
    /*
     *    Connect to the new database and create a sample table.
     */

    /* newdb will be set to null on success */ 
    isc_detach_database(status, &newdb);

    if (isc_attach_database(status, 0, new_dbname, &newdb, 0, dpb))
        if (pr_error(status, "attach database"))
            return 1;


and I am getting this error:

[
PROBLEM ON "attach database".
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
SQLCODE:-902
]

I don't think my sysdba login is undefined, since I have set the password using 

# dpkg-reconfigure firebird2.5-superclassic


Any help at this stage would be greatly appreciated, as I am not sure how to move on from here.
Thanks in advance. 

Ang


On Tue, Nov 4, 2014 at 3:41 AM, mapopa@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 

It's an issue in how the example was written , I will fix the example to show the correct error message