How To Connect To Multiple Database?

May 16, 2006

Is it possible to connect to 3 database and execute a cross db query?

I usually use SqlConnection(connectionString) for a single connection

View 1 Replies


ADVERTISEMENT

Can Multiple Apps Connect To The Same Database?

Aug 31, 2006

I have an application that was developed under Visual Basic .NET 2005 Standard that I keep continuously running to monitor and gather data and store that data in a SQL Server Express database. This is all done on a single computer that's not networked to anything. The trouble is, I'd like to look at the data in the database from time to time without shutting down the application, but I'm not able to do so. If I try to copy the database files, named lamination.mdf and lamination.ldf, to another location, I get the following error message;

"Cannot copy lamination: There has been a sharing violation. The source or destination file may be in use."

I would like to be able to copy the file to my office computer where it would be convenient to use Management Studio Express to look at the database tables. I can't even use Management Studio Express on the computer where the application is running, as I get the following message when I try to attach the database:

"CREATE FILE encountered operating system error 32(The process cannot access the file because it is being used by another process.) while attempting to open or create the physical file 'C:Documents and Settings barnardMy DocumentsVisual Studio 2005ProjectsLamination Phase ILamDataBaseLamination.mdf'. (Microsoft SQL Server, Error: 5123)"

Here is the connection string in the VB application:

"Data Source=.SQLEXPRESS;AttachDbFilename="C:Documents and Settings barnardMy DocumentsVisual Studio 2005ProjectsLamination Phase ILamDataBaseLamination.mdf";Integrated Security=True;User Instance=True"

In the VB app, connections to the database are made only every few minutes, and the connections are immediately closed.

Is there anyway I can either copy the database files, or at least look at the database tables with Management Studio Express without stopping the VB application?

Thanks,

Tim

View 7 Replies View Related

How To Connect To A DB Multiple Times Through Page

Dec 21, 2007

Hey all,
I am still pretty new to all of this and I am having problems accessing a the same DB twice in my page.  I want to pull information once in one spot, but then pull different information in a different spot on the page.  Anyway, in the first spot, I have the following code:
Dim conString As String = WebConfigurationManager.ConnectionStrings("DataConn").ConnectionString
Dim con As New SqlConnection(conString)Dim cmd As New SqlCommand("Select Team1.TeamID as Team1ID, Team1.TeamName as HomeTeam, Team2.TeamID as Team2ID, Team2.TeamName as AwayTeam, Football_Schedule.ScheduleID as ScheduleID from (Select * from Football_Teams) as Team1, (Select * from Football_Teams) as Team2, Football_Schedule where Football_schedule.team1 = Team1.teamid AND Football_Schedule.team2 = Team2.teamid order by Football_Schedule.WeekNum, Team1.TeamName, Team2.Teamname", con)Using con
con.Open()
Dim RS As SqlDataReader = cmd.ExecuteReader()
While RS.Read()
blah blah blah
End While
End Using
 
Then in my other spot on the page I have the following:
Dim cmdresults As New SqlCommand("Select Users.Firstname, sum(PointsID) as TotalPoints from Football_Input, Football_Schedule, Users where Football_Input.TeamID = Football_Schedule.winID and users.userid = Football_Input.UserID Group by Users.firstname")
Using con
con.Open()Dim RD As SqlDataReader = cmdresults.ExecuteReader()
While RD.Read()%>
<tr>
<td><%=RD%>
</td>
</tr>
<%End While
End Using
 When I try to execute I get this error, "ExecuteReader: Connection property has not been initialized." on the following line, "
RD As SqlDataReader = cmdresults.ExecuteReader()"  Any ideas?  If possible a little explanation on how multiple connections to the same database work would be nice just for future reference.
Thanks in advance!!,
Chris

View 5 Replies View Related

Connect Multiple Servers In MS SQL Server Express

Jun 26, 2007

How do I connect DB's on different servers? I can't find a good explanation that works for me.

