String Truncation Exception in SQL Server

I get an error when issuing an updateRow() after updateString("String Field", "Test"). My exception is:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]String data
, right truncation
at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5068)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateRow(JdbcOdbcResultSet.java:4053
at exuberance.remote.JDBCClient.setFieldValue(JDBCClient.java:446)
I believe this occurs because Java stores strings in Unicode (2 bytes), but I'm not positive. Any help would be much appreciated.

You are passing a string that is too big.
Possibilities:
-String you are passing is bigger than field it is being inserted into.
-Total length of SQL call exceeds the max len limit (8000?, 2174?)
-The string is a actually a 'blob' type of string (greater than 8000 on MS SQL?) and you need to use the same sort of handling for blobs to pass it.

Similar Messages

  • Right Truncation, varchar in SQL Server, double-byte in Oracle

    Hi.
    We have a DB Link using DG4MSQL from Oracle 11.1.0.7.0 to a SQL Server 2005 database. The Oracle database is set up to use UTF-8 so all character fields are double-byte on the oracle side.
    On the SQL Server table we have a column defined as varchar(32). When doing a select * from this table (from Oracle, over the DB link), everything works fine if that column contains values with a length of 16 characters or less. When the column contains 17 - 32 characters we get the following error:
    Error report:
    SQL Error: ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Oracle][ODBC SQL Server Driver]String data, right truncation {01004}
    ORA-02063: preceding 2 lines from SQLUAT
    28500. 00000 - "connection from ORACLE to a non-Oracle system returned this message:"
    *Cause:    The cause is explained in the forwarded message.
    *Action:   See the non-Oracle system's documentation of the forwarded
    message.
    It looks like Oracle (or the ODBC driver) is bringing the data back as double-byte even though it is declared as varchar. If we change the column on the SQL server side to nvarchar, everything works fine.
    Is this a bug? Or is there a setting that can be specified for the gateway so that it recognizes SQL Server varchar columns as single-byte, to prevent them from coming over as double-byte and messing up the ODBC driver? Or is there anything else we should do to prevent this problem?
    Thanks

    Hi,
    I don't think it's a problem with the hs or the dblink (but I may be wrong):
    UTF-8 is double-bytes as you said. when you declare varchar2(32) it actually means you can insert up to 32 bytes --> 16 characters.
    even if you do a simple insert to the table with more than 16 characters - it will fail.
    In order to overcome this you should declare the table with varchar2(32 char) which will tell Oracle to allocate enough bytes to hold 32 chars - not bytes. In UTF-8 this means 64 bytes (2*n). If you'd be using AL32UTF-8 this would mean 4*n.
    BTW- why are you using UTF-8 and not AL32UTF8?
    Hope this helps.

  • QSUF (Query string url filter) and SQL Server reporting services report viewer parameters

    Hi,
    this is my issue:
    I have a SQL Server reporting services web part on a page with a report with 1 parameter, lets say it's a client list
    Then i have a QSUF that will be used to filter the clients list through the URL
    However, once i connect the filter and the report viewer web part, the parameter goes away and is no longer accessible
    I'd like to somehow keep the parameter visible, in case there is no parameter sent through the URL, i would like the user to be able to choose a client from the parameter drop down list
    I saw that there is a "send empty if no values are passed" option, but i can't seem to get this working properly and i don't know if this option will make the parameter visible again
    Any help would be appreciated
    Thanks.

    Hi,
    According to your post, my understanding is that the query string url filter web part not worked well with SQL server reproting services web part.
    Did you use the Wiki page layout in your environment?
    You can change the page to a web part page, then check whether it work.
    There is a similar thread for your reference.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/4d7584e3-8e1a-48bf-9346-32f8cb480dd1/query-string-url-filter-web-part?forum=sharepointgeneralprevious
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Inserting a string with apostrophe to SQL Server

    Hi,
    I develop a windows application using C#. I try to take a value from the textbox and put it in the table on SQL server. I create a connection string and the command string (ODBC). The value I want to insert surrounded with apostrophes. The problem occurs when user wants to insert apostrophe in the textbox. It is inserted to the string value and SQL server recognizes it as an end of string.
    Does anybody know how to resolve this problem?
    thank you.

    string someVal = TextBox1.Text;
    someVal = someVal.Replace("'", "''");
    This code should double up the value entered by some user in TextBox1
    and then you can pass these values to sql command like this
    var sb = new StringBuilder();
    sb.AppendFormat("SELECT project_id,project_name" + " FROM dbo.TableName");
    sb.Append(" WHERE " + someVal);
    var select = new SqlCommand(sb.ToString(), conn))
    Product Lifecycle Development |
    Backlinks |
    Get Twitter Followers

  • Can not connect the database via query string (C#). The SQL Server Management Studio is showing the full path of a location instead of database name.

    I can not connect to the database via C#. The database is showing full path of the database file instead of the database name. See the pic: a database showing only name 'emart' and the other database showing the full path.
    : Robby

    Hi,
    According to your post, I know that the database name is showing file path of the database rather than the database name in SQL Server Management Studio. You were not able to
    establish a connection to the database using C#.
    As Olaf said, was any error message thrown out when the connection failed? How did you create these databases?
    You can use the following T-SQL to attach the database and see if the issue persists.
    CREATE DATABASE
    databasename
        ON (FILENAME = 'filepath _Data.mdf'),
        (FILENAME = 'filepath_Log.ldf')
    FOR ATTACH;
    Thanks.
    Tracy Cai
    TechNet Community Support

  • How to extract a tagged string using XML in sql server 2014?

    A column stores the string data with tag as below.I have to retrieve the value of ATRB_C1 as val1234 through xml
    Query:
    CREATE TABLE #test (col varchar(500))
    INSERT INTO #test VALUES('< ATRB_C value ="val1" />< ATRB_C1 value ="val234" />')
    SELECT * FROM  #test FOR XML RAW
    Output:
    <row col="&lt; ATRB_C value =&quot;val1&quot; /&gt;&lt; ATRB_C1 value =&quot;val234&quot; /&gt;" />
    Since the format is incorrect, not able to extract using xml.value
    Any help would be appreciated!!

    CREATE TABLE #test (col xml)
    INSERT INTO #test(col) VALUES('<ATRB_C value ="val1"/><ATRB_C1 value ="val234" />')
    SELECT * FROM #test
    Select Col1.value('(@value)[1]','varchar(20)') as [tab1_col1],col2.value('(@value)[1]','varchar(20)') as [tab2_col2]
    from #test cross apply col.nodes('/ATRB_C') as tab1(col1)
    cross apply col.nodes('/ATRB_C1') as tab2(col2)
    drop table #test
    Hope it Helps!!

  • JRC bug: apostrophe in string parameter passed to Crystal Report with Command datasource to SQL Server

    Post Author: nl11087
    CA Forum: JAVA
    A single quote/apostrophe in string parameter passed to a Crystal Report with Command datasource connecting to a SQL Server database, using sqljdbc driver does not escape the special character correctly. When doing a preview in the Crystal Reports IDE it allows you to escape the input parameter as expected and work correctly, but through the JRC component it fails. For string parameters without special sql server characters I experience no problems at all. When replacing the Command with a direct table there is also no problem.
    Reproduction:
    1. create a database db1, create a table table1 with a String type column col1.
    2. Create new report Report1.rpt, create a connection to above, Add Command using 'SELECT col1, col2, col3 FROM table1 WHERE col1 = '{?Par1}' . Add a parameter field Par1 : String
    3. In your java stand alone application using JRC add the parameter Par1 with a value "Jon Doe's Value" containing a single apostrophe. Export to PDF. (I also tried MSWord and this failed too, similar behavior). Additionally, in another test try to replaceAll("'","''") to escape it, preventing the code to break, but now it does not retrieve the expected row anymore and you end up with an empty report.
    Exception StackTrace:
    com.crystaldecisions.reports.exportinterface.exceptions.ExportException: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    ... 17 more
    Caused by: com.crystaldecisions.reports.dataengine.be: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.nr(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bn(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bp(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.s.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.aa(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.n: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.reportdefinition.datainterface.p.a(Unknown Source)
    ... 35 more
    Caused by: com.crystaldecisions.reports.queryengine.driverImpl.m: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.queryengine.driverImpl.o.eC(Unknown Source)
    at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.ea(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.h(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.dV(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ax.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cy(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cz(Unknown Source)
    at com.crystaldecisions.reports.queryengine.b1.bc(Unknown Source)
    ... 36 more
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 's'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
    ... 48 more
    - JRCAgent3 detected an exception: An error occured while exporting the report
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)

    Post Author: nl11087
    CA Forum: JAVA
    A single quote/apostrophe in string parameter passed to a Crystal Report with Command datasource connecting to a SQL Server database, using sqljdbc driver does not escape the special character correctly. When doing a preview in the Crystal Reports IDE it allows you to escape the input parameter as expected and work correctly, but through the JRC component it fails. For string parameters without special sql server characters I experience no problems at all. When replacing the Command with a direct table there is also no problem.
    Reproduction:
    1. create a database db1, create a table table1 with a String type column col1.
    2. Create new report Report1.rpt, create a connection to above, Add Command using 'SELECT col1, col2, col3 FROM table1 WHERE col1 = '{?Par1}' . Add a parameter field Par1 : String
    3. In your java stand alone application using JRC add the parameter Par1 with a value "Jon Doe's Value" containing a single apostrophe. Export to PDF. (I also tried MSWord and this failed too, similar behavior). Additionally, in another test try to replaceAll("'","''") to escape it, preventing the code to break, but now it does not retrieve the expected row anymore and you end up with an empty report.
    Exception StackTrace:
    com.crystaldecisions.reports.exportinterface.exceptions.ExportException: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
    at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
    at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
    ... 17 more
    Caused by: com.crystaldecisions.reports.dataengine.be: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.nr(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bn(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.bp(Unknown Source)
    at com.crystaldecisions.reports.dataengine.n.else(Unknown Source)
    at com.crystaldecisions.reports.dataengine.s.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.aa(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.<init>(Unknown Source)
    at com.crystaldecisions.reports.dataengine.bk.a(Unknown Source)
    ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.n: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.reportdefinition.datainterface.p.a(Unknown Source)
    ... 35 more
    Caused by: com.crystaldecisions.reports.queryengine.driverImpl.m: JDBC Error: Incorrect syntax near 's'.
    at com.crystaldecisions.reports.queryengine.driverImpl.o.eC(Unknown Source)
    at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.ea(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.h(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ap.dV(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ax.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.if(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.bc.do(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cy(Unknown Source)
    at com.crystaldecisions.reports.queryengine.ae.cz(Unknown Source)
    at com.crystaldecisions.reports.queryengine.b1.bc(Unknown Source)
    ... 36 more
    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 's'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StatementExecutionRequest.executeStatement(Unknown Source)
    at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(Unknown Source)
    ... 48 more
    - JRCAgent3 detected an exception: An error occured while exporting the report
    at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
    at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
    at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)

  • How do I create a connection string to sql server?

    Hi All,
       I am currently connecting to a SQL Server via ODBC DSN connection. I am wondering how do I create a connection string directly to a sql server without a DSN connection?
    Thank you in advance.

    If you have SQL Server or client installed in your machine you can directly connect to SQL server using native connection. When you create new report you can see the option create new connection, here you can see SQL Server. Expand it and enter the connection details where you will be directly connected to SQL Server without ODBC connection.
    Regards,
    Raghavendra

  • Problem in JDBC-SQL Server connection string

    Anyone could help me to write proper connection string using JDBC with SQL Server 2000. The descp:
    Server name: CD
    databaseName: songs
    Using Window NT authentication.
    I dont know whether to include username and password.
    When I executed the statement below:
    DriverManager.getConnection("jdbc:microsoft:sqlserver://CD:1433;databaseName=songs");
    Recieved error: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket
    Plz help!! Thank you very much.

    Look at the URl below:
    How to connect to Microsoft SQL server with Type 4 JDBC driver
    http://www.java-tips.org/content/view/615/29/

  • Jdbc, string and SQL Server's varbinary

    Hi,
    I have a problem, of course otherwise I wouldn't ask for help :)
    So I entered some test data in SQL Server Tables with some varbinary
    types for primary keys. The fields that where put with newid() are the
    problem. Normaly the data should have been put there with jdbc but also
    with newid(). When I try to match them against the same
    data but that was first get from db through jdbc as a string the
    comaparision fails! If for example I get the value for an pk column and
    I put in variable x_pk when I try the select in java:
    ... sql = "Select * from" + tableName + "where pk = " + castSQL(x_pk)
    where castSQL() is for varbinary data type cast from string:
         * Method to cast the strings with pk for sql server.
         * @param str ( String ) the string wilth the pk
         private String castSQL( String str ){
                        String s = str.trim();
                        String ss = "cast (" + asString(s) + "as varbinary)";
         return ss.trim();
    and asString() put the ' around it,
    this select will not work even if the values are the same!!!
    But probalby are not quite the same, something happens on the road in
    getting it from db to string and then cast it to varbinary to compare
    against the value from db.
    So if someone has already encountered this please help me.
    Regards,
    Adrian

    You can't. They're lost forever in the black abyss of the forums.

  • Inserting data to a . SDF database (SQL Server Compact Edition connection)

    Hi, all.
    I'm working on a project that worked fine while connecting to SQL Server 2008. I used a connection string like this:
    Driver={SQL Server Native Client 10.0};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
    Now, I've replaced all database connections in my project to work with SQL Server Compact Edition, and my connection string is something like this:
    Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=myDir\myDataBase.sdf; 
    After changing the type of connection, I'm getting an error on "DB Tools Insert Data.vi". This is what I get:
    Error -2147217872 occurred at NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib: DB Tools Insert Data.vi->Main.vi
    Possible reason(s):ADO Error: 0x80040E30 Exception occured in Microsoft SQL Server Compact OLE DB Provider: The given type name was unrecognized. [,,,,,] in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib: DB Tools Insert Data.vi->Main.vi
    This is a simplified block diagram (as I said, it worked perfectly while using SQL Server 2008 connection):
    Could you please help me?
    Thanks in advance,
    Francisco

    Hi, Steve. Thanks for your answers.
    I worked around this problem by using directly a SQL query instead of this function (you were right, using DBTools Execute Query VI). But now I'm getting problems with other functions, when inserting data into the DB including NULL values.
    I make a SQL query like this using DBTools Execute Query VI:
    INSERT INTO Table1 (Column1, Column2, Column3, Column4, Column5, Column6) VALUES ('Value1', 'Value2', 'Value3', 'NULL', 'Value5', 'Value6') 
    and get the following error:
    ADO Error: 0x80040E07Exception occured in Microsoft SQL Server Compact OLE DB Provider: A literal value in the command could not be converted to the correct type due to a reason other than data overflow. [,,,,,] in NI_Database_API.lvlib:Conn Execute.vi->INSERT (new) restricción (DBCT).vi->Restricciones a Base de Datos (DBCT).vi->Definir - editar restricciones.vi->Main.vi
    The same SQL query worked perfectly when using the SQL Server 2008 connection, so it's not a database structure issue.
    Could somebody please help me?
    Regards,
    Francisco

  • Database Connection in SQL Server 2000

    Hi All!
    I would like to ask your expertise regarding JDBC-MS SQL Server 2000.
    I have here a sample code in connecting to SQL Server 2000, AgriMrpPrd Database using the account "sa" and the password "092802". I have tried running the code in my local server at home and It successfully runs, but when I tried running it on my local server in the office, I was not able to create a connection object though I already have changed the HOST, PORT, DATABASE, USERNAME, and PASSWORD values.
    I have tried logging in using my local account, removed the LAN connection, start my local server and tried connecting to it but still it does not work.
    I have tried turning the firewall OFF and try reconnecting but it there was no improvement.
    I do not know if there is a difference if there is my computer is on a DOMAIN (althought I am only connecting to my local server).
    Source Code:
    import javax.swing.*;
    import java.sql.*;
    import com.microsoft.jdbc.sqlserver.*;
    public class SQLServerConnection{
    public String un, pw, db, host, port, url, driver;
    public Connection conn=null;
    public void connectDB(){
    String msg="",title="MS SQL Server - JDBC:ODBC Connection";          
    int msgType=0;
    driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
    host="206.101.216.95";
    port="1433";
    un="sa";
    pw="092803";
    db="AgriMrpPrd";
    url="jdbc:microsoft:sqlserver://" + host + ":" + port + ";DatabaseName=" + db;
    try{
    Class.forName(driver);
    conn=DriverManager.getConnection(url,un,pw);     
    System.out.println("Connected to Database!");                    
    }catch(Exception ex){
    msg="Unable to connect to MS SQL Server!";
    msgType=JOptionPane.ERROR_MESSAGE;
    JOptionPane.showMessageDialog(null,msg,title,msgType);
    System.exit(0);               
    public static void main(String args[]){
    SQLServerConnection ssc=new SQLServerConnection();
    ssc.connectDB();
    Please give me wisdom in handling this problem...
    Take care always and God blesss
    MADz

    Hi All!
    I would like to ask your expertise regarding JDBC-MS
    SQL Server 2000.
    I have here a sample code in connecting to SQL Server
    2000, AgriMrpPrd Database using the account "sa" and
    the password "092802". I have tried running the code
    in my local server at home and It successfully runs,
    but when I tried running it on my local server in the
    office, I was not able to create a connection object
    though I already have changed the HOST, PORT,
    DATABASE, USERNAME, and PASSWORD values.If the code runs in one place and not the other, it's got to be a problem with seeing the host.
    I have tried logging in using my local account,
    removed the LAN connection, start my local server and
    tried connecting to it but still it does not work.
    I have tried turning the firewall OFF and try
    reconnecting but it there was no improvement.
    I do not know if there is a difference if there is my
    computer is on a DOMAIN (althought I am only
    connecting to my local server).I have no idea how to fix your problem, but there are several things to comment on about your code:
    (1) You don't have to import the microsoft package. It's actually a bad idea.
    (2) I'd name this class DbConnection, because if you wrote it properly it might have a chance of being useful wih other databases, too.
    (3) You hardwire all the connection information. Better to pass it in so changing the database doesn't require a recompile.
    (4) It's bad to mingle Swing and database code. Take those JOptionPane calls out.
    (5) Print the stack trace out when you catch an exception. You're losing a lot of information by handling it that way.
    %

  • Troble configuring Hyperion Shared Services with SQL Server 2005

    I recently installed SQL server (SQL SERVER 2005) in my machine and then am trying to install Hyperion (9.3.1) products. I started with Shared services. It was installed successfully. Problem is occuring when am trying to configure Shared service with SQL database using Hyperion Configuration utility (9.3.1)
    The error which is popping up is
    Unable to connect to the database for the product Hyperion Shared Services.
    Things which I tried from my end
    1. Made sure TCP IP Protocol was enabled in SQL server configuration server.
    2. hypuser was created in SQl server.
    3. hypdb was created in SQL server.
    4. Was having dynamic IP address so install Loopback adapter to obtain Static IP address and port.
    5. Port and IP address was correct.
    Let me know where I am going wrong.
    Any help will be greatly appreciated.

    Finally got it fixed firewall settings needed to be change : This document helped me a lot to troubleshoot the issue
    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) (Microsoft SQL Server, Error: 2)
    This problem may occur when SQL Server 2005 is not configured to accept incoming local and remote connections, which is disabled by default in SQL Server 2005 Express Edition, SQL Server 2005 Developer Edition and also SQL Server 2005 Enterprise Edition. To solve the connection forbidden problem, SQL Server 2005 needs to configure to allow incoming local and remote connections.
    Firstly, ensure that SQL Server 2005 is configured properly to allow incoming connections on the instance of database server, else enable and turn on the local and remote connections setting.
    Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005, followed by Configuration Tools. Click and run the SQL Server Surface Area Configuration.
    On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections.
    On the “Surface Area Configuration for Services and Connections” page, expand Database Engine tree, click Remote Connections.
    Select Local and remote connections, or Local connections only which applicable only if there is no remote system tries to connect to the SQL Server, useful when you just trying to connect and authenticate with the server after installing.
    Select the appropriate protocol to enable to local and/or remote connections environment. To ensure maximum compatibility, select Using both TCP/IP and named pipes.
    Click Apply button when done.
    Click OK button when prompted with the message saying that “Changes to Connection Settings will not take effect until you restart the Database Engine service.”
    On the “Surface Area Configuration for Services and Connections” page, expand Database Engine, then click Service.
    Click Stop button to stop the SQL Server service.
    Wait until the MSSQLSERVER service stops, and then click Start button to restart the MSSQLSERVER service.
    Secondly, SQL Server Browser service has to be enabled to allow for local and remote connections if SQL Server 2005 is running by using an instance name and users are not using a specific TCP/IP port number in the connection string.
    Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005, followed by Configuration Tools. Click and run the SQL Server Surface Area Configuration.
    On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections.
    On the “Surface Area Configuration for Services and Connections” page, click SQL Server Browser.
    Select Automatic as the Startup type to start SQL Server Browser service automatically every time system starts.
    Click Apply button.
    Click on Start button to start the service immediately.
    Click OK button.
    Finally, if remote computer needs to connect and access SQL Server, an exceptions in Windows Firewall included in Windows XP SP2 (Service Pack 2), Windows Server 2003 and Windows Vista needs to be created. If you’re using third-party firewall system, the exception rules also needed to be created to allow external remote connections to the SQL Server 2005 and SQL Server Browser Service to communicate through the firewall, else connections will be blocked. Consult the firewall manual for more details. Each instance of SQL Server 2005 must have its own exception, together with an exclusion for SQL Server Browser service.
    SQL Server 2005 uses an instance ID as part of the path when you install its program files. To create an exception for each instance of SQL Server, you must identify the correct instance ID. To obtain an instance ID, follow these steps:
    Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005, followed by Configuration Tools. Click and run the SQL Server Configuration Manager.
    In “SQL Server Configuration Manager”, click the SQL Server Browser service in the right pane, right-click the instance name in the main window, and then click Properties.
    On the “SQL Server Browser Properties” page, click the Advanced tab, locate the instance ID in the property list.
    Click OK button.
    Then create an exception for SQL Server 2005 in Windows Firewall.
    Click on Start button, the click on Run and type firewall.cpl, and then click OK. For Windows Vista, type firewall.cpl in Start Search box and press Enter key, then click on Allow a program through Windows Firewall link on left tasks pane.
    In “Windows Firewall”, click the Exceptions tab, and then click Add Program.
    In the “Add a Program” window, click Browse button.
    Click the C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe executable program, click Open button. MSSQL.1 with is a placeholder for the instance ID that is obtained from previous procedure. Note that the path may be different depending on where SQL Server 2005 is installed.
    Click OK button.
    Repeat steps 1 through 5 for each instance of SQL Server 2005 that needs an exception.
    For SQL Server Browser service, locate the C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe executable program, and click Open button.
    Click OK button.

  • PeopleTools 8.49 PeopleSoft Database Cannot Connect with MS SQL Server 2005

    Folks,
    Hello. I am working on PeopleSoft PIA. My system is Windows Server 2003, MS SQL Server Express 2005 Standard, PeopleTools 8.49. I am setting up PeopleSoft Database \PsMpDbInstall\setup.exe and got the errors as follows:
    Error: Setup fails to connect to SQL Server. The default settings SQL Server does not allow remote connection.
    Then I type in "sqlcmd" in Command Prompt and got the same error as follows:
    Name Pipe Provider: Could not open a connection to SQL Server. MS SQL Native Client: the default settings SQL Server does not allow remote connection.
    In order to fix SQL Server 2005 remote connection problem, I have done the 3 steps as follows:
    Step 1: In SQL Server Surface Area Connection, enable local and remote connection, TCP/IP and Name Pipes, SQL Server browser Startup type "automatic" and status "running".
    Step 2: Create exception for SQL Server 2005 and SQL Server browser Service in Windows Firewall.
    Step 3: Add the default SQL Server Port 1433 into Windows Firewall.
    But the above 3 steps cannot resolve SQL Server Express 2005 remote connection problem. Can any folks help to resolve this problem ?
    Thanks.

    Folks,
    Management Studio can connect with SQL Server 2005 successfully.
    I have turned off Windows Server 2003 firewall completely. But "sqlcmd" in Command Prompt still connect with SQL Server 2005 because its remote connection is not allowed.
    Is the "not allow remote connection" problem caused by Windows Firewall or SQL Server 2005 itself ?
    Thanks.

  • Accessing SQL Server from Oracle

    I found an article:
    http:www.databasejournal.com/features/oracle/article.php/3442661
    It shows how to setup a connection from Oracle to SQL Server.
    I am new to Oracle Using SQL Loader and PL/SQL.
    I would like to use the SQL Loader in Oracle to load a table in SQL Server. It is my understanding that a ctl file is used and is called by an Oracle application.
    I would not have an Oracle application. I would like to use the ctl file to load the SQL Server table. Can someone point me on how to use the ctl file for SQL Server?
    Also, in PL/SQL would there be a connection string to connect to SQL Server when accessing a table.
    Is there a book or some documentation that would address the above?
    Thanks in Advance.

    that article shows you how to access SQL Server database through Oracle, therefore you have no need to use SQL Loader to load data from SQL Server bcos it can be queried directly by using simple select statement.
    If you want to load the data into Oracle just use CREATE TABLE ... AS SELECT ...
    in PL/SQL, what you need is the database link.
    Cheers,
    NH

Maybe you are looking for