Connecting Two Different Databases

Jan 9, 2005

Hi,





Is there a way to connect to two separate databases at the same time through my web application?





In my web.config under the configuration/appSetting I have created two keys for database connection:


<add key="MyConn" value="server=PLMNBKPLMNBKSQLSERVER;uid=sa;pwd=xxxx;database=SourcingDB" />


<add key="MyConn2" value="server=PLMNBKPLMNBKSQLSERVER;uid=sa;pwd=xxxx;database=SeaTender" />





This enable me to pass the connection string to a session variable through a dropdownlist box and connect to the desired database.





However, I would like to create a dataset from two tables which are not in the same database, one in the "SourcingDB" and the other one in the "SeaTender".





Thanks for some guidance.





PLM

View 4 Replies


ADVERTISEMENT

Connecting Tables From Different Databases

Apr 23, 2007

Hey everyone. I am somewhat of a newbie to the database world.
I have been given the task of connecting two different SQL databases. Both are Microsoft SQL.

I want some of the tables of one of the databases to be linked to the tables of the other.

Is this possible?


Thanks

RoadHired

View 1 Replies View Related

Connecting To 2 Databases Inside One Query

Sep 16, 2004

hi there,
I saw a similar thread before but i've tried it and no luck. I want run a query off a database (stawebdata.branchinfo) then a join into bluepages.phonelist

i've tired

JOIN bluepages.phonelist p

Incorrect syntax near the keyword 'JOIN'.

any ideas... is this possible?

complete code below:

select DISTINCT b.name, b.tel1, b.id, b.telprivate,b.sc, b.manager,b.branchEmail
from branchInfo b
inner
JOIN bluepages.phonelist p on b.name = p.subdepartment
where b.name like 'Sarah' or b.id LIKE '%@keyword%' OR b.county LIKE '%@keyword%' OR b.Area LIKE '%@keyword%' OR b.Manager LIKE '%@keyword%' OR b.AssistantManager LIKE '%@keyword%' OR b.Postcode LIKE '%@keyword%' OR b.PseudoCity LIKE '%@keyword%' OR b.TicketingTA LIKE '%@keyword%' OR b.SLC LIKE '%@keyword%' OR b.ItineraryTA LIKE '%@keyword%' OR b.TIDS LIKE '%@keyword%' OR b.ABTA LIKE '%@keyword%' and
p.department = 'UK Branch' and
b.isbranch <> 'False' or
(p.lastName = '@keyword' or p.firstname = '@keyword')
order by b.name asc
GO

View 2 Replies View Related

Ways Of Connecting To Remote Databases

Mar 15, 2004

Hi everyone.

I need to know which are the best ways to connect to a remote SQL SERVER 2000 from inside a VB6 application. By remote I mean on a dedicated server outside my LAN that I can access by IP address.

Any opinion would be appreciated.

View 3 Replies View Related

Connecting To 2 Diffrent Sql Servers Databases From Single Web Application

Oct 31, 2007

i am having 2 sql servers one is web sql server  server and other server is my local sql server. i am making web application through which i want to connect both sql servers at a time and by selecting data from web server i want to insert it into my local sql server both having same database on which i want to work , i want to know how it can be done
my idea as follows in  web.config  i specify 2 connection string and by selecting data from  websql server database table i going to store it in dataset and then i return dataset to another function which connects to local sqlserver database.but database records are much large. can any body guide me .
i am going to place my web application on local server (C# asp.net 2.0) .
thank you,
 
i tried this code
c# file
 public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
Uupdatedata();

}
public void Uupdatedata()
{
string constr1=ConfigurationSettings.AppSettings["abccon1"];
string constr2 = ConfigurationSettings.AppSettings["abccon2"];
System.Data.SqlClient.SqlConnection dbcon1 = new System.Data.SqlClient.SqlConnection(constr1);
dbcon1.Open();
System.Data.SqlClient.SqlConnection dbcon2 = new System.Data.SqlClient.SqlConnection(constr2);
dbcon2.Open();

SqlDataReader dr;
SqlCommand cmd = new SqlCommand("select * from Unit_Master",dbcon1);
dr = cmd.ExecuteReader();
while (dr.Read())
{
string Sql = "insert into Table1(Unit_Id,Unit_Desc) values(" + dr.GetInt32(0).ToString() + "," + dr.GetString(1) + ")";

SqlCommand cmd1=new SqlCommand (Sql,dbcon2);
//cmd1.EndExecuteNonQuery ();

}

//dr.Close();
//dbcon2.Close();
}
 web.config<configuration>
