C++ :: Database Connectivity With OCI Library Using ODBC
Apr 3, 2013
My existing code is making database connectivity with oci library, but know we want to make the database connection using odbc on solaris/linux.
A code module has been written for the ora11gconnection ,how i should make changes in the code so that it can have odbc connectivity , and can also connect through mysql .
View 5 Replies
ADVERTISEMENT
Jan 4, 2015
Anyway, I have an assignment in which I'm supposed to create a program to be used in a library. Basically a database storing all books currently outside the library along with who and when borrowed them. It also says I should use single linked lists.
Now, I've got a general idea of how to make it work but I've stumbled upon a problem. Since the program has to write all the data put into the database in a file and be able to tell the user whether a book has been kept too long by the reader, I figured I'd implement the struct tm to convert the date when the book was borrowed (or rent, whatever, English is not my first language ;p) into UNIX time.
Then, when I'd like the program to tell me which books are being kept hostage by the readers the program would look for a certain record (like a string inside a certain struct) and compare the date inside that record with current date and then the result of this comparison would be compared with a given, defined time limit. Although this is all a different kinda function, it's a bit simplier, I guess, and I think I'll work it out. However to get there at all I need to be able to store the data correctly and there is a problem, which I'll explain on the other end of the code .Here is the code I came up with:
Code:
#include <stdio.h>#include <string.h>
#include <stdlib.h>
#include <time.h>
int DisplayMenu();
int ReturnToMenu();
int AddBooks(char *filename);
[Code] ....
So, my problem is as follows: the date seems to be stored alright, but it's wrong. For checking I had a Code: printf("%d", mktime(&date)"); added and it returned "-1"... As I said, I'm relatively new to coding/programming and my knowledge is rather rudimentary.
By the way: I had one more gremlin haunting me on this one. Namely at the begining of the input to the AddBooks function:
Code:
int flag = 0; do
{
printf("Please type in the book's title:
");
gets(newbook.title);
if (strcmp(newbook.title, "") == 0)
[Code] ....
The do while loop is to ensure 'unempty' input. Without this loop however, the program would display the message "Please type in the book's title:" but it wouldn't wait for input. It's simply jump to the next printf and wait for input then... I figured it might be becuase it took the 'Enter' that was somehow still in the memory after the user confirms his selection in the menu... It's just a guess, though.
View 1 Replies
View Related
Feb 21, 2013
I need to connect and manipulate a DB in SQL Server 2008, but need to have high performance too, so, I want to develop an class in C++ that connect direct to DBMS, in a low level, without using ADO, ODBC or OLEDB.
I found this API [URL] .... which proposes to do exactly what I want, but I need to develop it by myself.
View 4 Replies
View Related
Oct 16, 2012
I made a C++ Wrapper on top of ODBC.
I got a Connection, and a Statement class.
The Connection class holds the Database Connection ODBC Handle.
The Statement class holds the Statement Handle, there can be multiple per Connection. It is made and destroyed each time a query must be done on the DB.
Now I'm just wondering.
I have a multithreaded application.
Is keeping one Connection for one DB enough for the whole application? Where the different threads will make Statements based on that one Connection.Or is it better to keep a Connection per thread?
View 3 Replies
View Related
Dec 1, 2012
I'm using SQLBulkOperations to insert rows in bulk. I'm using SQLBindCol to bind the columns before SQLBulkOperations().
But how do I obtain the Identities? The bound buffer for the Identity column does not get filled after SQLBulkOperations()
At first I tried to use Bookmarks (column 0), but it seems that that is some other value (thought it would be filled with identities). But now I thought it must be that the bound buffer for the Identity column itself must be updated, but it's not happening. Maybe I need to do something extra?
View 1 Replies
View Related
Jan 17, 2014
I've been reading about libraries; How to make them, how to use them, the different types of libraries, etc..
When using a shared library, does the program require that library to be installed on the computer after the program has been compiled into an .exe?
Ie.. if somebody downloaded a "Helloworld.exe" that I had compiled on my computer using a shared library (that wasn't part of a standard operating system), would they also need that shared library on their computer for the program to run without errors?
and for Static Libraries, when I compile a program using a static library, does it include in the final binary only the functions of the library that are actually used, or does the compiler add in the entire library?
View 8 Replies
View Related
Feb 19, 2013
How do you install the gmp library.How do you use it?
View 11 Replies
View Related
May 11, 2013
I'm trying out the gmp library by building a simple pi calculation program (original, I know!). On a million digits of Pi I've debugged the program and seem to have about a megabyte too much of memory at the end of the program (I start with around 250k before any allocation begins and end at around 1200).
int main(int argc, char *argv[]) {
//set a//
int digitsofpi =1000000;
mpf_set_default_prec(log2(10) *digitsofpi );
mpf_t a;
mpf_init (a);
mpf_set_ui (a,1);
[code].....
View 2 Replies
View Related
Jul 11, 2013
I would like to set the bullet library to GCC. I downloaded source code of bullet but i don't know how to set that.
View 6 Replies
View Related
May 9, 2013
I have been trying to find a way around the following:
I am using a library functor to solve the root of a non linear equation. It passes two doubles and the name of a function that contains the equation to be solved.
Its xtor and operator are
RootFind(double tL,double tR,double (*fn)(double t));
void operator()(double tL,doubleR,double (*fn)(double t));
I want to be able to send another variable to function fn; I don't know what the value of the variable will be ahead of time.
How do I get the library functor to take an extra variable in the function passed?
View 1 Replies
View Related
Nov 5, 2014
I use the library opensteer, but I do not know where you should start.
Opensteer is a library written in C ++. My problem is figuring out whether to create a blank project in visual studio and import the library or directly import the library.
View 2 Replies
View Related
Mar 5, 2014
Is it possible to add more than one database in a C# program if so, how?
View 7 Replies
View Related
Feb 28, 2013
I'm trying to make a database that stores the information without overwrite it. I want this program to store the client’s selection in somewhere that doesn't change and also that creates a new storage for the new value any time the client enters a new selection instead of overwriting it. I did something like that in my code but any time the program runs again and the client enters a new selection, the client’s selection is overwritten with the new value. I don’t know if it’s possible to do that (store the client’s selection in somewhere where doesn't change) with C++. I've been reading and I think I can create a database for my program.
THIS IS MY CODE:
#include <iostream>
#include <string>
using namespace std;
// FUNCTIONS
[Code]...
View 2 Replies
View Related
Oct 5, 2014
My program add something in a data base, but after program is closed all data is removed.
conturiSQLDataSet.LoginsRow newUserRow = conturiSQLDataSet.Logins.NewLoginsRow();
...
conturiSQLDataSet.Logins.Rows.Add(newUserRow);
There is a method that program can save all data?
View 2 Replies
View Related
Oct 18, 2014
I am trying to experiment with programs and databases. Right now I am trying to set up a database so that my program, which currently just appends its results onto a text file, will instead store each result into a database, because this will make things much easier to access than trying to read specific results from an ever-larger, disorganized text file.
View 2 Replies
View Related
Jan 29, 2014
I'm attempting to write a little UDP socket library in c++ on linux so a user can just create a new instance of a UDPSocket class, specify destination ip and port, and just connect. Then the user should be able to call send() or receive() in any order they want.. and here I encounter a little problem..
Most of the tutorials for udp socket sending out there include a bind() call when you create your "server" that is supposed to receive data, but the code that send data does not need one. Because I also want my library to support unicast/broadcast/multicast, I have read that I need to set the socket option SO_REUSEADDR on my sockets (since multiple sockets will need to be connected to same destination IP/port for broadcast/multicast)
My question is.. do I need to create 2 socket handles per "UDPSocke in order to make this work? One for sending and one for receiving data? In my code when I try to work with only 1 socket, it is only able to receive stuff from itself on unicast.. Or should I just remove the SO_REUSEADDR when in unicast mode, then try to bind with both sockets, accept that the bind will only work on the 1st socket, and take it from there?
View 1 Replies
View Related
Dec 28, 2014
Any common and good library for plots ? (2D and 3D)
View 1 Replies
View Related
Jan 27, 2015
I want to create a C library function that i can directly call in my code from any .c file having main program.following are codes...code of library function "foo.c"
Code:
#include "foo.h"
int foo(int x) /* Function definition */ {
return x + 5;
} header file "foo.h"
Code:
#ifndef FOO_H_ /* Include guard */
#define FOO_H_
int foo(int x); /* An example function declaration */
}
[code]....
to use this i have to compile the file in below manner...
Code: gcc -o my_app main.c foo.c
My concern here is that i want to compile the main.c and use function without compiling foo.c with i.e.
Code: gcc -o my_app main.c
any user of this function should only compile his program and should be able to use the function, the foo.c file should remain hidden from him
my system is Linux 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
View 9 Replies
View Related
Oct 7, 2014
I am trying to refresh my memory here as I did some studies many years ago but the results elude me.Also todays c/c++ compilers may have better optimizations.Say I have a static library that includes three obj modules.Each of these object modules has a number of functions. These functions do not reference any other functions within the obj module.My main app links this library but only references one function from each of the object modules.
Question: Are the complete contents of each module linked into my main app or are todays linkers smart enough to just link the functions used?
View 4 Replies
View Related
Jan 29, 2015
What's the best performance library for loading images in PNG?
View 5 Replies
View Related
Mar 8, 2013
I am in try to use PlPlot library (for plotting) in C with code::blocks IDE (ver 10.05) on windows-7 plateform. I downloaded "plplot-5.9.9.tar" and unzipped it. In documentation it is not very clear to me (I am not expert in using third party lib.), how this library can be used with code::blocks i.e. where I have to save the lib, what should be added in compiler and debugger settings etc. It also seems from document that "makefile" (linux type!!) is necessary for Windows also? I am also unaware of MSYS makefile generator (given on Wiki page) on windows?
View 2 Replies
View Related
Feb 2, 2013
I'm completely new to C, and I don't know how to create a library using Xcode.
View 5 Replies
View Related
Feb 5, 2015
I have a problem with compiling the Allegro5 library:
"Cannot find allegro-5.0.10- monolith.mt"
source:
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <cmath>
int main() {
al_init();
al_init_primitives_addon();
al_install_keyboard();
ALLEGRO_KEYBOARD_STATE klawiatura;
[Code] ....
View 1 Replies
View Related
Aug 22, 2013
I'm trying to make a list that contains other lists. I want to use the <list> library /not my own implementation/. Here is what I do:
list<list<int>> Lists; //I create the main list
list<int> A, B; //Then I create the other lists
//After I fill them with data I add them to the main list
Lists.push_back(A);
Lists.push_back(B);
The problem comes when I try to go through A and B. I make an iterator of the main list:
list<list<int>> Iter = Lists.begin();
Then I need to make an iterator to traverse through A and B. But I can't make it. I do this:
list<int> Iter2 = Iter.begin() //But the compiler says it is not possible
How can I traverse through A and B?
View 3 Replies
View Related
Jan 18, 2015
I want to use C++ regex library, to use it in my lil' CLI game. The aim is to create the template(not C++ template :)) for command(like "go north"). Then, if player writes anything that contains "go", and "north" appearing after that(examples: "go north" "please go north" "Let's go north!" "Princess, I insist that we go to the north") would all be interpreted as simple "go north". I have used a bit of regex in Linux system, but not this ECMAScript regex that C++ uses.I've checked in some online regex tester, that if I write: ".*go.*north.*" then anything I want will be matched; however, I'd like these to be specifically separated by space(the rule is: between north and go there must be at least one character: a space, so that gornorth won't be interpreted as command.).
Bonus points: if it's possible to do that without some kind of black magic, I'd like to achieve following goals:
1)Before go, there can be any amount of characters, but if there is 1 or more characters, the character just before go must be space.
2)In between go and north, there must be at least one character, space. If there are more, then characters right after go and just before north have to be spaces.
View 8 Replies
View Related
Mar 7, 2013
I have download the SOIL library [URL] for loading textures in OpenGL, however it doesn't come with a SOIL.lib file but a file called libSOIL.a and it says I need to compile it myself.
View 11 Replies
View Related