Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Friday, March 30, 2012

Having trouble getting connections

I have a custom Data Flow Destination Adapter that is looking for a particular type of ConnectionManager. I want to check that this connection exists in the Validate method. I first checked the ComponentMetedata.RuntimeConnections, but it was was an empty collection. I am guessing that it gets populated at runtime. Is there anything available for to check at design time?

Another way of asking this would be, Is there a way to programatically select which ConnectionManager gets assigned to a RuntimeConnection? Normally, this is done on the Connections tab of the Advanced Editor.

Thanks,

Graham

You can assign a connection manager at design time to your adapter and check that it is the correct type in the Validate() method. You will need to let your component know that it is expecting a connection manager.


Allan

|||I realize that I can do that by opening the advanced editor on my destination task and selecting the connection; but I dont want to do it that way. I want to Programmatically look for a connection of a specific type. Below is a code snippet of what I tried to do, but that doesnt seem to work. The connection is not set.



//this takes place in the onload handler for my DestinationAdapter form
//connections is passed in from the UI class that implements IDtsComponentUI
ConnectionManager connMan = null;
foreach (ConnectionManager cm in connections)
{
if (cm.InnerObject.GetType() == typeof(ProfileConnectionManager))
{
connMan = cm;
}
}
profConnMan = ProfileConnectionManager.FindProfileConnection(connections);
dtsComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(connMan);


|||Is there a reason you don't just get the value of ConnectionManagerType on the properties collection? Also, you're attempting to use a managed code idiom for a connection that may not be managed. Most of the connection managers are native. Is this a custom connection manager? I don't know about the ProfileConnectionManager.|||

You may also want to take a look at IDtsConnectionService.GetConnections and IDtsConnectionService.CreateConnection. Useful for writing UIs. They all work around the connection type that Kirk mentions.

|||ProfileConnectionManager is a custom connection that I have written. I want to allow a custom data flow destination adapter that I have written to look for a ProfileConnectionManager and if one is defined, add it to my CustomDestinationAdapter.ComponentMetaData.RuntimeConnections collection.

In normal situations, this is done at design time by openning the advanced editor and selecting the connection manager from a dropdown. In my situation, I am allowing only one ProfileConnectionManger to be created. So if it exists, I dont want the user to have to select it from the advanced editor; I want that to be done programmatically by me.

When you refer to properties collection, are you saying I should add a property to MyCustomDestinationAdapter.ComponentMetaData.CustomPropertyCollection and assign my custom connection as its value?

thanks,
Graham|||

I would use GetConnections, albeit in a UI, something like this-

foreach (ConnectionManager connectionManager in _dtsConnectionService.GetConnectionsOfType(connectionType))
{
comboBox.Items.Add(connectionManager.Name);
}

connectionType is the string that identifies the type of connection I want. For example if I want ADO.Net SQLClient connections I need to use-

"ADO.NET:System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";

It is a bit annoying that I have to use the fully qualified name, but that's what works.

The ConnectionManager also has a CreationName property which I use often for validation, and Kirk suggests a ConnectionType property, so using this you could loop as you where above, and check such a property to see if it is your connection. What you should not do is try and get a .Net Type object for the connection manager, as not all of them are .Net objects.

sql

Wednesday, March 28, 2012

Having problems deploying a report.

I am working with a MS 2005 SQL Server database. I have the following error message. A connection could not be made to the report server http://localhost/ReportServer. I am trying to develop these on a network server. Is this a configuration issue, that it is expecting this on the local machine.

Thanks!

Terry B

Hi,

are you sure that the user (which deploy the report) have access rights to the report server. You can administrate this under http://localhost/reports and then under security, there you must add the AD-user.

I hope this help.

|||

When I go on the internet and type in Http://localhost I receive a not found error message. It claims to be Under Construction and references the IIS Help. But other reports from the server do deploy and I cannot see them from either machine

Thanks!

Terry

|||

Hi,

when localhost the SQL-Reporting-Server is, you must take the url http://localhost/Reports! It is importen to give the subweb Reports to go to the administrationwebsite of the reporting server...

having problem while connecting sql 2000

im using sql server 2000 and i m facing this problem

plz tell me why is this

"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)"

You failed to connect into the SQL server. I think the IP or the host name is wrong.

Check the following site for connectionstrings

www.connectionstrings.com

Regards

|||Also make sure Named Pipes and TCP/IP network libraries are enabled for the SQL2000 instance. You can easily archieve this in Server Network Utility.|||

hai dude

i want to mentions one thing that i have previously used the same connection class made my self for connecting to the db..

but now on new another pc with new installation of sql server ,,having the same previously used setting.,,its not woking,,,

one thing more im not usgin ip based connection string ...

|||Why not use IP based connection string? IP is often more reliable than machine name, for example when DNS does not work properly so the machine name can't be intepreted?to IP.|||