<appSettings>
<add key="abccon1" value="Data Source=comp01;Initial Catalog=abc;User Id=sa ; Password=sa"/>
<add key="abccon2" value="Data Source=comp01;Initial Catalog=abctest;User Id=sa ; Password=sa"/>
</appSettings>
<connectionStrings/>
 this 2 databases are from single my loacl server
it wont work it gives exception
please healp me.

View 4 Replies View Related

Problem In Connecting 2 Databases With Sql Server 2005 Express

Aug 23, 2006

I am programming in VB6 using ADO 2.8. This connection and query works in MS access, SQL server 2000 and Sql Server 2005. does not work in Sql server 2005 express. Any Suggestions?

Connection String #1 Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;AttachDBFileName=C:Program FilesMaterial_Management_SystemDATAMain.mdf;Data Source=Steve_Laptopsqlexpress

Connection String #2 Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;AttachDBFileName=C:Program FilesMaterial_Management_SystemDATAItems.mdf;Data Source=Steve_Laptopsqlexpress


Sql Query: Select POLINE.ID as POLine_ID, PFMS.ID as Items_ID FROM POLINE LEFT JOIN Items.PFMS as PFMS ON POLINE.lItem_ID = PFMS.ID

Error: Msg 208, Level 16, State 1, Line 1
Invalid object name 'Items.PFMS'

Sql Query#2: Select POLINE.ID as POLine_ID, PFMS.ID as Items_ID FROM POLINE LEFT JOIN Items.dbo.PFMS as PFMS ON POLINE.lItem_ID = PFMS.ID

Error: Msg 208, Level 16, State 1, Line 1
Invalid object name 'Items.dbo.PFMS'.

I am running the queries directly from the 2005 Mgt window to take as many variables out of the equasion. I get the same error in Visual basic

How am I supposed to reference a join of 2 databases? Any suggestions

View 1 Replies View Related

Error Connecting Database Problem After Moving Databases 2000 To 2005

Nov 9, 2007

I have moved my databases to 2000 to instance of 2005 on the same server.
Now i set databases offline in 2000 as i did upgrade use backup & recovery method.

& my connection string
Password=test;Persist Security Info=True;User ID=test;Initial Catalog=databasename;Data Source=ipaddress

i was using above connection string to connect when using 2000 databases form applications in the production machine

I get the following error when i am running my applications now after moving to 2005


An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

IS it because i have two server on one server or
What do i need to do in order to fix this....tried several thing by searching nothing worked out..

Let me know
thanks


View 9 Replies View Related

Linking Tables From Different Databases Or Querying From Multiple Databases

Dec 10, 2007

Dear Readers,Is it possible, like in Access, to link to tables in other SQL databases that are on the same server? I have a query that I originally had in Access that queered from multiply databases. It did this by having those other tables in the other databases linked to the database that had the query. 
 

View 3 Replies View Related

Service Broker Not Working For Restored Databases (SQL 2000 Databases Restored On 2005)

Jan 24, 2006

I just restored my SQL server 2000 database on the SQL server 2005. after this i ran the Service broker sample ("Hello World") on this database by changing the AdventureWorks name to the new database name. The "setup.sql" runs fine. When i run the "SendMessage.sql" i was not getting any rows in the output (The message was not getting inserted into the queue). I checked the Service broker is enabled on this databased using the query "select is_broker_enabled from sys.databases where name = 'newdbname' " It was 1. I even tried the ALTER DATABASE SET ENABLE_BROKER. but it didnt work.

When i tried the sample on a newly created database it worked fine.

Is there any solution to make the restored database to work for service broker.

Thanks

Prashanth

View 3 Replies View Related

Copying Databases Between Databases

