-
Sep 12th, 2020, 05:04 PM
#1
Thread Starter
New Member
Trying to use SQLAPI++ with my cpp program to connect to oracle database
Hey guys! This is my first post in this forum. I've recently started using visual studio for writing programs in c++. I was using CodeBlocks before. I want to use the oracle database with my c++ program so i went and downloaded the SQLAPI++ library. I tried to write a program to see if i could connect to the database but i'm getting a linker error. Here's my code-
Code:
#include<iostream>
#include<SQLAPI.h>
using namespace std;
int main()
{
//string str("Data Source=LIBRARY;User Id=my_db_username;Password=my_db_password;Integrated Security=no;");
//cout << str.length() << endl;
SAConnection conn;
try
{
conn.Connect("LIBRARY", "my_db_username", "my_db_password", SA_ODBC_Client);
//LIBRARY is a user dsn that i created by using the odbc 64-bit admin. tool in the user dsn tab. I used the "Oracle in instantclient_18_5" driver for it.
if (conn.isConnected() == TRUE)
{
cout << "Connected successfully" << endl;
conn.Disconnect();
cout << "Disconnected successfully" << endl;
}
else
cout << "Failed to connect" << endl;
}
catch (SAException& a)
{
cout << endl << "failed miserably..." << endl;
}
}
These are the errors that i get-
Code:
Severity Code Description Project File Line Suppression State
Warning C4101 'a': unreferenced local variable DBtest C:\Users\source\repos\DBtest\DBtest.cpp 24
Severity Code Description Project File Line Suppression State
Error LNK1107 invalid or corrupt file: cannot read at 0x2D8 DBtest D:\Backup New 2k19\CodeBlocks\SQLAPI\vs2019\bin\sqlapi.dll 1
I don't know what to do >.<
-
Sep 13th, 2020, 01:49 PM
#2
Thread Starter
New Member
Re: Trying to use SQLAPI++ with my cpp program to connect to oracle database
I changed a few things in the linker settings and now the debugger shows this-
Code:
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.9.1
Child process PID: 16372
In __cxa_throw () ()
3111 odbcClient.cpp: No such file or directory.
#1 0x00426f02 in odbcAPI::Check (this=0x9e7fe8, sCommandText=..., return_code=-1, HandleType=2, Handle=0x9e8638) at odbcClient.cpp:3111
In __cxa_get_globals () ()
215 odbcAPI.cpp: No such file or directory.
#3 0x0049105b in odbcAPI::Check (this=0x9e7fe8, return_code=-1, HandleType=2, Handle=0x9e8638) at odbcAPI.cpp:215
Cannot open file: ../../../../../src/gcc-5.1.0/libgcc/unwind-sjlj.c
At ../../../../../src/gcc-5.1.0/libgcc/unwind-sjlj.c:126
Debugger finished with status 0
-
Sep 13th, 2020, 05:56 PM
#3
Thread Starter
New Member
Re: Trying to use SQLAPI++ with my cpp program to connect to oracle database
-
Jun 18th, 2024, 06:50 PM
#4
Re: Trying to use SQLAPI++ with my cpp program to connect to oracle database
Originally Posted by Lawliette
Aight it's fixed now.
how to use sqlapi++ on vb6?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|