yah thanks dude

its done

Having connection problems with SQL Server 2005 Express

This is a bit of a cross-post from the VS 2005 Forum, but we don't have a forum dedicated to SQL Server 2005...
This is on my test machine running Windows XP Pro SP2 (NTFS),
I have an existing SQL 2000 database located on a separate hard drive dedicated to data -- the e:\ drive.
I just installed SQL Server 2005 Express, in the default installation directory (c:\Program Files\Microsoft SQL Server) and I cannot connect to that database on the e:\ drive. Named pipes, error: 40 (Remote access services are not installed by default).
I don't want the database physically located on the c:\ drive.
I've been looking all over for the solution for this, and can't find it.
Advice or direction to reference materials would be appreciated.
TinkerWell, this was REALLY hard to solve - unneccessarily hard, I'm thinking - but I have (finally) solved it.
- Tinker|||Is is too much to ask what was the solution?
I dont understand people who post like "i found the solution, bye".

|||I don't know if I made a mistake in the initial software installation that caused this problem, the question hadn't garnered many views or much interest, and received no replies, but nonetheless: I'm sorry!
What worked for me was to uninstall SQL Server and when I reinstalled it, I chose the option to NOT install any of the sample databases that are included with the package. By not installing the samples the SQL Server Managment utility then allowed me to ATTACH to existing databases on a separate data drive. With the samples installed, I could not get ATTACH to work with my remote database.
And I didn't install the samples the second time around because I couldn't see any option to mount the samples on the same hard drive as my existing databases; they are installed in the SQL Server program folder by default. So the second time around, I chose to not install them and see if that made a difference -- and that seemed to have solved the problem I had getting ATTACH to work.
But let me empahsize that I don't know if I made a mistake during the original software install that prevented ATTACHING to my databases on a separate hard drive, and I haven't received a reply from Microsoft, yet, about whether I made a mistake.
And I don't know if dropping/deleting the sample databases would have been just as effective and much faster. I didn't try it. I had fiddled around so much trying to get ATTACH to work that I didn't trust the condition of the Server, and just started over with fresh installs. But knowing what I know now, I would have tried droppng the samples and seeing if that allowed me to ATTACH to a database on a different hard drive.
Hope this helps. When I hear back from MS, I'll let you know what they said, and whether the probelm was an undocumented feature, or my brain-fart,
Tinker|||Okay, sorry about that "angry mood" in my previous post but i was losing my mind with sql connection.
Resolved it by using right host/instance name :-)
cheer's
bassock

Monday, March 26, 2012

Having a hard time connecting to sample SQL database from ASP.Net Page

I am working through the book ASP.Net Unleashed Second Addition. I am trying to open a simple database connection. (using the sample "pubs" db from SQL Server)
I have copied the author's code exactly, but it just won't work. I keep getting this error:
What am I doing wrong???Confused [*-)]

Description:An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message:BC30182: Type expected.
Source Error:
Line 5: Line 6: Sub Page_LoadLine 7: Dim conPubs As SqlConnectionLine 8: conPubs = New SqlConnection( "server=localhost;uid=webuser;pwd=secret;database=pubs" )Line 9: conPubs.Open()
What namespaces have you imported?|||Coding for my namespace is
<%@. Import Namespace="System.Data.SqlClient" %>
This is copied directly from the authors example.... so I don't know if it is right lolWink [;)]
Then under the page_load event
I typed:
<script Runat="server">
Sub Page_Load
Dim conPubs as SqlConnection
conPubs = New SqlConnection( "Server=localhost;uid=sa;pwd=secret;database=pubs" )
conPubs. Open()
End Sub
</script>
The text "Connection Opened!" Is supposed to show up if the coding is correct...
Help hehe just a beginner :)|||Does anyone know some awesome websites that teach you Visual Studio.Net 2003 and database stuff? I have the hardest time finding things in the MSDN library....|||Try:
http://learnvisualstudio.net/|||

I don't know if VB.NEt support the continuation stuff.
If it does, may be u have to put a continuation sign at the end of line 7.
Cheers.

sql

Friday, March 23, 2012

have sql file and want to run it on an ftp connection

i have a db set up that i access using an ftp connection, and an sql script
file that i wish to run, how do i go about doing so?

tiastrawberry (1@.2.com) writes:
> i have a db set up that i access using an ftp connection, and an sql
> script file that i wish to run, how do i go about doing so?

You have an SQL Server database that you access through FTP? Maybe I'm
dense, but I don't understand how you could do that?

Of course, if your FTP client permits you to run remote scripts, you
could upload your script, and then run it with OSQL.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Hi

Why can you not get access to connect to the remote server, possibly through
a VPN?

John

"strawberry" <1@.2.com> wrote in message
news:exJ8f.19119$6i4.3749@.newsfe7-gui.ntli.net...
>i have a db set up that i access using an ftp connection, and an sql script
>file that i wish to run, how do i go about doing so?
> tia|||this is half the problem, I'm not sure how or where to execute the file I've
tried all sorts but suspect i don't have the correct privileges ( its a
university server)

thanks for your reply.

"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:436396ac$0$361$da0feed9@.news.zen.co.uk...
> Hi
> Why can you not get access to connect to the remote server, possibly
> through a VPN?
> John
> "strawberry" <1@.2.com> wrote in message
> news:exJ8f.19119$6i4.3749@.newsfe7-gui.ntli.net...
>>i have a db set up that i access using an ftp connection, and an sql
>>script file that i wish to run, how do i go about doing so?
>>
>> tia
>>|||its hosted on a linux server which has ftp access to it. what is osql?, and
where is the best place to upload it too ?

thanks for your reply

"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns96FE92704E4B5Yazorman@.127.0.0.1...
> strawberry (1@.2.com) writes:
>> i have a db set up that i access using an ftp connection, and an sql
>> script file that i wish to run, how do i go about doing so?
> You have an SQL Server database that you access through FTP? Maybe I'm
> dense, but I don't understand how you could do that?
> Of course, if your FTP client permits you to run remote scripts, you
> could upload your script, and then run it with OSQL.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp|||strawberry (1@.2.com) writes:
> its hosted on a linux server which has ftp access to it. what is osql?,
> and where is the best place to upload it too ?

The database is on a Linux server? OK, then you are in the wrong newsgroup.
This newsgroup is about MS SQL Server, which runs only on Windows. (And
OSQL is a command-line tool to access MS SQL Server. On Windows.)

I recommend that you find out which DB engine you are using, and then
find the a forum that engine. Or even better ask the staff at the
university where the DB engine is.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||ahh, oppsy! . hadn't thought of that!

many thanks.

"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns96FF6A8A99F2Yazorman@.127.0.0.1...
> strawberry (1@.2.com) writes:
>> its hosted on a linux server which has ftp access to it. what is osql?,
>> and where is the best place to upload it too ?
> The database is on a Linux server? OK, then you are in the wrong
> newsgroup.
> This newsgroup is about MS SQL Server, which runs only on Windows. (And
> OSQL is a command-line tool to access MS SQL Server. On Windows.)
> I recommend that you find out which DB engine you are using, and then
> find the a forum that engine. Or even better ask the staff at the
> university where the DB engine is.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp

Wednesday, March 21, 2012

Has anyone tried "Using SQL Stored procedure in MS ACCESS"?

I am developing a program using ms access with an SQL 2000 back end. I am using an odbc connection to access my data. Using this connection, i can only access the tables and views of my database. I am planning to create "Stored procedure" in SQL and connect it to my MS Access program but have no idea how to do it.

Please help! Thanks in Advance!Might I suggest an Access newsgroup as its an Access specific problem? SQL Server SPs should just be called like a SQL statement is executed, ie "exec usp_foo" instead of "select * from foo".|||if you want to view stored procedure from Access I suggest you to not use a Access Project (file .adp) instead of the classic Access database (.mdb);
in this way in the Query tab of you Access Project you will see views and stored procedure of the Sql server and then you can manage these directly by Access.
bye

Has anyone tried "Using SQL Stored procedure in MS ACCESS"?

I am developing a program using ms access with an SQL 2000 back end. I am using an odbc connection to access my data. Using this connection, i can only access the tables and views of my database. I am planning to create "Stored procedure" in SQL and connect it to my MS Access program but have no idea how to do it.

Please help! Thanks in Advance!Might I suggest an Access newsgroup as its an Access specific problem? SQL Server SPs should just be called like a SQL statement is executed, ie "exec usp_foo" instead of "select * from foo".|||if you want to view stored procedure from Access I suggest you to not use a Access Project (file .adp) instead of the classic Access database (.mdb);
in this way in the Query tab of you Access Project you will see views and stored procedure of the Sql server and then you can manage these directly by Access.
bye

Wednesday, March 7, 2012

Hard Code Native Error code in program?