Feb 8, 2000

hi from France !!!

i would like how to duplicate a database to another server with all datas, constraints, keys, indexes...
should i use sp_attach_db, dts, backup/restore, sql scripts... ???

thanks to all, nico

View 1 Replies View Related

Connect From Databases In 1st Instance To Databases In 2nd Instance

Mar 13, 2007

This is the scenario. Is it possible to create views or something (like Oracle DB Links) in a database in Instance 1 which can show data from another database in 2nd Instance ?


I want to do this to create reports.

View 2 Replies View Related

Connecting To SQL In ASP.net 20

Aug 6, 2006

I have a database that is currently connected and working properly in My SQL Server Management Studio. The problem I am havings is when I open My ASP.net 20 and Look in my Server Solutions I can not  find the database to connect to it . It seems to be trying to use SLQ Express and not my SLQ Server Management Studio. How do I get my database to connect in my application? All I can see from within the Server solutions in ASP is the database .bak file which is the backup of the database. I thank you in advance.

View 5 Replies View Related

Connecting To SQL 6.5 With VB.NET

Apr 5, 2004

Hi,

I am trying to connect to a SQL 6.5 database with VB.NET.

Is this possible, and if so, what kind of connection string is used and what mode of data access (OleDB, ODBC, etc.)

I have had several problems doing this and I am starting to wonder if there is anything special that needs to be done or if it is even possible. Thanks in advance!

View 3 Replies View Related

Connecting To SQL 6.5

Oct 28, 1999

Has anybody experienced SQL 6.5 to stop responding to new connections to the server but still letting the existing connections run?

View 1 Replies View Related

Connecting To DB

Sep 21, 2004

is ther a system stored procedure to connect to a database passing the username and password as parameters.. ??

View 6 Replies View Related

Connecting To 6.5 Over TCP/IP

Dec 8, 1999

I am trying to connect through a wan over TCP/IP to a SQL Server v.6.5 sp5a.
I am not logging into the domain, I am just trying to connect via ODBC. I keep getting an error 1326
which when I look in TechNet or MSDN refers to problems with Named Pipes. I have
TCP/IP configured for port 1433, Named Pipes, and Multiprotocol support all configured on the server.
Should I remove the Named Pipes support, or is that not the problem?

View 1 Replies View Related

Connecting To SQL DB

Jan 13, 2005

Hi,

I have a server (Server A) and would like to retrieve a query from a SQL DB which is held on another server (Server B), if I created a VPN or opened a port from one server to another could I acheive this?


BTW I do not have SQL running on the Server A


Am I asking for trouble?

Thanks,

Sanj

View 1 Replies View Related

Connecting To MS SQL

Mar 2, 2004

Hey everyone. I'm having some serious problems connecting to my database. I've pretty much bugged my server admin to death and I still can't connect to it. I've tried almost all the programs out there as well as http://www.aspenterprisemanager.com. I've probably spent a good 12 hours on this task (im trying to put MaxWebPortal on my site) and I'm going to ask for help. This is what my admin gave me for the SQL db:

Database Name: S5464_sehs
SQL Server: mssql4.uplinkearth.com
ODBC DSN: S5464_sehs
Username: sehs.us
Password: **********

Would anyone be able to help me to connect to this?

View 4 Replies View Related

Connecting To Sql 2k Thru Sql 7 EM

May 17, 2004

Can I connect to SQL server using sql 7 EM? currently it is not allowing me
to connect, but some one told me that there is a work around.Anyone heard/aware of it?

Regards,
Harshal.

View 3 Replies View Related

Connecting To Dbf

Aug 21, 2006

Hi,

I am having trouble connecting to a dbf file inside an SSIS package. How do I connect to a dbf file in SSIS.



Thanks

Brian

View 1 Replies View Related

Connecting From VS.net

Jan 16, 2008

Hey all! I am new in this form and also new with the SQL serve. I have installed that free express edition of SQL server 2005 and when i am trying to connect to server from my C#.net application i am not able to do it and the error i am getting is the user is not SQL thrusted user. I am able to connect directly thru SQL server using this userid and password but not thru C#.net application.

