473,394 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

replicating a IDBCommand conection

george1106
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 5686
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(originalConnection.GetType().ToString())
{
case "System.Data.SqlConnection":
conexion = new SqlConnection();
break;
case "NpgsqlConnection":
conexion = new NpgsqlConnection();
break;
}
conexion.ConnectionString = originalConnection.ConnectionString;
conexion.Open();

so that's all. I hope this help someone.
Mar 13 '07 #2
kenobewan
4,871 Expert 4TB
Well done :) - thanks for sharing the solution.
Mar 14 '07 #3
sanketshete3
1 Bit
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
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...
0
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...
2
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...
3
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...
0
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...
0
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...
1
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...
1
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...
16
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...
2
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.