View 1 Replies View Related

Connect To Multiple Databases In Foreach Loop

Jun 21, 2008

I have sql task inside a foreach loop which needs connection to multiple databases on different servers. I can pass the server name and the database name as a parameter. Can someone please tell me what steps to follow? Thanks in advance

View 2 Replies View Related

Can't Connect To Multiple SQL Instances Over The Internet With SQL Browser Service

Nov 2, 2006

I recently setup mutliple instances of SQL Server Express at my office. I have 1 default instance, and two named instances. I can connect to the named instance of the default port of 1433 with Microsoft SQL Management Studio Express, however the other instances on dynamic TCP ports can not be accessed by the instance name over the internet. I have to specify the dynamic TCP port in this form: xxx.uconn.edu/SQLTEST, Port number. My current thinking is that the SQL Browser service should tell Management Studio Express what dynamic port number each SQL instance is listening to. Any ideas?

View 1 Replies View Related

Multiple FTP Tasks That Connect To Same Server At Same Time Error

Apr 2, 2007

I have this job that download 4 files once a month from the same server. The files are sizable and I need to download them in less than 5 hours total. In 2000 I use an active x script to generate the ftp script then execute the script. all four files download at the same time in 4 different tasks with no issues.

I am rewrote the process in 2005 so that it uses the IS FTP function but when all 4 ftp tasks kick off they all fail... instantly. the initially shared the same FTP connection manager so I created different ones for each and still the same result

the error is one that relates to changing directories.... Now if I just run one of the tasks it runs fine it is just when more than one try to run at once. I ended up putting in 10 second delays between each ftp task kicking off and it works just fine...



Does this sound like a bug??



Also... I am on SQL 2005 Enterprise SP1 on Windows 2003 enterprise SP1.



View 3 Replies View Related

Creating A Database From Multiple Databases Accross Multiple Servers

Sep 13, 2007

Hi,

I'm trying to create a database that takes specific information from a number of databases on different servers to make some reporting that we have much easier.

I'm pretty new to SQL so I'm not sure of the best way to proceed. I read an article that suggested I use the OPENROWSET command. The problem is, the version of SQL that came with one of the programmes we use is limited and will not allow you to turn on the allow "Ad Hoc distributed Queries" so the SLQ statement will not execute.

I'm confused why it won't let me to connect through ODBC as I've created a web page that selects data from this database with no problems!

Here is the SQL statement that I've written to make sure it is the correct one (on the msdn library page it said that this was the ODBC connection):

SELECT a.*
FROM OPENROWSET('MSDASQL','DRIVER=(SQL Server);SERVER=APPOLOACT7;UID=sa;PWD=***************',
'SELECT * FROM MDCTestAndDev.dbo.TBL_CONTACT') AS a



I've also created the ODBC connection using the tool on Administration Tools>Data Sources ODBC

Any help would be greatly appreciated (also any ways of selecting from one database and inserting it into another will be helpfull)

Thanks

View 8 Replies View Related

Delay Between CREATE DATABASE And Ability To Connect To That Database

Oct 9, 2006

I have an application that creates a new database during installation,and I've noticed some strange behavior. Once I've created thedatabase, I am able to immediately create tables and populate lookupdata, provided I remain connected to the server. If, however, Idisconnect and attempt to reconnect immediately, I'll get an errorsaying that my login is invalid for the new database.I can get around this by having my code simply wait 5 seconds beforeattempting to reconnect, but I'm curious to see if anybody here cangive an explaination for why this is happening. Here is a bit ofpseudo code to explain what I'm seeing:open new connectioncreate databasecreate tablespopulate tablesclose connection// open new connection /* can't do this yet, as it would break */for (int a=0; a<5; a++){Thread.Sleep(2000)try{open new connectionbreak;}catch{Debug("still waiting...");}}Running my version of this code, I'll see that "still waiting..."message go past 2-3 times before SQL Server wakes up and realizes thatI'm allowed to connect to it. Anybody know why?Thanks,Jason KesterExpat Software Consulting Serviceshttp://www.expatsoftware.com/---Get your own Travel Blog, with itinerary maps and photos!http://www.blogabond.com/

