Include a plug-in in CDT [message #195751] |
Fri, 23 February 2007 11:01 |
Sabeesh C.S. Messages: 21 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am using Linux as my OS and Eclipse 3.2. I want to create a programe in
Eclipse using CDT. I want to create a programe which one connecting C/C++
to MYSQL. Through the CDT I had write a programe, and it is working. For
the database connection I had write a function. My problum is that, I
want to create a plug-in for connecting with database. For that, I
download a plug-in (DB Schema Viewer) from "
http://eclipse-plugins.2y.net/eclipse/search.jsp?query=datab ase " and that
plug-in is working. I want to communicate with that plug-in through my C
programe. I want include that plug-in into my CDT programe, and
communicate with the database through that plug-in. Please help me.
My CDT programe is,
//ConnectCMYSQL.h
//--------------------------------------
#include <mysql.h>
/*This function is used for connecting the data base */
MYSQL mysql;
MYSQL_RES *result;
MYSQL_ROW row;
int C_Connect_MYSQL( char *hostname, char *username, char *passwd, char
*dbname )
{
mysql_init(&mysql);
if(!mysql_real_connect(&mysql, hostname, username, passwd, dbname,
0, NULL, 0))
{ printf("%d: %s \n", mysql_errno(&mysql), mysql_error(&mysql));
printf("Connection Refused by MYSQL\n");
return 1;
}
else
{
printf("Connect\n");
return 0;
}
}
//---------------------------------------------------------- ---
//main.c
//---------------------------------------------------------- ---
#include <mysql.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h> /* getenv(), etc. */
#include <unistd.h> /* sleep(), etc. */
#include <ConnectCMYSQL.h> /*For MYSQL Connection */
MYSQL mysql;
MYSQL_RES *result;
MYSQL_ROW row;
int main(int argc, char* argv[])
{
C_Connect_MYSQL("localhost","username", "passward", "Databasename");
/*Try to create a connection with database */
}
// you can make this programe using
// gcc main.c -L/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
|
|
|
Powered by
FUDForum. Page generated in 0.08077 seconds