Getting error when trying to create data connection for querydb - InfoPath Dev
in

InfoPath Dev

Getting error when trying to create data connection for querydb

Last post 01-21-2010 07:51 AM by imstac. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 01-20-2010 02:55 PM

    • imstac
    • Top 200 Contributor
      Female
    • Joined on 01-13-2010
    • Austin, TX
    • Posts 59

    Getting error when trying to create data connection for querydb

    I'm receiving an error when trying to implement a static query using QueryDB.  After I constructed the query in QueryDB I copied the first query listed and pasted it into the sample value for tns:queryxml. The error indicates that my database is not registered.  In the instructions it states that I have to add my server and database to the web.config since the database is on a remote server.  I added the code to the web.config and constructed my queries using QueryDB. Obviously, I am doing something wrong to receive the error that I'm getting. Below is my web.config code for the servers and databases tags.  My remote database server is ausdev2 and the name of the database is Resumes. I have also attached a snapshot of the query created in QueryDB.  Will someone tell me what I'm doing wrong? Thanks.

    <servers>
        <server name="default" connectionString="Data Source=ausdev2;Initial Catalog=Resumes;Integrated Security=True" />
        <server name="ausdev2" connectionString="Data Source=ausdev2;Integrated Security=True" />
        <!-- Define additional servers to easily switch database aliases from different environments -->
        <!-- NOTE: server name attribute must be unique within this list -->
        <!-- EXAMPLE: -->
        <!--<server name="PRODUCTIONSERVER" connectionString="Integrated Security=SSPI;data source=RemoteMachine\SqlServer"/>-->
        <!--<server name="TESTSERVER" connectionString="Integrated Security=SSPI;data source=RemoteMachine\SqlServer"/>-->
       </servers>
       <databases>
        <!-- DBXLDB is a predefined alias and does not need to be declared -->
        <!-- NOTE: alias attribute must be unique within this list -->
        <database alias="Resumes" name="Resumes" server="ausdev2" />
        <database alias="QdabraSamples" name="QdabraSamples" server="default" />
        <!-- EXAMPLE: -->
        
        <!--<database alias="NameUsedInEnumDBCalls" name="ActualDatabaseNameOn_RemoteMachine_SqlServer" server="TESTSERVER"/>-->
       </databases>

    Stacie
  • 01-20-2010 03:23 PM In reply to

    Re: Getting error when trying to create data connection for querydb

    Hi,

    The issue might be here:

        <server name="default" connectionString="Data Source=ausdev2;Initial Catalog=Resumes;Integrated Security=True" />

    Was the first line modified? It looks like it was... that first line should point to the SQL instance where the QdabraDBXL and QdabraSamples databases were installed. In my VM (clean install) it looks like this:

         <server name="default" connectionString="Data Source=(LOCAL);Integrated Security=True" />

    So as a first step, let's try to fix that line (if you have a backup of web.config you can check whether it was changed).

      

    The new lines (for the remote SQL instance) should be:

        <server name="<instance alias>" connectionString="Data Source=<instance name>;Integrated Security=True" />

        <database alias="<database alias>" name="<database name>" server="<instance alias>" />

     So in your case:

        <server name="myremoteinstance" connectionString="Data Source=ausdev2;Integrated Security=True" />

        <database alias="Resumes" name="Resumes" server="myremoteinstance" />

     


    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 01-21-2010 06:56 AM In reply to

    • imstac
    • Top 200 Contributor
      Female
    • Joined on 01-13-2010
    • Austin, TX
    • Posts 59

    Re: Getting error when trying to create data connection for querydb

    The first line has not been changed and I have been using the Qdabra Administration tool with no problems.  All of the Qdabra databases are located on a remote server: ausdev2.  I went ahead and removed the inital catalog code from the first line though.

    I checked my code based on your suggestion above and it matches what you have.  Maybe the problem lies when I am entering the query into the Infopath data connection.  I use the code of the first query from the query builder for the sample value of tns:queryxml, correct?  

     

    Stacie
  • 01-21-2010 07:14 AM In reply to

    Re: Getting error when trying to create data connection for querydb

    Ok, I've thought of something. Can you try placing the database alias within pound signs (#, also called number sign or hash mark) when using
    QueryBuilder to build the queryxml?

    It's interesting because you shouldn't need a new line for a new SQL instance (<server name="default" connectionString="Data Source=(LOCAL);Integrated Security=True" />). As you've said, this is where the QdabraDBXL and QdabraUtility databases exist, so the SQL instance is already registered with DBXL.

    Anyway, give the # signs a try and let us know.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 01-21-2010 07:26 AM In reply to

    • imstac
    • Top 200 Contributor
      Female
    • Joined on 01-13-2010
    • Austin, TX
    • Posts 59

    Re: Getting error when trying to create data connection for querydb

    When I use pound signs I get the following error below.  The code I am entering into the sample value is <query database=#Resumes# table='Titles' maxrows='2'><columns><column name='TitleID'/><column name='Title'/></columns><sort><column name='Title' order='ASC'/></sort></query>

    Am I using the wrong query from the QueryDB?

    The SOAP response indicates that an error occurred on the server:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentException: Invalid parameter
    Parameter name: queryXml ---> System.Xml.XmlException: '#' is an unexpected token. The expected token is '"' or '''. Line 1, position 17.
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
       at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
       at System.Xml.XmlTextReaderImpl.ParseAttributes()
       at System.Xml.XmlTextReaderImpl.ParseElement()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at Qdabra.DataBaseService.QueryDBService.GetColumnsXMLStrQuery(String queryXml)
       --- End of inner exception stack trace ---
       at Qdabra.DataBaseService.QueryDBService.GetColumnsXMLStrQuery(String queryXml)
       --- End of inner exception stack trace ---

    Stacie
  • 01-21-2010 07:33 AM In reply to

    Re: Getting error when trying to create data connection for querydb

     You need quotation marks around the value of any XML attribute, so either:

    database='#Resumes#'

    or

    database="#Resumes#"

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-21-2010 07:51 AM In reply to

    • imstac
    • Top 200 Contributor
      Female
    • Joined on 01-13-2010
    • Austin, TX
    • Posts 59

    Re: Getting error when trying to create data connection for querydb

    Yippeee!  That worked.  Thanks Guys!

    Stacie
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.