View 1 Replies View Related

Can Connect To Database, But How Do I Insert Values Into SQL Database?

Jun 14, 2006

I was able to connect to the SQL Database Pension with table clients with table values: ID, State, Name.'Create(connection)Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)'open connectionconn.Open()However, I'm not sure how to insert a new row with an incremental ID number and a new State and Name.Sorry, I'm really new with VWD.

View 1 Replies View Related

Adventure Works Database, I Can't Connect To The Database

Jul 16, 2006

Database not found !

My web.config file has this bit of code:

<connectionStrings>

<add name="AppConnectionString1" connectionString="Data Source=&quot;.SQLEXPRESS&quot;;AttachDbFilename=&quot;C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAdventureWorks_Data.mdf&quot;;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

But........................... the is no "AdventureWorks_Data.mdf" in that folder ?

And the database is installed in the right place !

help !

View 6 Replies View Related

Multiple Database / Cross Database Referencial Integrity (foreign Keys)

Feb 12, 2008

Using SQL Server Express 2005, I have two databases.  AppDB - The main application database.GeoDB - A somewhat static ZIP code / states / other geographic stuff databaseI need to have some foreign key columns in tables in AppDB reference columns in the GeoDB database tables.  Eventually other application database besides AppDB will be doing the same thing in our infrastructure. After googling and reading for days, here is what I
think I know:You cannot create foreign keys that reference tables in another database in SQL Server.You
cannot create foreign keys that reference columns in a view, and you definitely cannot make an index on a view that has base tables in another database.You can create a trigger that references tables in another database, but this can be flaky?  (nested/recursive trigger problem).SQLServer
2005 supports multiple schemas within the same database.  Maybe I should logically separate my databases this way?  Seems like it would be a tough solution to manage since I already have some databases live in production that will eventually use this 'static' GeoDB.  Also, seems like it
wouldn't be as portable as keeping the GeoDB info in its own database,
but maybe I'm being too software engineer-ish here - afraid of low
cohesion, high coupling.I will greatly appreciate any advice I can get, or any more options I am missing.  Thanks,Adam Nofsingerucnmedia.com

View 2 Replies View Related

Can Not Connect To Database

Aug 10, 2006

I am new to windows apps in .net 2.0. I am trying to create a windows service that will connect to a database and email info out to people that have had status changes.
Right now, I can not connect to the database. Here is the connection string:
Private cnn As New SqlClient.SqlConnection("Data Source=IPAddress;Initial Catalog=TheServer;Persist Security Info=True;User ID=userid;Password=password provider=SQLOLEDB.1;connect timeout=3600")
This is how I am trying to connect:
cnn.Open()
myCMD.CommandTimeout = 0
dr = myCMD.ExecuteReader
 
I keep getting an error message that I can not be logged on. I know that the credentials are correct because I use them for the web app. Something has to be wrong with my connection string, but what?
Thanks,
enak

View 2 Replies View Related

Cannot Connect To Sql Database

