473,413 Members | 1,875 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,413 software developers and data experts.

Database connection through SP

Hello all,
i have Database1 and database2,
is it possible to make database connection to database2 by running
stored procedure on database1.

Thanks and Regards
Situ

May 16 '07 #1
8 2714
On May 16, 5:17 am, situ <SRIDHAR...@REDIFFMAIL.COMwrote:
Hello all,
i have Database1 and database2,
is it possible to make database connection to database2 by running
stored procedure on database1.

Thanks and Regards
Situ
It is possible.
But you may concern another option -- federated.

May 16 '07 #2
situ wrote:
Hello all,
i have Database1 and database2,
is it possible to make database connection to database2 by running
stored procedure on database1.
If the procedure is written in a different language than SQL, it would work.

But such scenarios are very rare and usually indicate that you work around a
possibly better solution. Would you mind telling us which problem you want
to solve?

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
May 17 '07 #3
On May 18, 2:28 am, Knut Stolze <sto...@de.ibm.comwrote:
situ wrote:
Hello all,
i have Database1 and database2,
is it possible to make database connection to database2 by running
stored procedure on database1.

If the procedure is written in a different language than SQL, it would work.

But such scenarios are very rare and usually indicate that you work around a
possibly better solution. Would you mind telling us which problem you want
to solve?

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
not at all.

we have one application instance for different databases.
in our application when a customer registers we are creating a
separate database for them,
the problem is, we are not able to bind a data source name to JNDI
name, for that to happen we need to restart the webspeare server,once
you restart then only it wil bind the data source name.

so what we are planning is to connect to a central db (database-1)
then through some procedure or through some program we make a
connection to
customer database (database-2) and direct all request to database-2.
so now i am planning to use schema instead of databases. is it going
to workout?

thanks
situ

May 18 '07 #4
situ wrote:
so now i am planning to use schema instead of databases. is it going
to workout?
schema looks like a much better fit indeed.
Note that ISVs like SAP use schemas in a similar fashion (E.g. SAP1)
You will find that Db2 9 has procedures that make it easy to copy
schema's. See under "administrative routines".

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 18 '07 #5
On May 18, 4:38 pm, Serge Rielau <srie...@ca.ibm.comwrote:
situ wrote:
so now i am planning to use schema instead of databases. is it going
to workout?

schema looks like a much better fit indeed.
Note that ISVs like SAP use schemas in a similar fashion (E.g. SAP1)
You will find that Db2 9 has procedures that make it easy to copy
schema's. See under "administrative routines".

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

May 18 '07 #6
On May 18, 4:38 pm, Serge Rielau <srie...@ca.ibm.comwrote:
situ wrote:
so now i am planning to use schema instead of databases. is it going
to workout?

schema looks like a much better fit indeed.
Note that ISVs like SAP use schemas in a similar fashion (E.g. SAP1)
You will find that Db2 9 has procedures that make it easy to copy
schema's. See under "administrative routines".

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
ok. thanks for response, but we are using db2 8.2 ..
one quesion may be not appropriate ...

why we have to drop all the objects before droping the schema, does it
serve any purpose..

Thanks and regards
situ
May 18 '07 #7
situ wrote:
why we have to drop all the objects before droping the schema, does it
serve any purpose..
So that I can make money on developerWorks :-)
http://www.ibm.com/developerworks/db...dm-0602rielau/

Seriously though in DB2 9 a drop schema procedure is provided (not the
one in the article ;-).

Sometimes it's easier and just as effective to provide a stored
procedure that does the job than to enhance built-in statement like DROP
SCHEMA.
It's pretty common practice in the industry to supplement the base DDL
with value add procedures...

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 18 '07 #8
On 5/18/2007 at 5:38 AM, in message <5b*************@mid.individual.net>,
Serge Rielau<sr*****@ca.ibm.comwrote:
situ wrote:
>so now i am planning to use schema instead of databases. is it going
to workout?
schema looks like a much better fit indeed.
Note that ISVs like SAP use schemas in a similar fashion (E.g. SAP1)
You will find that Db2 9 has procedures that make it easy to copy
schema's. See under "administrative routines".
This brings to mine something I've been wondering about. We just got
approved to purchase DB2 so we may even actually start using it now. :-)

Anyway, it's about how we do applications testing. First a little
background that will hopefully make clear why I am asking the questions...

We are a mainframe shop that uses DL/I databases and VSAM files for all of
our data. We are planning on utilizing DB2/LUW 9.1 going forward, when
feasible.

We have about 20 mainframe COBOL developers. There are times that more than
one developer may be working on projects that utilize the "same" data
repositories. By that I mean that developer 1 may be working on one project
that will require changes to programs that update the Demand System DL/I
Database. Developer 2 may be working on a different project that also
requires changes to programs that update the Demand System DL/I Database.

What happens right now is that we have eight development Demand System DL/I
Databases. The database structures are all identical (and also identical to
the Production Demand System DL/I Database). But the data in the databases
are all physically (and logically) separate. By doing this it allows more
than one developer to make changes without affecting anyone else. We also
have eight development CICS regions, each one being attached to one of the
eight versions of each DL/I Database (and each VSAM file).