Using VB 6, sp6,
On sql server 2000 (sp4)
When I try to establish a connection to the database
from a VB 6 program using ADO, I get a similar message
if the UserID does not exist or if the UserID does exist
but does not have the permission to the database.
The NativeError number is different,
NativeError - 18456 The UserID does not exist
NativeError - 4060 The UserID exists, but does not have permission
to the database.
Can I hard code the NativeError number in my VB 6
program to determine exactly what happened,
(the UserID did not exist or the UserID does exist but
does not have the proper permission.)
I worry that the code number might change in a future
version of sql server.
I hate to do this but there is no other way to determine
exactly what happened.
Thanks in Advance,
Laurence Nuttall
Programmer Analyst III
UCLA - Division of Continuing EducationIt's unlikely that the error codes would change. Could happen, but more
probable that additional codes would be added for other (and new)
situations.
If you are concerned, you could use a config file, and put the codes in the
config file. Have the app read the config file at start up and hold the
error codes in global variables. (An xml file works good for that.)
Otherwise, set them up as constants.
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."
*Yet Another certification Exam
"Larry" <bliff@.Blifff.com> wrote in message
news:OlggCs6mGHA.2360@.TK2MSFTNGP04.phx.gbl...
> Using VB 6, sp6,
> On sql server 2000 (sp4)
> When I try to establish a connection to the database
> from a VB 6 program using ADO, I get a similar message
> if the UserID does not exist or if the UserID does exist
> but does not have the permission to the database.
> The NativeError number is different,
> NativeError - 18456 The UserID does not exist
> NativeError - 4060 The UserID exists, but does not have permission
> to the database.
> Can I hard code the NativeError number in my VB 6
> program to determine exactly what happened,
> (the UserID did not exist or the UserID does exist but
> does not have the proper permission.)
> I worry that the code number might change in a future
> version of sql server.
> I hate to do this but there is no other way to determine
> exactly what happened.
> Thanks in Advance,
> Laurence Nuttall
> Programmer Analyst III
> UCLA - Division of Continuing Education
>
>|||It's unlikely that the error codes would change. Could happen, but more
probable that additional codes would be added for other (and new)
situations.
If you are concerned, you could use a config file, and put the codes in the
config file. Have the app read the config file at start up and hold the
error codes in global variables. (An xml file works good for that.)
Otherwise, set them up as constants.
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."
*Yet Another certification Exam
"Larry" <bliff@.Blifff.com> wrote in message
news:OlggCs6mGHA.2360@.TK2MSFTNGP04.phx.gbl...
> Using VB 6, sp6,
> On sql server 2000 (sp4)
> When I try to establish a connection to the database
> from a VB 6 program using ADO, I get a similar message
> if the UserID does not exist or if the UserID does exist
> but does not have the permission to the database.
> The NativeError number is different,
> NativeError - 18456 The UserID does not exist
> NativeError - 4060 The UserID exists, but does not have permission
> to the database.
> Can I hard code the NativeError number in my VB 6
> program to determine exactly what happened,
> (the UserID did not exist or the UserID does exist but
> does not have the proper permission.)
> I worry that the code number might change in a future
> version of sql server.
> I hate to do this but there is no other way to determine
> exactly what happened.
> Thanks in Advance,
> Laurence Nuttall
> Programmer Analyst III
> UCLA - Division of Continuing Education
>
>

Monday, February 27, 2012

handling special characters using oledb to oracle

hi,

i am using oledb to connect to oracle.
i want to know if there is a way to handle different character sets in this type of connection. for sql to sql, i have been using auto translate in the connection string.
what about for sql oledb to oracle? how can i make sure that the data from sql to oracle is transferred as is?

many thanks.

You might be better off asking this on the Data Access forum:

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1

-Jamie

Friday, February 24, 2012

Handling database connection errors

If my database goes down, i get a popup error with the red x saying can't
connect to database, can't find the cubes, or the cubes are busy, etc...
Is there a way to change the error message to say:
"Report Cubes are being refreshed right now, please try again" in the
popup.
Or point to another page?No this is not possible, unless you implement your own custom data extension
which wraps the original data provider and throws specific exceptions with
your custom error message (which will then show up as inner error message).
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Cindy Lee" <cindylee@.hotmail.com> wrote in message
news:OfpbodJ3EHA.2804@.TK2MSFTNGP15.phx.gbl...
> If my database goes down, i get a popup error with the red x saying can't
> connect to database, can't find the cubes, or the cubes are busy, etc...
> Is there a way to change the error message to say:
> "Report Cubes are being refreshed right now, please try again" in the
> popup.
> Or point to another page?
>|||Is this an IIS thing?
Easy to do?
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:OxvRcpP3EHA.1524@.TK2MSFTNGP09.phx.gbl...
> No this is not possible, unless you implement your own custom data
extension
> which wraps the original data provider and throws specific exceptions with
> your custom error message (which will then show up as inner error
message).
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Cindy Lee" <cindylee@.hotmail.com> wrote in message
> news:OfpbodJ3EHA.2804@.TK2MSFTNGP15.phx.gbl...
> > If my database goes down, i get a popup error with the red x saying
can't
> > connect to database, can't find the cubes, or the cubes are busy,
etc...
> >
> > Is there a way to change the error message to say:
> >
> > "Report Cubes are being refreshed right now, please try again" in the
> > popup.
> >
> > Or point to another page?
> >
> >
>