473,586 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

replicating a IDBCommand conection

george1106
14 New Member
Hi everyone...

I just was wondoring if there's a way to replicate or Clone a IDBConnection in an application.. look I'm working in a team that is developing app clientes to a kind of DB, that provide us with connections and all functionality necesary, we send instrucctions to this object and it make them happen (because it should be able to work in diferentes DB engines and it should be transparent for the clients we make)... well, the proplem is: we only have 1 IDBConnection shared into 4 clients (Historic register, reports, tendencies, and I can't remeber the other) and when ther try to work together ther interrupt each other... because the connection is occuped.

as I say before, i want to derivate or clone a Connection from this original IDBConnection provided from the central App.

If anyone knows at least a direction, it will be to appreciate.
thanks in advance :D
Feb 26 '07 #1
3 5776
george1106
14 New Member
Hi there!

I found the solution.. I just needed to create a new object with an IDBCommand wich I make an instance with the kind of the original connection (I used a switch)

IDBConnection conexion;
switch(original Connection.GetT ype().ToString( ))
{
case "System.Data.Sq lConnection":
conexion = new SqlConnection() ;
break;
case "NpgsqlConnecti on":
conexion = new NpgsqlConnectio n();
break;
}
conexion.Connec tionString = originalConnect ion.ConnectionS tring;
conexion.Open() ;

so that's all. I hope this help someone.
Mar 13 '07 #2
kenobewan
4,871 Recognized Expert Specialist
Well done :) - thanks for sharing the solution.
Mar 14 '07 #3
sanketshete3
1 New Member
You should not rely on copying connection string directly from connection object,
When Persist Security Info = False, is set in the connection string, In that case, Password
will not be set to the connection string, so you might face a login failed error.
Sep 16 '21 #4

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

Similar topics

1
2190
by: Nathan Simpson | last post by:
Hi, We have one domain with a mixture of NT PDC's one Win2K DC (which was the first installed) and 4 Windows 2003 DC's. I created our sites as per MS documentation and created the subnets that match each site. I moved each server into its own site. I then create the Inter-site transport with IP. I create one call "All Sites" and copied...
0
1260
by: Brian E. Seppanen | last post by:
I have a large number of tables in a database, and I'm looking at replicating only 5 of those 4000+ tables to about 5-7 other hosts. The primary server runs 4.0.15 and would replicate to 3.23 hosts. Is this possible. Will 3.23.58 be able to get databases updates via replication from 4.0.15? Any assistance, insights, gotcha's...
2
1299
by: Jim | last post by:
We had a two-site system go badly wrong as a result of something. The net result of this was that the publisher had to be completely reformatted and reinstalled. The server has, as a result of this, been given a different name (went from being a named instance to not being one). Currently the publisher doesn't know it's a replicating system....
3
3146
by: almousawi | last post by:
I am working on a DB2 replication program that used to work. I ran the "warm" capture program to get a cold start and I am running the apply program, but, the apply does not replicate the data. I update a test table and I see that the CD table gets new rows. But the apply program does not seem to be doing anything .. I see the asnapply is...
0
1347
by: Rojo Royo | last post by:
Hi, I am using Q replication on a system 390 running DB2 version 7. When I replicating data no problem and then suddenly someone does an online reorg, my databases loses synchronization source to target I need to refresh again because of the online reorg. Is there a parameter in Q replication that will alert it of online reprgs occuring...
0
1484
by: ceadtinneh | last post by:
We're running merge replication between to SQL Server 2000 servers. The application isn't very high volume the setup is pretty vanilla (ie no filters, etc). We have a push subscription set up and we seem to replicating data between publisher and subscriber, with one exception: When we update a particular int column at the publisher, the...
1
2721
by: Simon | last post by:
Hi All, I wanted to inherit a new SQLCommand (mostly to set default and ensure consistancy), but the class is NotInheritable, so instead I created a class implementing IDbCommand. So far so good. The problem I'm having is with the definition of the parameters (specifically the return type). IDbCommand defines them as public readonly...
1
1534
by: S.Dickson | last post by:
I am very new to all this I have a access databse wich uses a ODBC conection to mysql server. I can open the and run the database find but if i leave the dadabase loaded but do not use it when i go back to it is has lost the conection and i need to close the databse and reopen it If there a way to make sure i alwasy have a coenction
16
1945
by: aswath | last post by:
hi dere, i have a question. i have an array with replicating values.... al i want to do is delete all replicating values and store the result in another array. eg., String a={1,2,3,3}; String b; b should be 1.2.3only........not 1,2,3,3 thanks in advance, regards,
2
3364
by: Ryan Liu | last post by:
Hi, Usually should we call IDbCommand.Dispose() after done with a IDbCommand? If not, what impact to the database server? Thanks, Ryan
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.