473,594 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2744
On May 16, 5:17 am, situ <SRIDHAR...@RED IFFMAIL.COMwrot e:
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 "administra tive 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 "administra tive 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 "administra tive 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.individua l.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 "administra tive 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.TRANSACT IONS, DEMAND.MEMOS, etc. CUSTOMER might
have CUSTOMER.ADDRES SES, CUSTOMER.MEMOS, etc.

Doing this, however, pretty much nixes having a single development database
with many "developmen t 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.TABL ENAME, 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
2474
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 removed the try/catch part as it is not important for my question: // This function opens a connection to the database. public static SqlConnection dbOpen() { // Create a SqlConnection object and pass in our connection string
1
3389
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 between these projects as i assume this would be more efficient than having a separate connection string for each project.
2
3485
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 which each page will use, but my question relates to how to use the database connection i create in all my classes. I have a database class, in a separate namespace and file, i created that handles all the connection opening, executing statements...
3
10285
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 I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
35
4825
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 string in the web.config. I created a class with a static database connection and the class opens and closes the database.
5
2119
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 the future by ASP.NET pages. I have created a constant that contains the connection string (as shown below).
6
3433
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 a database object to query data from database (using MySQL database). So it means that for each page request I am using 7 or 8 database connection which is something quite bad as far as performance is concerned. So please tell me how can change...
3
4881
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 g_sConnectionString and leave this connection open and not close it until it exits the application. Then on each thread/each subsequent sub that needs the connection I create a local OleDBConnection variable, open the connection using the exact...
4
1642
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 same connection string, and the page class has a connection object too. I'm using the code-behind way of doing things, and I considered leaving the database connection open as a field in the page's class and somehow letting the controls use that...
3
1842
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 is in second one. The first application is used for order management. I have defined in Main.aspx page a variable called localSqlConnection. Every time i enter this page (only one time per session) i create connection to local database and then i...
0
7936
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7874
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8241
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8227
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6646
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1469
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.