database.sarang.net
UserID
Passwd
Database
DBMS
ㆍMySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
MySQL Q&A 74 게시물 읽기
No. 74
Re: c 라이브러리 예제 소스 구할 수 있는곳? (mysql) -> 메뉴얼
작성자
fith
작성일
1999-11-01 18:46
조회수
16,106

> libmysqlclient.a를 써서 컴파일했습니다.

> 아주 기본적인 내용 콘솔로 프린팅하는 내용입니다.

>

> 그랬더니 아래와같은 내용이 출력되는군요..

> [greatlee@hera mysql]$ !g

> gcc -o connnect connect.c -lmysqlclient

> /usr/lib/libmysqlclient.a(password.o): In function `scramble':

> password.o(.text+0x3b4): undefined reference to `floor'

> password.o(.text+0x439): undefined reference to `floor'

> /usr/lib/libmysqlclient.a(password.o): In function `check_scramble':

> password.o(.text+0x5ae): undefined reference to `floor'

> password.o(.text+0x638): undefined reference to `floor'

>

>

> 원본 소스입니다.

> #include <stdio.h>

> #include "mysql.h"

>

> void main() {

> MYSQL mysql;

> MYSQL_RES *res;

> MYSQL_ROW row;

>

> mysql_connect(&mysql, "localhost", "?", "?");

> mysql_select_db(&mysql, "bk");

> mysql_query(&mysql, "select * from bk");

> res = mysql_store_result(&mysql);

> while (row = mysql_fetch_row(res)) {

> printf("%s %s %s %s

", row[0], row[1], row[2], row[3]);

> }

> puts("Bye!");

> }

>

 

#include <stdio.h>

#include "mysql.h"

 

MYSQL mysql;

MYSQL_RES *res;

MYSQL_ROW row;

 

main() {

char *host = "localhost";

char *uid = "foo";

char *pwd = "bar";

char *db = "foo";

 

mysql_connect(&mysql, host, uid, pwd);

mysql_select_db(&mysql, db);

 

mysql_query(&mysql, "select * from foo limit 5");

res = mysql_store_result(&mysql);

 

while (row = mysql_fetch_row(res)) {

printf("%s %s %s %s

", row[0], row[1], row[2], row[3]);

}

puts("Bye!");

}

 

gcc -o foobar foo.c -I/MYSQL절대경로/include/mysql -L/MYSQL절대경로/lib/mysql -lmysqlclient

 

 

[fith@www test]$ ./foobar

1034 1998.09.09 1998.10.01 정상

1149 1999.01.25 1999.01.26 제한

1073 1998.11.09 1998.11.23 정상

1093 1998.12.01 1998.12.15 정상

1178 1999.02.18 1999.02.19 정상

Bye!

[fith@www test]$

[Top]
No.
제목
작성자
작성일
조회
79perl 로서 mysql 을 제어하는 방법은??
이상모
1999-11-03
14705
80┕>Re: perl 로서 mysql 을 제어하는 방법은??
문태준
1999-11-03 23:23:47
15416
92┕>Re: perl 로서 mysql 을 제어하는 방법은??
문태준
1999-11-08 21:02:45
15498
77IP 바뀐후 mysql_connect 가 안됩니다..
백현
1999-11-02
14702
78┕>Re: IP 바뀐후 mysql_connect 가 안됩니다.. -&gt; 72번 참고
문태준
1999-11-03 13:12:59
15535
75mysql과 c를 이용해서 게시판을 만들다보니......
LTK
1999-11-01
15503
76┕>Re: mysql과 c를 이용해서 게시판을 만들다보니...... -&gt; 소스보세요
문태준
1999-11-02 00:53:02
15607
73c 라이브러리 예제 소스 구할 수 있는곳? (mysql)
이병기
1999-11-01
15459
74┕>Re: c 라이브러리 예제 소스 구할 수 있는곳? (mysql) -&gt; 메뉴얼
fith
1999-11-01 18:46:36
16106
71php3.0.12로 바꾼후에 MySQL 접속불가..
김철민
1999-10-29
15920
72┕>Re: php3.0.12로 바꾼후에 MySQL 접속불가..
문태준
1999-10-29 20:41:42
17128
67date type????
김민정
1999-10-28
16512
68┕>Re: date type????
장석규
1999-10-28 18:45:45
17194
70┕>Re: date type????
정재익
1999-10-29 01:43:45
17950
64전 컴파일을 직접했는데여.. 정확히 무슨 파일이죠?
백현
1999-10-28
17709
65┕>Re: 전 컴파일을 직접했는데여.. 정확히 무슨 파일이죠?
이정환
1999-10-28 15:47:08
18268
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.051초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다