Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6844073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:19:53+00:00 2026-05-27T00:19:53+00:00

I try to execute following code using gcc test.c -o test.o -ldbi command. #include

  • 0

I try to execute following code using gcc test.c -o test.o -ldbi command.

#include <stdio.h>
#include <dbi/dbi.h>

int main() {
    dbi_conn conn;
    dbi_result result;

    double threshold = 4.333333;
    unsigned int idnumber;
    const char *fullname;

    dbi_initialize(NULL);
    conn = dbi_conn_new("mysql");

    dbi_conn_set_option(conn, "host", "localhost");
    dbi_conn_set_option(conn, "username", "root");
    dbi_conn_set_option(conn, "password", "root123");
    dbi_conn_set_option(conn, "dbname", "test");
    dbi_conn_set_option(conn, "encoding", "UTF-8");

    if (dbi_conn_connect(conn) < 0) {
        printf("Could not connect. Please check the option settings\n");
    }
    else {
        result = dbi_conn_queryf(conn, "SELECT id, name FROM users");

        if (result) {
                while (dbi_result_next_row(result)) {
                idnumber = dbi_result_get_uint(result, "id");
          fullname = dbi_result_get_string(result, "name");
          printf("%i. %s\n", idnumber, fullname);
        }
        dbi_result_free(result);
      }
      dbi_conn_close(conn);
    }

    dbi_shutdown();

    return 0;
}

I have only ‘Could not connect. Please check the option settings’ as result always.

I can connect my data base using following command with password root123

mysql -h localhost -u root -p

And I can used test database in command line.

Please help me. What are the possible issues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:19:53+00:00Added an answer on May 27, 2026 at 12:19 am

    It has worked after install libdbd-mysql. Now I had install following packages.

    libdbd-mysql                   
    libdbi0  
    libdbi0-dev
    

    Thank all of you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error when I try and execute the code down below.
I am using the following Code to execute the SP of MySql and get
I'm trying to execute the following code using System.DirectoryServices; public bool HasVirtualDirectory(string serverName, string
I can compile but can't execute the following code with the error (using Postgres):
I'm using the following code to try to read the results of a df
I have following code: try{ $db->beginTransaction(); $handler = $db->prepare(...); $handler->execute() $query2 = INSERT INTO...;
I'm using the following code (from MSDN) to rename a C++ thread: #include <windows.h>
When I try to execute my code, I'm getting an error dialog: 'Show Disassembly'
Im using Debian testing, i have installed php-cli and when i try to execute
friends, i am using following code to display bitmap on screen and having next

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.