I have read online that so many people are having that problem. so is it the problem of swl server Express edition or do i have to make some setting to connect to the application.

Please please please please someone guide me . I am stuck here in the beginning only. I would really appreciate it.

the code that i wrote is here:----

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page

{



protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsPostBack)

{

}

}
protected void Submit_Click(object sender, EventArgs e)

{

String querry;

SqlDataReader dbread;

try

{

SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["Conn1"]);

SqlCommand comm = new SqlCommand();

conn.Open();

querry = " Select password from login where userId='" + TxtUser.Text + "'";

comm.CommandText = querry;

comm.Connection = conn;

dbread = comm.ExecuteReader();

dbread = null;

if (dbread.HasRows)

{

while (dbread.Read())

{

if (dbread["password"].ToString() == Txtpwd.Text)

{

Response.Redirect("home.aspx");

}

}

Response.Write("Your Password Doesn't Match");

}

else

{

Response.Write("Your User Name Is Wrong");

}

conn.Close();

}

catch (Exception ex)

{

Response.Write(" This is an Error - " + ex.Message );

Response.End();

}



Thanks,
Komal

View 3 Replies View Related

Connecting To IBM DB2

Jul 18, 2007

We need to connect to an DB2 server using ODBC provider, so we tried witht he folowing:



Driver={IBM DB2 ODBC DRIVER};database=FirstDB; hostname=IP address; port=50000;protocol=TCPIP;



But when we try to connect using the above connection string we get teh following error:



"Test Connection failed because of an error in initializing provider. ERROR [IM004][Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed"



we are not getting wat is the problem. we are able to connect to this DB2 database from the same DB2 server but we are not able to connect to the server from a remote machine.



Thanks in advance.

View 1 Replies View Related

Connecting Through C#

Jan 23, 2007

When I look at the connection string it's:



Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ProcBuilder.mdf;Integrated Security=True;User Instance=True



This works fine on my machine, but when I try to run it on another computer it tells me:



"An error has occurred while
establishing a connection to the server. When connecting to SQL Server
2005, this failure may be caused by the fact that under the default
settings SQL Server does not allow remote connections."






It should not be trying to connect remotely, it's a local DB. Do I
have to install SQL Express on the machine I'm installing this on for
it to work?

View 1 Replies View Related

Connecting .mdf Through RDA

Feb 8, 2008

Dear All,

We have Database in local system and another database in remote system.
We have to connect to the database in the remote system through RDA.
How can we achieve this?
Kindly help.
Thanks in advance.

Regards,
Sasi.

View 6 Replies View Related

Connecting To Sqlserver In Asp.net

Jul 15, 2006

hi , I want to connect to sqlserver2000 with VS.Net2003 in Asp.net I
've added a new user in security section in enterprise manager and
wrote my code , but there is no output from database , codes are
correct and I think there is something wrong with sqlserver or IIS or
sqlconnectin setting , plz help me to fix my problem , tnx .

View 2 Replies View Related

Connecting To SQL Issue

Aug 2, 2006

I have a mdf file and log file from msde. I have successfully connected to it in my Visual Studios ASP.net 2.0 Desktop. I am having a problem where it connects. fine but it does not list the tables , diagrams etc. I am trying to build the intake screen with this data but have no tables. Can some one give me a couple of suggestions of why? I am very new to ASP.net and would appreciate any help .

View 4 Replies View Related

Error While Connecting

Sep 18, 2006

Hey all,I am new to ASP.NET. While executing a simple  code , i got the error: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.Whats wrong? RegardsYasir

View 1 Replies View Related

Connecting Instructions?

Dec 19, 2006

My host sent these instructions, think they will work?
To access your SQL Server you can use your choice of database management software, including Microsoft Access, Visual InterDev, or the SQL Enterprise Manager.
If you are using Microsoft Access or Visual InterDev you will be connecting to the SQL Server via an ODBC connection, which requires you to make a Data Source Name (DSN) on your local computer.
If you have a Microsoft Access database, and you use the Microsoft SQL Upsizing Wizard to export your database into SQL, the Upsizing Wizard will assist you in the process of creating your ODBC connection.
To create a SQL DSN:
 
