Home » Open Source » Programming Interfaces » How can I connect Borland C++ builder 6 and oracle 10g??
How can I connect Borland C++ builder 6 and oracle 10g?? [message #476718] Fri, 24 September 2010 15:17 Go to next message
subhapam
Messages: 2
Registered: September 2010
Junior Member
//This is my program
//---------------------------------------------------------------
#include <vcl.h>
#include<odbcinst.h>
#include <windows.h>
#include <stdio.h>
#include <sql.h>
#include <sqlext.h>
#include <iostream.h>
#include <conio.h>
using namespace std;

int main()
{
//SQLCHAR *diagstate = new SQLCHAR[50];
SQLINTEGER native;
//SQLCHAR *msg1 = new SQLCHAR[255];
SQLSMALLINT outNo;
SQLHENV env;
SQLHDBC conn;
SQLHSTMT stmnt;
SQLRETURN ret;
long lStrLen;
char data[1000];
//Connect.
ret=SQLAllocEnv(&env);
ret=SQLAllocConnect(env,&conn);
ret=SQLConnect(conn,"project1",SQL_NTS,"system",SQL_NTS,"system",SQL_NTS);
if(ret==SQL_SUCCESS || ret==SQL_SUCCESS_WITH_INFO)
{
ret=SQLAllocStmt(conn,&stmnt);
ret=SQLPrepare(stmnt,(UCHAR*)"INSERT INTO TRIAL VALUES(2,'subha')",SQL_NTS);
if(ret==SQL_SUCCESS || SQL_SUCCESS_WITH_INFO)
{
ret=SQLExecute(stmnt);
printf("done!!!!");
}
//Disconnect
SQLFreeStmt(stmnt,SQL_DROP);
SQLDisconnect(conn);
SQLFreeConnect(conn);
SQLFreeEnv(env);
}
printf(".........");
getch();
}
//-------------------------------------------------------------

Whenever I compile or run this code. It gives the following error.

[Linker Error] Unresolved external '_SQLAllocEnv' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLAllocConnect' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLConnect' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLAllocStmt' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLPrepare' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLExecute' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLFreeStmt' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLDisconnect' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLFreeConnect' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ

[Linker Error] Unresolved external '_SQLFreeEnv' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\CONNECTION.OBJ
-----------------------------------------------------------------
My SYSTEM DSN is "project1" with USER ID "system" and PASSWORD "system" and the Table name is "TRIAL".

Please help me sorting out this problem.......
Re: How can I connect Borland C++ builder 6 and oracle 10g?? [message #476720 is a reply to message #476718] Fri, 24 September 2010 15:30 Go to previous messageGo to next message
Michel Cadot
Messages: 58494
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Using ODBC for instance or OO4O or OLE DB.
You must have an Oracle client installed on your workstation.

Regards
Michel

Re: How can I connect Borland C++ builder 6 and oracle 10g?? [message #476778 is a reply to message #476720] Sat, 25 September 2010 19:23 Go to previous messageGo to next message
subhapam
Messages: 2
Registered: September 2010
Junior Member
I have installed oracle client, but the problem still persist.Please help me in solving the problem.
Re: How can I connect Borland C++ builder 6 and oracle 10g?? [message #476779 is a reply to message #476778] Sat, 25 September 2010 23:49 Go to previous messageGo to next message
Michel Cadot
Messages: 58494
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I think you should post your question in a Borland forum.
As far I remember, Oracle no more supports Borland C++ since many years (since Oracle 7 actually), only Visual C++.

Regards
Michel
Re: How can I connect Borland C++ builder 6 and oracle 10g?? [message #476782 is a reply to message #476779] Sun, 26 September 2010 01:08 Go to previous messageGo to next message
Michel Cadot
Messages: 58494
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Here 2 answers I got from outside:

Quote:
You first need to set up and ODBC data sorce. You can do this by going to start->settings->control pannel->Administrative tools->Data Sources (ODBC)

Once you have set up your ODBC data source using the port and computername/ip for which the Oracle Database has been installed...you then can go to your start->settings->control pannel->BDE Administartor. Go to object->New then select database. Use the Oracle driver for your database.

Once all of that has been set up you should be able to drop a TTable onto your form or TDataModule and access the oracle database with the appriate table.

This should get you started in the right direction.

Quote:
Or use the OCCI libraries from borland:

1) get the Delphi Direct ORACLE Access Components from: http://sourceforge.net/projects/delphioci/
2) create a new package in BCB6, put every .pas file found on the "src" folder of the delphioci project
3) add the DesignIntf.pas file to the package (it's fund under $(BCB)/Source/ToolsAPI)
4) build and install the package. This will give you the new following components:
TAMemoryDataset, TAOraSQL, TAOraUpdateSQL, TMemoryDataset, TOraDB, TOraSQL
they will all be under the "Data Access" toolbar
5) documentation for all these components is found on the "doc" folder of the delphioci package

Regards
Michel

[Updated on: Sun, 26 September 2010 01:12]

Report message to a moderator

Re: How can I connect Borland C++ builder 6 and oracle 10g?? [message #476783 is a reply to message #476782] Sun, 26 September 2010 01:11 Go to previous message
Michel Cadot
Messages: 58494
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You also have another way on Dba Spot:
http://dbaspot.com/forums/oracle-server/7560-oracle-oci-programming-borland-c-builder.html

Regards
Michel

[Updated on: Sun, 26 September 2010 01:12]

Report message to a moderator

Previous Topic: Connect from perl directly to a schema
Next Topic: Problem recording multiple CLOB using VB - ADO (merged)
Goto Forum:
  


Current Time: Wed Jul 23 03:21:51 CDT 2014

Total time taken to generate the page: 0.12161 seconds