Sep 1, 2006

 I'm using Visual Web Developer and SQL 2005...It Guives me this error...: 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) I'm tired of guetin and search solution for this errorI've tried everything that i searched over the "net"...made all the configurations possible in sql server 2005 and nothing...Is this right? Or do i need to put some more code in this line or in server is it "localhost:****...: ...connection = New SqlConnection("Server=servernameWebSite1uid=sa;pwd=1234;database=cdcollection")connection.Open()...... Don't know why in sql server i have two object explorer connections when i start the sql server...one is  "servername"...two is "servernamesqlexpress" (but when trying to connect with "servernamesqlexpress" it won't let me, only with "servername")...i use the windows authentication......when i had the VB.NET 2003 and SQL Server 2000, it was much easy to do this... In ASP.NET config i still have the C:inetpubwwwroot path but the files don't go there...now they go to my documentsVisual studio 2005 by default of Visual Web Developer prog. Do i need to change the location? Please help...i'm really desperate...with this... 

View 2 Replies View Related

Can't Connect To Database

Nov 1, 2006

I am developing my first website for my boss.  I am trying to connect to an access database which I have created a DSN for on the server.  I am using the following code sample.... //Connection String 1string dsn_name = "access_WALLINVEN.dsn";string sDSNDir = Server.MapPath("_dsn");string connectstr = ("Data Source="+ (sDSNDir + ("\" + dsn_name)));//Connection String 2string connectstr = "Data Source=/jwallpaint/_dsn/access_WALLINVEN.dsn;Uid=jwallpaint;Pwd=J2512wall;";string commandString = "Select * from Inventory";//Pass strings to sqlDataAdapter constructorSqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, connectstr);//Create a datasetDataSet dataSet = new DataSet();//fill the dataset objectdataAdapter.Fill(dataSet, "Inventory");//Get the table from the datasetDataTable dataTable = dataSet.Tables["Inventory"];//Bind to the gridviewGridView1.DataSource = dataTable;GridView1.DataBind();For Connection String 1 I get the error of...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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) For Connection String 2 I get the error of...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) I am not sure which connection string to use either....It is strange to me that I get this error talking about SQL Server when I am trying to reach my Access database......Any Help??  Thanks....

View 1 Replies View Related

VWD - Cannot Connect To Database.

Nov 17, 2006

Hi,
I'm on lesson 7 of the Bob Tabor video tutorial called 'Data binding to user interface controls'. Whenever I try to add an SQL database (add new item/sql database) I get the following error message:
TITLE: Connect to Server
------------------------------
 
Cannot connect to ALFIESQLEXPRESS.
 
------------------------------
ADDITIONAL INFORMATION:
 
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
I have VWD installed, sqlexpress installed, everything really.
Any help would be appreciated.
MD

View 1 Replies View Related

Cannot Connect To Database

Nov 30, 2006

I am attempting to connect to a database that has been uploaded to my server from my webpages on the server.  This is the connection string that is currently used:
connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Restaurants.mdf;Integrated Security=True;User Instance=True"
When attempting to connect to the database I receive this error message:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I realize that I cannot make a remote connection using SQL Server 2005 Express Edition, but cannot find the proper connection string for it to connect to the uploaded database.
Accessing the database doesn't require a log on by the user as all the information is public.
The authentication mode in the web.config file is set to "Forms".
 If there is any other information required so that this problem can be solved, please ask for it.
Thank you in advance,
Me

View 1 Replies View Related

Just Cant Connect To Database.

Apr 17, 2007

when i run application from visual studio im getting this error. Server Error in '/' Application.
Cannot open database "Products" requested by the login. The login failed.
Login failed for user 'GAMERKALESH'. when run from web browser:  Server Error in '/' Application.Cannot open database "Products" requested by the login. The login failed.Login failed for user 'GAMERASPNET'. my comp name is: Gamerand acc name is : Kalesh using Microsoft Studio Server Management studio express  i have added these accs:in security of databas products: ASPNET and IUSR_GAMER in general security i have added accs: GAMERASPNET and GAMERIUSR_GAMER using windows authentication.  

View 1 Replies View Related

Can't Connect To Database

Sep 11, 2007

 I just did a ton of work in SQL Server Management Studio Express and now I want to access the database from a Web Developer 2005 Express Edition application.  Can't find any documentation on how to connect to the database from vwd.  Any assistance would be appreciated. Thanks, Tom 

View 3 Replies View Related

Can't Connect To Database

Sep 21, 2007

Ok I have several sites on a server that have connected to databases on a different server for a long.  Out of the blue today none of the sites on the server can connect to any databases on the other server.  However, sites on other servers can connect to databases on the same db server.This is the message I get: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)The database server runs SQL Server 2000 not 2005 I can connect to the database from desktop (with an asp.net application or sql server management studio), I can ping the database server fine from the production web server, but my applications can't connect for some reason.  There is nothing in the event log to suggest a problem, any ideas what could be causing this?  