1. Log on to your hosting account's control panel at http://sahcinfo.org/admin 2. Click "Database Connectivity."
3. Choose "Create DSN."
4. Choose "Microsoft SQL Driver" from the Type drop-down list.
5. Enter a name for your DSN in the DSN field. It can be anything you want it to be, such as "Orders" or "MyDatabase." The Filename field is not required for SQL.
6. In the SQL IP Address field, enter the SQL Server name.
7. Enter your SQL user name in the SQL User Name field.
8. Click Submit.
To access the SQL Server using the SQL Enterprise Manager:
1. Open your SQL Enterprise Manager software. This is not supplied by Web.com.
2. Right-click on "SQL Server Group", then select "New SQL Server Registration"
3. Once the dialog box is open, fill in the fields. In the server field, type in your SQL Server name.
4. Type in the login information with your username and password.
5. Once all the information is entered click "Register." This will make contact with our SQL Server, and you will be able to add tables, manipulate your information and work on your database as you wish.
Please note that Web.com Technical Support will only troubleshoot connectivity to the SQL database, and cannot support issues with third-party software.
Web.com has also created a SQL 2000 User Guide to walk you through the process of setting up your account and database connections. To view or print it, go to http://64.226.3.32/article.asp?article=14689&p=1001
 
 
 
 

View 2 Replies View Related

Connecting To MSSQL In VBA?

Jan 9, 2007

This is kind of the wrong place to ask VBA questions, but I've been poking around for a day and haven't got the answer, so I am hoping I can get some help here.
 I am wondering if I can connect to MSSQL in MS Word Macro. If so, can I have some sample code please?
 Thanks

View 3 Replies View Related

Connecting To SQL Error 40

Mar 9, 2007

I'm trying to connect to an SQL server, but I'm unable. It suggests this is because SQL server does not allow remote connections, and points me to the named pipes provider, error 40 Could not open a connection to SQL server.
I am running SQL express service pack 2 under Vista. I am a member of SQL administrators (set during installation).
 Under the SQL Server Configuration manager, SQL server and Browser are running, the protocols for sqlexpress and the native client have enabled shared memory, named pipes, and tcp/ip.
I tried removing and creating a new database. Now it sits under the database Engine section of Management Studio Express, with a white circle on the database icon. When I try to connect to this database, using either windows authentication or sql server authentication, it fails.
 What else is there to try? If there was a troubleshooting guide, that would be helpful.

View 1 Replies View Related

Connecting SQL Server To The Net?

Jun 28, 2007

Hi all.  Im using Visual Web developer 2005 and have successfully connected my SQL Server to Visual Web developer website.  When i run it locally, its fine.  But, i now would like the site to be placed on the net - but im not sure how to connect it properly in the webhost.  Can someone tell me how this is done please, or a link?  cheers.

View 4 Replies View Related

Connecting To A Remote OLE DB

Sep 2, 2007

Hey, all. I've mainly worked with MySQL databases before. I'm working on an (old) ASP page that uses this connection string:strConnect = "Provider=SQLOLEDB; Data Source=SQL1.MYDBSERVER.NET; Initial Catalog=...; User ID=...; Password=..."
It works fine on the production server, but the local copy fails if I try to access the Products page (which uses the database), with this error: Microsoft OLE DB Provider for SQL Server (0x80004005)[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied./html/products.asp, line 19Similarly, if I plug the connection info into Tools/Connect to Database in Visual Studio, I get: Connection failed:SQLState: '08001'
SQL Server Error: 17
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied. Am I doing something wrong? Do I need more info from the hosting provider to connect remotely? Or is the database not accepting remote connections at all?Thanks in advance for your help!

View 1 Replies View Related

Connecting To SQL Server

Sep 12, 2007

Hi, I have a problem in logging in to an SQL Server database engine. I can log in to the engine with Windows authentication method. The problem is, when I create a page with an SqlDataConnection control, the page can not connect to the database engine eventhough I select "Use Windows Authentication" when configuring the SqlDataConnection. What should I do?Best regards,Haris 

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved