470,870 Members | 1,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,870 developers. It's quick & easy.

Connect to SQL Server Database using C++ language and NetBeans platform


I hope someone can help me. I want to connect to a Microsoft SQL Server 2005 Express Edition database programming in C++. I am using Netbeans (with g++ compiler) platform over Windows because I develop Java applications too.
I have tried to use some libraries (f.e. www.sqlapi.com) but I have a lot of problems because when I try to build the project it goes wrong, although I think I have imported all neccesary libraries.
I donīt know if it is because the library has been programmed with MVS or Borland C++, or simply I have forbidden to import some libraries.
The code I am trying to run is:
Expand|Select|Wrap|Line Numbers
  1. #include <SQLAPI.h>
  2. #include <ibAPI.h>
  3. int main(int argc, char **argv){    
  4.     SAConnection con;    
  5.     con.setClient(SA_InterBase_Client);    
  6.     ibAPI *pibAPI = (ibAPI *)con.NativeAPI();    
  7.     ISC_STATUS status_vector[20];    
  8.     isc_db_handle db_handle = NULL;    
  9.     isc_tr_handle dummy_handle = NULL;    
  10.     pibAPI->isc_dsql_execute_immediate(        
  11.         status_vector,        
  12.         &db_handle,        
  13.         &dummy_handle,        
  14.         0,        
  15.         "create database 'localhost:c:/test.gdb' user 'SYSDBA' password 'masterkey'",        
  16.         1,        
  17.         NULL);    
  18.     if (status_vector[0] == 1 && status_vector[1])    
  19.     {        
  20.         /* Process error. */        
  21.         pibAPI->isc_print_status(status_vector);        
  22.         return 1;    
  23.     }     
  24.     return 0;
  25. }
It is an example code from www.sqlapi.com using the especific API.
Have somebody tried to implement that code using Netbeans?
Is it posible to compile (and run) an example from Netbeans using the SQLAPI?
Do you know any C++ Web dedicated to Netbeans platform?

Thank you for your answers.
Feb 27 '08 #1
1 5890
9,208 Expert Mod 8TB
As long as your libraries are compiled for g++, then you should be good to go. Otherwise, you will have problems.
Feb 27 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Development at American Savings | last post: by
3 posts views Thread by Fabian Knopf | last post: by
3 posts views Thread by MSK | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.