Showing posts with label oledb. Show all posts
Showing posts with label oledb. Show all posts

Thursday, March 22, 2012

Connectionstring problem

Hay, I have a problem with this connectionstring.

Dim myConnectionAs New Data.OleDb.OleDbConnection("Provider=SQLNCLI;Data Source=whatever-ja4lbq\sqlexpress;Initial Catalog=Account;Integrated Security=SSPI;")
I use this code to receive a value on a specific query
 
Public Sub readdata(ByVal myconnectionstringAs String)Dim mySelectQueryAs String = "SELECT UserName, Password FROM TAccount WHERE UseName ='" & TextBox1.Text & "'; and Password = '" & TextBox2.Text & "';"Dim mycommandAs New Data.OleDb.OleDbCommand(mySelectQuery, myConnection) myConnection.Open()Dim myreaderAs Data.OleDb.OleDbDataReader myreader = mycommand.ExecuteReaderWhile myreader.Read Label1.Text = myreader.GetString(1)End While myreader.Close() myConnection.Close()End Sub 
 
But when it execute i receive this exeption
 
Login timeout expired
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.
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
 
Is this mean that i can not make a connection to my sql server 2005.

My sql server 2005 runs on my developer computer

 

By default SQL Server 2005 does not allow remote connections. Select Start -> All programs-> Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server 2005 Surface Area Configuration. When the tool opens, pick "Surface Area Configuration for Services and Connections", when you get a tree view of all configurable services. Under "Database engine", there's a "remote connections" leaf, from which you can enable remote connections. You need also turn Sql Server Browser service on (since you use instance name in connection string)

More information:http://support.microsoft.com/kb/914277

|||

And i must make some permission properties in my databases

Thanks

Monday, March 19, 2012

ConnectionManagerOleDb usage in a Script Component

Hi,

I have a need to use a shared connection manager of type OLEDB inside a Script Component. I guess that the right way to get the OLEDB connection is to override the AcquireConnections method, case the shared connection manager to the ConnectionManagerOleDb interface and call the AcquireConnection method.

The problem is in the return value of the AcquireConnection method (it’s Object). My assumption is that in case of OLEDB connection usage, the AcquireConnection method returns some OLE DB COM interface. Does some of you tried to cast it to some interface/class exposed by DTS (or some standard COM interface from MDAC)?

PS I’m aware about the possibility to use ADO.NET connection managers, however it’s not a case for me because of DataReader Source limitations (OLE DB Source suits my needs much better).

I would really appreciate your answer. Thanks in advance!

Regards,

Dmytro

Hi,

I am not using override acquireconnection method for sharing connections. Instead of that I have created a global connection and created a property for opening the connection. Inside the property, if it is null I will open a new connection, otherwise I will return the existing connection. I have overriden the 'releaseconnection' method, to release that connection. It is working fine. Hope this would help u.

|||

Hi,

I am facing similar situation. Have you got a solution. It will be great if you can share the way you resolved it.

Thanks

|||

Hi,

Thanks for your reply! What is the type of the global connection that you created and what would happen if your package is executed in a transaction? Do you take transactions into consideration?

Thanks!

/Dmytro

|||

Hi,

Unfortunately I haven't found a way how to solve this issue yet. If I find it, I would definitely post a solution here.

/Dmytro

|||

Dmytro Kryvko wrote:

I have a need to use a shared connection manager of type OLEDB inside a Script Component.
...
My assumption is that in case of OLEDB connection usage, the AcquireConnection method returns some OLE DB COM interface.

This is correct, the object is the OLEDB COM object, namely OLEDB session created by IDBCreateSession::CreateSession call. For using it, see OLEDB reference in MSDN.

Note that these interfaces are not meant to be used from .NET. If you really need to use it, you should create a custom component in C++, rather than using script component.

Sunday, March 11, 2012

Connection to SQL2k5 from OLEDB

I have program which work with SQL2k. The program was written on C++ and it
use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
hardcoded in the program. May I connect to SQL2k5 without change it in
program and recompile it, with use of old OLEDB provider? The program big,
and it will be necessary to change it in several places...Hi
AFAIK you should be ok with the application as is, you will not be able to
use the features of the SQL Native Client.
John
"andsm" wrote:

> I have program which work with SQL2k. The program was written on C++ and i
t
> use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
> hardcoded in the program. May I connect to SQL2k5 without change it in
> program and recompile it, with use of old OLEDB provider? The program big,
> and it will be necessary to change it in several places...|||You are right, as far as you don=B4t need the new features you can get
pre-SQL 2k5 functionality with the old providers. Only SNAC with its
new providers or .NET 2.0 will take you to the heaven of SQL2k5 ;-)
(=2ENET 2.0 even a bit higher)
HTH, Jens Suessmeyer.

Connection to SQL2k5 from OLEDB