View 3 Replies View Related

Not Able To Connect To Sql Database

Sep 30, 2007

Hello,
 I have posted awhile ago about this issue, but after taking the advice and trying to get help from GoDaddy, nothing has worked yet.  I am using the user login control, and then I changed the connection string in the web config file according to what Go Daddy's help file said, making sure to make proper server, id, and password names.  It still won't go through, can anyone help?
 
Thanks

View 3 Replies View Related

How To Connect With SQL Database?

Oct 25, 2007

I am new learner of ASP.NET and coding in C#.I am not able to connect the SQL database.I have written the code for connection of database but to write the connection string web.config file is neccessary which is not apearing in my application. Please help me .Here is code I have written.   
 
string sCon = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();SqlConnection oCon = new SqlConnection(sCon);
try
{
oCon.Open();string sQuery = "Select Offering1,Offering2,Offering3 from Offering";SqlCommand oCmd = new SqlCommand(sQuery, oCon);
oCmd.ExecuteNonQuery();
DataSet oDs = new DataSet();SqlDataAdapter oDa = new SqlDataAdapter(oCmd);
oDa.Fill(oDs);
DataList1.DataSource = oDs;
DataList1.DataBind();
} catch (Exception ex)
{
ex.ToString();
}

View 17 Replies View Related

Can Not Connect To Database

Jan 4, 2005

I recently uninstalled SQL Server due to connection issues I started having. I could start the DB and connect/edit tables in Ent Mgr etc, but all the sudden, none of my code could make DB connections.

So, after reinstalling now nothing works. I cannot even connect in Ent. Manager. I went to Administrative Tools->Services to make sure it was running, and SQLSERVER isn't even listed under services. What happened? Is there another step after installing SQL Server I missed to get the service up and going. Do I need to do something in ODBC connections?

I am on Windows XP with SP2.

Tim

View 12 Replies View Related

Could Not Connect To Database

Jan 16, 2005

Hello I am new to the ASP.NET project and using Microsoft ASP.Net Web Matrix. When I try to connect to an Access Database it is no problem, but do I try to set up an connection with a SQL or MSDE database there is a problem.

It can not connect with my SQL server and gives the error:
Could not create new database.

What can be the problem. My MSSQL Server is running perfect.

Greets
Ben
Holland

View 1 Replies View Related

Help Me About Connect To My Database

Aug 7, 2005

i design a web site by vs.net 2003 and i connect to sql database its name rayan but when build my webfrom a error show this is   system.data.sqlclient.sqlexception:login faild for user "rayanaspnet" please help me

View 1 Replies View Related

Cannot Connect To Database Using EM

Apr 25, 2006

Greetings,

A newbie needing some guidance. We have SQL running on our Windows 2003 server. When I connect via the Enterprise manager I have two instances of SQL running.

SRV01ACT7 (Windows NT)
SRV01WEBAPP (Windows NT)

When I click on the ACT instance I get the following error:
A connection could not be established to SRV01/ACT7

Reason: Login Failed for user xxxxadministrator.
Please verify SQL Server is running and check your SQL Server registration properties.

I only get the message when I try to connect to the SRV01ACT. The connection to SRV01WEBAPP works fine.

I checked with SQL server manager and both instances are running and no one has reported any problems connecting to either one of them.

The way it acts, its as if SQL server has lost the ability to authorize a connection via the windows account. As if it has lost its associatoin to the administrator account. So while the instance still runs and is functional, I just can't connect to it and manage it.

