Lazy binding related


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Lazy binding related
# 1  
Old 06-27-2010
Lazy binding related

Hi,

I'm building an application that would connect to either one of the 2 databases in production. I want to keep the source code common for both environments.

The problem lies in the fact that in the target servers there will be only one of the 2 databases installed, hence the application would not be able to start as it would look up for the required libraries even though it wouldnt need them.

Can I use lazy binding here, and make my executable such that it loads libraries only when it needs to use them?

I'm developing on a Linux server and my compiler is gcc.

Thanks
Ishdeep
# 2  
Old 06-27-2010
Yes, you can use dlopen, dlsym, and so on. It just adds a lot more code.
You need to declare common functions - like maybe cursor open, cursor fetch as function pointers.

The real problem is that database apps often use a lot of variable and structs that are peculiar to one db flavor or another, and I cannot say if they will cause problems.

Consider writing a base module that does your operations as a set of very simple operations: update table, open cursor. Then write two sets of basic db intefaces that supply the functions. Link in the interface you want for each machine.

That way your business logic is in a single module, which is what you want.
# 3  
Old 06-28-2010
Thanks Jim!!

What I'm looking for is that, if it's possible to build a common executable using libraries for both databases. But the executable can start even if one of the libraries is missing in the runtime environment.

To illustrate,

Database FirstDB - libDBFirst.so which has a function ConnectFirst()
Database SecondDB - libDBSecond.so has a function ConnectSecond()

Now at runtime I want the executable to lookup these libraries only if its respective function call is made and not try to load both libraries at startup.

Thanks in advance :-)
Ishdeep
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need downloading related help...but its not related to unix

Hi All, I am trying to dowmload the zip file "zkManageCustomers.zip " but i dont have access. Can anyone help me to download this file See the below link- http://www.ibm.com/developerworks/opensource/library/wa-aj-open/index.html?ca=drs- Please help me as early as... (1 Reply)
Discussion started by: aish11
1 Replies

2. IP Networking

Binding the port number.

Hi all, Application A is using an port number 100 and is binded to an interface 1. Application B is using an port number 100 and is binded to an interface 2. can we bind the two applications on same port number based on interfaces. what i want to know is two... (3 Replies)
Discussion started by: vijaypdp2006
3 Replies

3. IP Networking

Binding the IP address

hi all, i have an udp based application that doesn't bind to any particular address. -->while sneding the packets, i have some doubts.... 1) can the packet be transmitted with an source ip address as 0.0.0.0 2) if we select an interface based on destination ip address,... (0 Replies)
Discussion started by: vijaypdp2006
0 Replies

4. IP Networking

binding problems

i had a problem when using the bind function.. that is when i create a socket and bind it with a address(usually some file name)... when i run it once it goes on fine but the second time it tells a error since there is already a socket file in that name created by my previous run... but when i... (2 Replies)
Discussion started by: damn_bkb
2 Replies

5. Shell Programming and Scripting

lazy capture don't work (regexp in perl)

hello all im trying to capture only the first brackets but no matter what i do i keep capturing from the first brackets to the last one , here what i have : <% if (!Env.strLen(oidInvoice)); szDocumentTitle = Env.formatS("S",Env.getMsg("BP_INVOICE_ENUMERATION_CREATE_TITLE")) %> and... (1 Reply)
Discussion started by: umen
1 Replies

6. HP-UX

CPU Binding in HP UX (psrset)

Hi All, I would like to know the behaviour of psrset in the following model. I have a 4 CPU machine on which i have a couple of databases running and a web application running. supposing i have processers 0 1 2 and 3 I bind processor 0 and 1 to the web application. This ensures that... (3 Replies)
Discussion started by: nileshkarania
3 Replies
Login or Register to Ask a Question