Now to get to my questions. Any answer is probably feasible since we are
starting from scratch with regard to DB2 data. We have no DB2 data right
now, so I want to get started on the best possible development path prior to
actually working on real projects.

What is the best way to structure our DB2 database systems for development?
I was thinking that we'd have a single DB2/LUW instance and have eight (or
more!) development databases running within that instance. Production, of
course, would have it's own totally separate instance (probably on a totally
separate system) and have the single production database running there.

For development we'd want to have each separate database have, for the most
part, the exact same database structure (same schemas, same tables, etc.).
Only when the project at hand was to add new tables or new columns to
existing tables might one database look somewhat different than all of the
others. But even in that case, once we go in to production with the new
structure we'd want all of the other development databases, as well as
production of course, to once again look the same (with the new structure).

Does this sound reasonable? What problems might I run in to? I actually
also imagine having a "source" development database where every night we
would reload it entirely from the production database. Then when a
developer wanted production data for certain tables they could do a LOAD
from that "source" database in to the development database that they are
using.

Another question I have has to do with the use of schemas. I have never
gotten a good feeling as to what they are used for. From what "situ" is
saying it sounds like he's thinking of having a single production database
with many schema where all of the tables in each schema are the same for
each schema, with just the schema name being different. Might this be a
better way for us to design our development system? I have two possible
concerns. One is that I had thought we might utilize schema as kind of a
"system level" qualifier. By this I mean we have different systems such as
our Demand Account System (our bank checking accounts), our Savings Account
System, or Customer Information System, our General Ledger System, our Loans
System, etc.

My thought was that we might have the following schema: DEMAND, SAVINGS,
CUSTOMER, GL, LOANS, etc. Then we'd have a table called DEMAND.MASTER, one
called SAVINGS.MASTER, CUSTOMER.MASTER, etc. The DEMAND.MASTER and the
CUSTOMER.MASTER tables would not in any way resemble each other. They are
just the master tables for those particular systems. Then DEMAND would have
other tables such as DEMAND.TRANSACTIONS, DEMAND.MEMOS, etc. CUSTOMER might
have CUSTOMER.ADDRESSES, CUSTOMER.MEMOS, etc.

Doing this, however, pretty much nixes having a single development database
with many "development schemas". Another reason I don't think that using
the single database/multiple dev schema method would work has to do with
application packages. All of our application programs will be written in
COBOL and use embedded SQL static (and maybe some embedded dynamic SQL).
From what little I've done with this, it looks like we can create an
application package and bind it against a particular development database.
We then could take the resulting bind file and also bind it against all of
the other development databases without 'recompiling' the same program over
and over against each development database. The programs themselves would
simply address the fully qualified SCHEMANAME.TABLENAME, and they would
simply connect to whichever development database they want to work with.
(Obviously we would not hard code the database name into the programs.)

Essentially, it may be the case that two developers might want to run the
"same" program against the same database. But one person might be testing
the production version of the program, and thus would require the production
version of the package. Another developer might be modifying the same
application. He would then pre-compile, bind, and compile his program,
using the bind "VERSION" option so that he isn't overwriting the
"production" bind file that already exists within that development database.
Once the application was changed and put in to production then we'd, of
course, implement the new version of the package there and we'd also want to
change all of the "production" packages on all of the development
databases.

Does this all make sense? It all sounds rather more complicated that what
we do now, but hopefully not too bad.

By the way, is there a way to copy a package directly from one database to
another? Seems to be this would be simpler than having to use a source bind
file to bind new packages to each database.

Anyway, hope this all makes sense and that I'm at least going in somewhat
the right direction with all of this. As I said, we are starting from the
ground up, so any 'best practices' suggestions would be very welcome!

Thanks,
Frank

May 18 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: R Reyes | last post by:
Hi, I'm trying to modularize my database connections a little better and get more out of my project with less code. First check out this common dbOpen() function inside class clsDatabase. I...
1
by: Macca | last post by:
Hi, I have a C# Solution/Application that contain 4 projects. Each of these projects needs at some time to access the same database. I would like to know how to share a single connection...
2
by: Bryan | last post by:
Hello, I'm just starting to develop in asp.net and i have a question about using a database connection globally in my app. I have set up the procedures for getting all my connection string info...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
5
by: Matt | last post by:
Hello, What is the best way to handle the database connection string for a class library project that will be compiled and used as a .dll? This .dll will be accessed via classic ASP and in...
6
by: Arsalan Ahmad | last post by:
Hi all, I am creating a website in which in an Item detail page there are a number of web controls (7 or 8) and what is happening that inside each of control's Page_Load() function I am creating...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
4
by: Mike P2 | last post by:
Hi. I'm writing controls that have to query the database, and it bothers me that I might have several of these controls on a page that each create, open, and close their own connection with the...
3
eboschi
by: eboschi | last post by:
Hi all, i'm new to .net programming and i have some problems with database connection. I have written two web application. Both of them use ADODB Connection to Sql Server 2000 database. The problem...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
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...

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.