I have connected via remote desktop from a WinXP machine and the server console. Both end up with the same error.

Can Someone give me step by step instructions on how to correct this?

Any help please!!!

View 20 Replies View Related

Cannot Connect To Database From App

Sep 24, 2007

Update: I got it working. I had to create an odbc connection on my machine (guess I forgot to do that this time).



I copied a SQL 2005 database from another machine (detached it first. I can connect directly in SFT SQL Server Mgmt Studio, but I cannot connect from VFP using SQLCONNECT(). I've overlooked something. My login is the db_owner and everything else. Any ideas? SQL Server is running on the same machine that I have VFP9 on. It is setup for both SQL Server and Windows Authentication and I can connect to every other database I have attached.

TIA,

View 4 Replies View Related

Can't Connect To Database

Mar 26, 2008

I can't connect to a SQL Server 2000 database.

I opened SQL Server 2005 Management Studio and tried to connect. In the Connect to Server dialog box, when I go to the Server Name dropdown and browse for my database server on the network, the server is not in the list. (A different SQL Server 2000 database server does show up there.) I tried manually entering the server name (and password, etc) but it doesn't connect.

When I go to the server, the db is running and apps that use it work fine. I can ping the server, and I can map a drive to it.

I can't connect using Visual Studio 2008 either. When I try to create a SqlDataSource in Visual Studio the db server isn't in the dropdown list. Also, when I manually create a connection string it doesn't connect.






View 5 Replies View Related

Cannot Connect To Database

Aug 1, 2015

I cannot connect to Sql server 2014.

Error message:
TITLE: Connect to Server
Cannot connect to ANILWORKPC.

ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2). URL....

View 3 Replies View Related

Can't Connect To Database

Nov 1, 2007

Hi I recently installed SQL server but I can't connect to the database. The error message is "under the configuration SQL server does not allow remote connections". What does this mean? I have already followed Step 1, 2 and 3 in the FAQ but I got the same error message. I had enabled TCP/IP. I have changed the values in IPALL and I have added SQL to the firewall exceptions list, but I still can't connect. And I don't understand, isn't the server on the local computer, so what does it means by "remote connections"?

View 6 Replies View Related

Can't Connect To The Database

Dec 31, 2007

Hi,

with the Visual Studio(Add New Data Source) i was able to add a SQL Compact 3.5 database to my desktop-project. Everything seems to be ok: dll assemblies, location of the database in my application folder...
But when trying to connect to the database like this:

SqlCeConnection _conn = new SqlCeConnection();_conn.ConnectionString = Properties.Settings.Default.MyDatabaseConnectionString;_conn.Open();the debugger comes up with this message:
'The file name is not valid. Check the file name for the database. File name = |DataDirectory|MyDatabase.sdf ]

i also tried to add the database path manualy. SqlCeConnection _conn = new SqlCeConnection(@"Data Source = C:MySQLCompactMyDatabase.sdf");_conn.Open();Then i get:Invalid provider type. [ Db version = 3004180,Requested version = 3004180,File name = C:MySQLCompactMyDatabase.sdf ]What's wrong? I'm using VS2005 and Vista 64. Thanks for your help, i'm new to SQL...'

View 6 Replies View Related

Connect To DataBase

Nov 3, 2007

Could someone help me with this error:
"Under the default settings SQL Server does not allow Remote Conections." I have SQL installed in my personal machine and I want to connect to "Local" DataBase.

View 19 Replies View Related

How Do I Connect To A Brinkster Database With ASP.NET 2.0?

Oct 21, 2006

Hello I am fairly new to ASP.NET but have done all the beginer tutorials.  I am able to make simple programs such as the Atlas enabled Tasklist locally and now trying to setup remotely.  I have setup a free educational Brinkster account and trying to display information from the brinkster database to a gridview form.  However I am not sure how to define the connection to the database.  Can anyone help me.  Thanks

View 1 Replies View Related







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