Visual C++ :: ODBC Multi Connections To Same DB Or Not?

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


ADVERTISEMENT

Visual C++ :: ODBC SQLBulkOperations Obtain Identities?

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

C :: Multi User Chat Over TCP/IP In Visual Studio

Jun 1, 2014

I want to have a multi user chat over TCP/IP. I already have the code for both the server and the client and so far I am able to send messages from the client to the server. Now I want to make it a multi user chat. I am executing the codes using Visual studio's Command prompt(not Windows Command Prompt). I have read somewhere that we have to use select() function.

View 2 Replies View Related

C++ :: Access To SQL Server Without ODBC

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

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 View Related

C++ :: Multiple Connections With MySQL?

Nov 26, 2013

I created a .h file for mysql connections. In my example file, I created an array of my class and made connection with the database for each subscript of the class object one by one. Then I checked if the connection in the previous subscripts are active or not, I found all the previous connection are disconnected.

I want to establish multiple connection with database at a time.

View 1 Replies View Related

C++ :: Handling Multiple Connections?

May 18, 2012

following code because i want to handle multiple connection and want to implement in my project

Code:
int newsockfd, pid;
socklen_t clilen;
struct sockaddr_in cli_addr;

[Code]...

My Questions

1. What these lines is doing

Code:
newsockfd = accept(m_sockfd, (struct sockaddr*) &cli_addr, &clilen);

Code:
close(m_sockfd);

Code:
close(newsockfd);

2. And why there is no create(), connect(), read(), write() methods for client

View 1 Replies View Related

C++ :: Server Leaves The Connections Open

May 9, 2012

I can't run my server immediately after closing it, it leaves some connection(zombies) leave open after the server is terminated. and i have to wait for some time to run the server again but immediately can't start the server

Here is my code

