Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SQL Programmierung via iodbc unter linux und in c auch noch

Empfohlene Antworten

Veröffentlicht

Hi

Also ich weiß jetzt net ob mit da jemand weiterhelfen kann, aber ich würd eben gern via c auf eine DB zugreifen. Das Ganze läuft über iodbc unter linux. Ich hab nun schon ewig nach einem Tutorial im netz gesucht aber nix gefunden. Evtl hat ja hier jemand eine Idee wo man sowas findet bzw. mir ein paar fragen beantwortet:

Wie verbinde ich mich mit der DB (SQLconnect ...), wie mache ich select, insert und wie komm ich wieder an die Daten ran die bei einem Select ausgespuckt werden. PS: Ich hab ja auch noch ein Codefragment aber ich werd da ohne handbunch net so 100 % ig schlau draus.

#define SERVER "adabas"

#define UID "username"

#define PWD "password"

#define MAX_NAME_LEN 50

#define MAX_STMT_LEN 100

char pfad[150];

char endung[10];

char www2[150];

long count;

long err_count;

double all;

struct email

{

char id[100];

char from[100];

long size;

long test;

struct email *prev;

struct email *next;

};

int main(int argc, char *argv[]);

int copy_domains(HDBC hdbc);

int check_domains(HDBC hdbc);

long parse_access_file(HDBC hdbc, char *domain, char *filename, char *datum);

int parse_date(char *tmp, long *jahr, long *month, char *time_compare);

int print_err(HDBC hdbc, HSTMT hstmt);

void list_insert(struct email **head, struct email **tail, char *id, long size, char *domain);

void list_select(struct email *head, struct email *tail, char *id, char *domain);

void list_clear(struct email *head);

int main(int argc, char *argv[])

{

char filename[100];

HENV henv;

HDBC hdbc;

HSTMT hstmt;

RETCODE rc;

int i;

strcpy(pfad, "/var/log/httpd/");

strcpy(endung, "");

strcpy(www2, "");

for (i= 1; i < argc; i+=2)

{

printf("argv: %s\n", argv);

if (strcmp(argv, "-pfad") == 0)

strcpy(pfad, argv[i+1]);

if (strcmp(argv, "-ext") == 0)

sprintf(endung,".%s", argv[i+1]);

}

printf("pfad: %s\n", pfad);

printf("ext: %s\n", endung);

//Datenbank verbindung aufbauen

SQLAllocEnv(&henv);

SQLAllocConnect(henv, &hdbc);

// printf("Verbindung zu Datenbank\n");

rc = SQLConnect(hdbc, SERVER, SQL_NTS, UID, SQL_NTS, PWD, SQL_NTS);

if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)

return(print_err(hdbc, SQL_NULL_HSTMT));

sprintf(filename, "%smaillog%s", pfad, endung);

printf("Filename: %s\n", filename);

check_mail(hdbc, filename);

// printf ("\n%i %i \n", max_insert, max_clear);

}

SIcher das Programm ist noch länger aber das ist das einzige was ich bisher ingekriegt hab dass es funktioniert.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.