I have program which work with SQL2k. The program was written on C++ and it
use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
hardcoded in the program. May I connect to SQL2k5 without change it in
program and recompile it, with use of old OLEDB provider? The program big,
and it will be necessary to change it in several places...Hi
AFAIK you should be ok with the application as is, you will not be able to
use the features of the SQL Native Client.
John
"andsm" wrote:
> I have program which work with SQL2k. The program was written on C++ and it
> use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
> hardcoded in the program. May I connect to SQL2k5 without change it in
> program and recompile it, with use of old OLEDB provider? The program big,
> and it will be necessary to change it in several places...|||You are right, as far as you don=B4t need the new features you can get
pre-SQL 2k5 functionality with the old providers. Only SNAC with its
new providers or .NET 2.0 will take you to the heaven of SQL2k5 ;-)
(=2ENET 2.0 even a bit higher)
HTH, Jens Suessmeyer.

Connection to SQL2k5 from OLEDB

I have program which work with SQL2k. The program was written on C++ and it
use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
hardcoded in the program. May I connect to SQL2k5 without change it in
program and recompile it, with use of old OLEDB provider? The program big,
and it will be necessary to change it in several places...
Hi
AFAIK you should be ok with the application as is, you will not be able to
use the features of the SQL Native Client.
John
"andsm" wrote:

> I have program which work with SQL2k. The program was written on C++ and it
> use OLEDB (not ADO) to connect to server. Name of provider (OLEDB) is
> hardcoded in the program. May I connect to SQL2k5 without change it in
> program and recompile it, with use of old OLEDB provider? The program big,
> and it will be necessary to change it in several places...
|||You are right, as far as you don=B4t need the new features you can get
pre-SQL 2k5 functionality with the old providers. Only SNAC with its
new providers or .NET 2.0 will take you to the heaven of SQL2k5 ;-)
(=2ENET 2.0 even a bit higher)
HTH, Jens Suessmeyer.

Thursday, March 8, 2012

Connection to SQL

I am gettin the following error,,

Exception Details: System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Invalid connection string attribute

This is the string can anyone help?

Dim DBConn as OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSLogin as New DataSet

DBConn = New OleDbConnection("Provider=sqloledb;" _
& "server=localhost;" _
& "InitialCatalog=BOOKSTORE;" _
& "User Id=sa;" _
& "Password=Pswd:")

DBCommand = New OleDbDataAdapter _
("Select StudentID from " _
& "Students Where " _
& "StudentName = '" & txtStudentName.Text _
& "' and Password = '" & txtPassword.Text _
& "'", DBConn)
DBCommand.Fill(DSLogin, _
"StudentInfo")
If DSLogin.Tables("StudentInfo"). _
Rows.Count = 0 Then
lblMessage.Text = "The student name and password " _
& "were not found. Please try again."
Else
Session("StudentID") = DSLogin.Tables("StudentInfo"). _
Rows(0).Item("StudentID")
Session("StudentName") = txtStudentName.Text
Response.Redirect("./home_room.aspx")
End IfAre you using Mixed mode or windows authentication for sql Server?

Also, I thoght you needed to open the connection first, not totally sure.

Friday, February 24, 2012

Connection string OLEDB - SqlServer

I need to conect my software from a remote client to a server, my
standard connection:

Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;Password=;Initial Catalog=MyDb;Data
Source=192.168.0.100;Network=DBMSSOCN;

and

Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;Password=;Initial Catalog=MyDb;Data
Source=192.168.0.100;Network=DBNMPNTW;

make a error connection,
i have tryed with ODBC connection and its OK only in Named Piped.

Can any one help me write the right connection string?

thanks
rmrmartin (rmartin@.freemail.it) writes:
> I need to conect my software from a remote client to a server, my
> standard connection:
> Provider=SQLOLEDB.1;Persist Security Info=False;User
> ID=sa;Password=;Initial Catalog=MyDb;Data
> Source=192.168.0.100;Network=DBMSSOCN;
> and
> Provider=SQLOLEDB.1;Persist Security Info=False;User
> ID=sa;Password=;Initial Catalog=MyDb;Data
> Source=192.168.0.100;Network=DBNMPNTW;
> make a error connection,
> i have tryed with ODBC connection and its OK only in Named Piped.
> Can any one help me write the right connection string?

Maybe. If you help us to help you. If you get any error message, please
post it. It would also help if you shared information about your network.

You talk about named pipes, but in the connection string you have an
IP address. I'm not good a networking, but it does not sound like a
good thing to me. In any case, I believe it is better to not specify
the network library at all, but control that from the Client Network
Utility.

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||"rmartin" <rmartin@.freemail.it> wrote in message
news:d7999283.0501261007.201e7769@.posting.google.c om...
>I need to conect my software from a remote client to a server, my
> standard connection:
> Provider=SQLOLEDB.1;Persist Security Info=False;User
> ID=sa;Password=;Initial Catalog=MyDb;Data
> Source=192.168.0.100;Network=DBMSSOCN;
> and
> Provider=SQLOLEDB.1;Persist Security Info=False;User
> ID=sa;Password=;Initial Catalog=MyDb;Data
> Source=192.168.0.100;Network=DBNMPNTW;
> make a error connection,
> i have tryed with ODBC connection and its OK only in Named Piped.
> Can any one help me write the right connection string?
> thanks
> rm

In addition to Erland's comments, you might find the sample connection
strings here useful:

http://www.able-consulting.com/ADO_Conn.htm

Simon