#include "NetManager.h"
NetManager::NetManager(){
}
NetManager::~NetManager() {

[Code] ....

View 10 Replies View Related

C :: Linux Socket Multiple Connections But With Different Time Rate

Feb 6, 2015

i want to write a server and a client as below:

The server(and not the clients) will connect to the clients and just send a message. The idea is to be able to connect at each client a different time.

e.g
every 10mins connect at client 1
every 2mins connect at client 2
every 1hour connect at client 3
and so on...

So how to implement this ? Should i create a new child process for each connection and what about the timing ? A pseudo code also will work.

View 4 Replies View Related

C++ :: Multi Threaded Insertion Into STL Map?

Aug 25, 2014

Suppose multiple threads are are trying to insert into a STL Map, both are trying to insert with same key. As per my understanding it will not cause any issue till you invalidate the iterator. Here as per me it will not invalidate the iterator.

View 2 Replies View Related

C :: Multi Character Is Showing Error

Mar 26, 2014

When i am entering single character instead of 'miz' then it is working great. But when i am using multi character like 'miz' it is showing error output. i did this program with c++ it is working but not working in c.When i am running this program it is showing {warning] multi character constant.

Code:

#include<stdio.h>
#include<string.h>
main()
{
char a;
printf("Please Enter your First Name: ");
scanf("%s",&a);

[Code]....

View 1 Replies View Related

C++ :: How To Make Minimax Multi Player

Nov 29, 2013

I have pseudo code for the minimax algorithm but i was wondering what i would need to add to make it work with many players (n players)?

score minimax(state s, int n)
if (n = 0 OR s is a terminal node) {
if win position for program
return +inf;
if loss position for prg

[Code] ....

View 3 Replies View Related

C++ :: Multi-dimensional Arrays Of Objects

Feb 15, 2013

i want to make a two-dimensional array that is consisted by objects but i dont want to initialize the objects when i make the array.. i just want to make an array that each of his "cells" has the size of an object.For example,

class Human{
int hm=5;
...
};

and now i want to make a two dimensional array that each "cell" has the size of an Human but not a Human itself.

View 2 Replies View Related

C# :: Swapping Multi Usercontrol In 1 Winform?

Jul 29, 2014

So basically, I started out with each wizard == 1 winform, but then I found another way to do it by making the content of each wizard step a user control, then say, on initial deployment, it load usercontrol1, then when i click next, the panel hide usercontrol1 for usercontrol2 and so forth. Would it be feasible to create all usercontrols (all the wizard step) and add them in an array, then i can load them by index?

View 7 Replies View Related

C++ :: Multi Agent Path Finding

Feb 25, 2014

I am new to Path Finding so I just know BFS, DFS, Djisktra, and Basic A*

I've searched for a few multi agent pathfind paper here and there. But I can't seem to understand them..

I am path finding in a grid map, 4 ways neighbor movement

My map isn't so big it's 300 x 300 up to 400 x 400

Most of the map is open space, I would say that at worst case 4/5 of the map is open space.

And there is probably around 100 agents.

I've tried running BFS 100 times and it takes around 200ms on average

Changing BFS to A* which I am thinking right now will definitely cost lesser time

But are there better ways in doing this ? and also Does running Single Agent A* multiple times doesn't cause problem for other agent ? perhaps causes deadlocks ? ( Considering that the path that have been determine for agents before the current searched is considered blocked )

View 1 Replies View Related

C/C++ :: How To Write Multi-layered Perceptron

Jan 26, 2014

I recently wrote a perceptron that determines whether a point is above or below a line. I'm trying to write a multi-layered ANN so I can use it to solve more complicated problems than "is this point above/below this line?"

Here's my source code: [URL] ....

Considering that a A XOR B is simply (NOT A AND OR (A AND NOT , and both of those are linearly separable...

View 14 Replies View Related

C/C++ :: Make Multi Cout / Cin In The Same Line?

Nov 17, 2014

#include<iostream.h>
#include<conio.h>
main()

[Code]....

I tried to make the output look like this --> ENTER YOUR NAME:Victor Collin ENTER YOUR COURSE:BSComSci
but everytime I entered my name the course went to the next line.How to make the output in the same?

View 7 Replies View Related

C :: How To Remove Multi Character Constant Warning

Feb 20, 2013

Here's the line of code with the warning

Code: if((addressbook[3][num][4]=='-')&&(strlen(addressbook[3][num])=='10'))

Or what might be the possible causes of such a warning?

View 2 Replies View Related

C++ :: How To Share Information In Multi File Project

Dec 9, 2013

this last few days I've been coding this one particular file

Hero.cpp

namespace Hero {
namespace {
// all data here
}
}

then the code grew a bit to about 700 line

Then now I want to implement hero skill system It needs the access to data inside the unnamed namespace where I put just about everything.. but it's unnamed namespace, it's only valid within one file and I should hide all that data from Hero interface in Hero.h How should I do this ?

View 12 Replies View Related

C++ :: Delete Object In Multi-thread Situation

Feb 11, 2014

I have to delete an object at a time that I don't know it's held by another thread(s) or not. For example

static void foo(CLASS* ref){
pthread_mutex_lock(&l);//[POINT-A]
//using ref
//do something thread safe
pthread_mutex_unlock(&l);
delete ref;// how can I find out there is no any thread held at [POINT-A]
}

View 2 Replies View Related

C++ :: Passing Dynamic Multi-Dimensional Arrays

Jan 29, 2015

I need to create subfunctions to do basic Matrix mathematics (addition, subtraction, etc.) I need to be able to pass bot of my Matrices to subfunctions. I started with the addition sub function and I cant get the code to run. I keep getting expected primary-expression before ']' token error for line 75.

#include <iostream>
#include <stdio.h>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: Multi Condition Function For Char Type

Jan 30, 2013

I have always written like a>='0'&&a<='9'&&a>='a'&&a<='z' in loops etc, but no more. Basically add whatever you want to condition, and if you want point a to point b just separate them with a '-' sign. Simply

while(!isCharInside(x,"|a-zA-Z0-9.*/=|-|")){/*code*/}
bool isCharInside(char check,string condition="a-zA-Z*/+=|-|0-9"){
for(unsigned int x=0,z=getLenght(condition);x<z;++x){
if(condition[x+1]=='-'&&(condition[x]!='|'&&condition[x+2]!='|')){
if(condition[x]>condition[x+2])swap(condition[x],condition[x+2]);
for(;condition[x]<=condition[x+2];++condition[x]){if(condition[x]==check)return true;};x+=2;}
else if(check==condition[x])return true;
}
return false;}

View 1 Replies View Related

C++ :: Save The Indexes Of Multi-dimensional Arrays

Apr 8, 2014

I am working on the game of fifteen.Yes this is home work. I was wondering if it is possible to save the indexes of an element in a two dim array. I need to find the position of the space in the two dim array save it, find the position of the tile which is passed in as an int and swap the two if they are adjacent. Here is my code

Edit: I can do this by saving i and j in separate int variables but is there a more elegant way of doing this

int board[MAX][MAX];
void init();
void swap(int* lhs, int* rhs);

[Code].....

View 3 Replies View Related

C# :: T-SQL Multi Table Union To Call Out Data

Jul 15, 2014

I'm trying to union eleven tables to call out data. Parent table is 'Events', child tables are 'SR1Laptimes', 'SR2Laptimes' and so on (there are ten SR... tables). Primary key in all tables is EventName. Parent/Child relationship is Events.EventName/SR1Laptimes.EventName etc All tables that start with SR have the same Schema. I'm trying to call out MIN(Q1) across all table but first need to Union them I believe. Here is my code.

myCommand.CommandText = "SELECT MIN(Q1), MIN(Q2), MIN(Q3), MIN(Q4), MIN(LaptimesMinutes), MIN(LaptimesSeconds) FROM (SELECT * FROM Events UNION ALL SELECT * FROM SR1Laptimes UNION ALL SELECT * FROM SR2Laptimes) WHERE (Events.Track = @track) AND (Events.Number = @number) AND (Events.Rider = @rider)";
myCommand.Parameters.AddWithValue("@track", analysisTrackComboBox.Text);
myCommand.Parameters.AddWithValue("@number", analysisNumberComboBox.Text);
myCommand.Parameters.AddWithValue("@rider", analysisRiderComboBox.Text);

View 4 Replies View Related

C Sharp :: How To Delete Multi Rows In Datagridview

Sep 14, 2014

I delete rows in datagridview using chcekbox column. I write the following code:

private void btndelpay_Click(object sender, EventArgs e) {
DialogResult dr = MessageBox.Show("delete row", "do you want to delete", 
MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dr == DialogResult.Yes)

[Code] ......

my problem is /how to umcheck from rows in datagridview in chechboxes column when the user select dialogResult.NO

View 1 Replies View Related

C++ :: Handle Exception In Multi-threaded Environment

Oct 24, 2014

Here is the code,

Code:
void foo() {
Acquiring lock
do something...
Func();
Releasing Lock
}

If the function Func throws an exception, there is potential deadlock issue. Then I handle exception like this,

Code:
void foo() {
Acquiring lock
do something...
try{
Func();

[Code] ....

Is this a good practice? I wonder how I can apply RAII in handling exception here.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved