Load Ingest Data
Results 1 to 9 of 9

Thread: ADO.NET connection string

  1. #1
    apostolos is offline Junior Member
    Join Date
    Nov 2006
    Location
    Cyprus
    Posts
    4
    Rep Power
    0

    ADO.NET connection string

    hi, I am using the ADO.NET provider and this is the connection string that i am using to connect to the server.

    "provider=AttunityConnect;BindURL=username:passwor d@host/workspace;database=mydatabase;Binding=my_bind;"

    Unfortunately i am getting an error while i try to connect. This is the error i am getting:

    An invalid connection string argument has been supplied or a required connection string argument has not been supplied.
    Source : Attunity.AisClient

    Void Validate()
    Stack Trace : at Attunity.Data.AisClient.ConnectionString.Validate( )
    at Attunity.Data.AisClient.AisConnection.set_Connecti onString(String value)
    at Attunity.Data.AisClient.AisConnection..ctor(String connectionString)


    Is the connection string i am using correct?
    Do I need any extra parameters in the connection string??
    any help??

    thanks a lot,
    Apostolos

  2. #2
    JeffS is offline US Technical Team
    Join Date
    Sep 2006
    Location
    Minneapolis, MN
    Posts
    20
    Rep Power
    0
    Apostolos,

    The BindURL and Binding attributes are incompatible in a connection string. The former is to directly access the Attunity daemon on a remote machine. The latter is to access a non-default binding on the local machine. Note that in the BindURL attribute the binding on the remote machine is implied by the workspace argument since a workspace has only one binding associated with it. Also by using the database attribute you are limiting the connection so that it can access objects only in mydatabase and not in any other data sources (in the binding associated with workspace if you use BindURL or in the my_bind binding if you use Binding).

    Regards,
    Jeff
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  3. #3
    apostolos is offline Junior Member
    Join Date
    Nov 2006
    Location
    Cyprus
    Posts
    4
    Rep Power
    0
    Jeff,

    thanks for the help. So what you are saying is that, I don’t need to include the Binding attribute? I also tried the following connection string:
    "provider=AttunityConnect;BindURL=username:passwor d@host/workspace;database=mydatabase"
    but I am still getting the same error.

    I was using the same connection string with a different provider and there were not any errors. I was using OleDb, and now I am trying to use the ADO.NET provider.

    Can I have a sample of a connection string with the proper attributes that I have to use?

    thanks again,
    Apostolos
    Last edited by apostolos; 11-29-2006 at 07:10 AM.

  4. #4
    JeffS is offline US Technical Team
    Join Date
    Sep 2006
    Location
    Minneapolis, MN
    Posts
    20
    Rep Power
    0
    Apostolos,

    Did you see the "ADO.NET sample" thread in the ADO.NET Provider forum, http://www.attunity.com/forums/ado-net-provider/ado-net-sample-455.html? The connection string format does not use the BindURL syntax. The relevant line of code is simply:

    ConStr = "server=alpha;Port=4820;Database=rdb"

    The sample does not contain all the attributes you using. I am investigating what they are. In the meantime you can either try it with only those 3 (if you can use the default workspace and anonymous login) or try user, password, and workspace for the missing attribute names, i.e., taking what you have in your BindURL

    ConStr = "server=host;port=2551;database=mydatabase;user=us ername;password=password;workspace=workspace"

    If the user attribute does not work you could try username or userid.

    Regards,
    Jeff
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  5. #5
    Join Date
    Sep 2006
    Posts
    233
    Rep Power
    10
    The 'provider=AttunityConnect' syntax belongs with the COM based ADO provider, not the ADO.NET provider.

    The connect string is the documented in the help file contained in the Attunity ADO.NET kit. I have attached an excerpt to this post.

    Attachment 66
    Last edited by DrorHarari; 11-29-2006 at 05:27 PM.
    By Dror Harari

    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  6. #6
    apostolos is offline Junior Member
    Join Date
    Nov 2006
    Location
    Cyprus
    Posts
    4
    Rep Power
    0
    Dear Jeff,
    thanks a lot for your help. I used the connection string that you sent me and it works fine… The connection string that I posted was the one I was using with an old version of attunity provider (oledb) which it was working. Since I am facing many problems now with my .net applications I thought to start using the Attunity.AisClient and see the difference. I took a look on the ADO.NET sample. Are there any more examples? Using stored procedures and datareaders? Because I have some problems executing datareaders with stored procedures.

    For example why this code gives me an error:
    Error Message "Object reference not set to an instance of an object.”


    Dim conn As New Attunity.Data.AisClient.AisConnection(conString)
    Dim AisCommand As New Attunity.Data.AisClient.AisCommand
    Dim AisReader As Attunity.Data.AisClient.AisDataReader

    conn.Open()
    AisCommand = conn.CreateCommand
    AisCommand.CommandType = CommandType.StoredProcedure
    AisCommand.CommandText = "vebill:up_MyStoredProcedure"

    AisReader = AisCommand.ExecuteReader(CommandBehavior.Sequentia lAccess)

    Label.Text = Convert.ToString(AisReader.Item(0))


    But this code does not?

    Dim conn As New Attunity.Data.AisClient.AisConnection(conString)
    Dim AisCommand As New Attunity.Data.AisClient.AisCommand
    Dim AisReader As Attunity.Data.AisClient.AisDataReader

    conn.Open()
    AisCommand = conn.CreateCommand
    AisCommand.CommandType = CommandType.StoredProcedure
    AisCommand.CommandText = "vebill:up_MyStoredProcedure"

    AisReader = AisCommand.ExecuteReader(CommandBehavior.Sequentia lAccess)


    If AisReader.Read Then
    Label.Text = Convert.ToString(AisReader.Item(0))
    End If



    thanks again for your help,
    Apostolos

  7. #7
    Adeeb Mass'ad is offline Support Manager
    Join Date
    Aug 2006
    Location
    Jaffa of Nazareth
    Posts
    169
    Rep Power
    14
    Since this thread is quiet for a while, we wanted to check if the problem was resolved?

    Also, I wanted to note that when a DataReader object is returned, you have to call the Read method at least once to initiate getting the data.

    You can also create a loop reading all the returned rows, for example:
    While AisReader.Read()
    ListBox1.Items.Add(Convert.ToString(AisReader.Item (0)))
    End While
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  8. #8
    apostolos is offline Junior Member
    Join Date
    Nov 2006
    Location
    Cyprus
    Posts
    4
    Rep Power
    0
    Hi,

    the problem with the connection string was solved.

    About the AisReader, in order to read any data from the AisReader you should first call the AisReader.Read method, otherwise it gives an error.

    thanks
    Apostolos

  9. #9
    Adeeb Mass'ad is offline Support Manager
    Join Date
    Aug 2006
    Location
    Jaffa of Nazareth
    Posts
    169
    Rep Power
    14

    Smile

    Hi,

    In classic ADO you will get the first record after executing a query. In ADO .NET the the default position of the DataReader is just before the first record. Therefore, you must call Read to start accessing any data.

    Also note, that the Read method repositions the DataReader to the next row, thus you can keep looping until the last record is returned.
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •