Escolar Documentos
Profissional Documentos
Cultura Documentos
2012 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. These materials and all Progress software products are copyrighted and all rights are reserved by Progress Software Corporation. The information in these materials is subject to change without notice, and Progress Software Corporation assumes no responsibility for any errors that may appear therein. The references in these materials to specific platforms supported are subject to change. Actional, Apama, Artix, Business Empowerment, Business Making Progress, Corticon, Corticon (and design), DataDirect (and design), DataDirect Connect, DataDirect Connect64, DataDirect Technologies, DataDirect XML Converters, DataDirect XQuery, DataXtend, Dynamic Routing Architecture, Empowerment Center, Fathom, Fuse Mediation Router, Fuse Message Broker, Fuse Services Framework, IONA, Making Software Work Together, Mindreef, ObjectStore, OpenEdge, Orbix, PeerDirect, Powered by Progress, PowerTier, Progress, Progress DataXtend, Progress Dynamics, Progress Business Empowerment, Progress Empowerment Center, Progress Empowerment Program, Progress OpenEdge, Progress Profiles, Progress Results, Progress Software Business Making Progress, Progress Software Developers Network, Progress Sonic, ProVision, PS Select, RulesCloud, RulesWorld, Savvion, SequeLink, Shadow, SOAPscope, SOAPStation, Sonic, Sonic ESB, SonicMQ, Sonic Orchestration Server, SpeedScript, Stylus Studio, Technical Empowerment, WebSpeed, Xcalia (and design), and Your Software, Our Technology-Experience the Connection are registered trademarks of Progress Software Corporation or one of its affiliates or subsidiaries in the U.S. and/or other countries. AccelEvent, Apama Dashboard Studio, Apama Event Manager, Apama Event Modeler, Apama Event Store, Apama Risk Firewall, AppsAlive, AppServer, ASPen, ASP-in-a-Box, BusinessEdge, Cache-Forward, CloudEdge, DataDirect Spy, DataDirect SupportLink, Fuse, FuseSource, Future Proof, GVAC, High Performance Integration, ObjectStore Inspector, ObjectStore Performance Expert, OpenAccess, Orbacus, Pantero, POSSE, ProDataSet, Progress Arcade, Progress CloudEdge, Progress Cloudware, Progress Control Tower, Progress ESP Event Manager, Progress ESP Event Modeler, Progress Event Engine, Progress RFID, Progress RPM, Progress Responsive Cloud, Progress Responsive Process Management, Progress Software, PSE Pro, SectorAlliance, SeeThinkAct, Shadow z/Services, Shadow z/Direct, Shadow z/Events, Shadow z/Presentation, Shadow Studio, SmartBrowser, SmartComponent, SmartDataBrowser, SmartDataObjects, SmartDataView, SmartDialog, SmartFolder, SmartFrame, SmartObjects, SmartPanel, SmartQuery, SmartViewer, SmartWindow, Sonic Business Integration Suite, Sonic Process Manager, Sonic Collaboration Server, Sonic Continuous Availability Architecture, Sonic Database Service, Sonic Workbench, Sonic XML Server, The Brains Behind BAM, WebClient, and Who Makes Progress are trademarks or service marks of Progress Software Corporation and/or its subsidiaries or affiliates in the U.S. and other countries. Java is a registered trademark of Oracle and/or its affiliates. Any other marks contained herein may be trademarks of their respective owners.
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HTML Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Compiled Help File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PDF Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Contacting Customer Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
5 5 6 6 7 7 8
Diagnostic Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tracing Method Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Static Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PerfMon Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Analyzing Performance With Connection Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enabling and Retrieving Statistical Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Statistical Items with an ADO.NET Entity Framework Data Provider . . . . . . Statistical Items Supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tuning Statistics Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the Logging Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuring the Logging Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the Logging Application Block in Application Code . . . . . . . . . . . . . . . . . . . . Establishing a Listener for the Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . When to Use the Logging Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
9 9 10 11 12 12 13 13 14 17 18 19 19 20 21
Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Data Provider Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Database Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 23
Table of Contents Entity Framework Limitations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Entity Framework Version Compatibility Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . Model First Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Code First Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 29 30 30
Index
..................................................
31
Preface
This book is your troubleshooting guide for Progress DataDirect Connect for ADO.NET. It provides you with solutions to common problems and documents error messages that you may receive.
Typographical Conventions
This book uses the following typographical conventions: Convention italics bold UPPERCASE Explanation Introduces new terms with which you may not be familiar, and is used occasionally for emphasis. Emphasizes important information. Also indicates button, menu, and icon names on which you can act. For example, click Next. Indicates keys or key combinations that you can use. For example, press the ENTER key. Also used for SQL reserved words. monospace Indicates syntax examples, values that you specify, or results that you receive.
Preface Convention monospaced italics forward slash / Explanation Indicates names that are placeholders for values that you specify. For example,filename. Separates menus and their associated commands. For example, Select File / Copy means that you should select Copy from the File menu. The slash also separates directory levels when specifying locations under UNIX. vertical rule | brackets [ ] Indicates an "OR" separator used to delineate items. Indicates optional items. For example, in the following statement: SELECT [DISTINCT], DISTINCT is an optional keyword. Also indicates sections of the Windows Registry. braces { } ellipsis . . . Indicates that you must select one item. For example, {yes | no} means that you must specify either yes or no. Indicates that the immediately preceding item can be repeated any number of times in succession. An ellipsis following a closing bracket indicates that all information in that unit can be repeated.
DataDirect Connect Series for ADO.NET Installation Guide details requirements and procedures for installing DataDirect Connect for ADO.NET. DataDirect Connect Series for ADO.NET Users Guide provides provides information about configuring and using the product. DataDirect Connect Series for ADO.NET Reference provides detailed reference information about the product. DataDirect Connect Series for ADO.NET Troubleshooting Guide provides information about error messages and troubleshooting procedures for the product.
HTML Version
The product library, except for the installation guide, is placed on your system as HTML-based online help during a normal installation of the product. The help system is located in the help subdirectory of the product installation directory. To use the help, you must have one of the following Internet browser installed:
Internet Explorer 5.x, 6.x, 7.x, 8.x, and 9x Mozilla Firefox 1.x, 2.x, 3.x, and 8.0 Netscape 4.x, 7.x and 8.x Safari 1.x, 2.x, 3.x , and 5.1.2 Opera 7.54u2, 8.x, and 9.x
About the Product Documentation On Windows, you can access the entire help system by selecting the help icon that appears in the DataDirect Connect for ADO.NET program group. On all platforms, you can access the entire help system by opening the following file from within your browser: install_dir/dotnethelp/help.htm where install_dir is the path to the product installation directory. After the browser opens, the left pane displays the Table of Contents, Index, and Search tabs for the entire documentation library. When you have opened the main screen of the help system in your browser, you can bookmark it in the browser for quick access later. NOTE: Security features set in your browser can prevent the help system from launching. A security warning message is displayed. Often, the warning message provides instructions for unblocking the help system for the current session. To allow the help system to launch without encountering a security warning message, the security settings in your browser can be modified. Check with your system administrator before disabling any security features.
PDF Version
The product documentation is also provided in PDF format. You can view or print the documentation, and perform text searches in the files. The PDF documentation is available on the Progress DataDirect Web site at: http://www.datadirect.com/support/product-info/documentation/by-product.html You can download the entire library in a compressed file. When you uncompress the file, it appears in the correct directory structure. Maintaining the correct directory structure allows cross-book text searches and cross-references. If you download or copy the books individually outside of their normal directory structure, their cross-book search indexes and hyperlinked cross-references to other volumes will not work. You can view a book individually, but it will not automatically open other books to which it has cross-references. To help you navigate through the library, a file, called books.pdf, is provided. This file lists each online book provided for the product. We recommend that you open this file first and, from this file, open the book you want to view. NOTE: To use the cross-book search feature, you must use Adobe Reader 8.0 or higher. If you are using a version of Adobe Reader that does not support the cross book search
Preface feature or are using a version of Adobe Reader earlier than 8.0, you can still view the books and use the Find feature within a single book.
Your customer number or the serial number that corresponds to the product for which you are seeking support, or a case number if you have been provided one for your issue. If you do not have a SupportLink contract, the SupportLink representative assisting you will connect you with our Sales team. Your name, phone number, email address, and organization. For a first-time call, you may be asked for full customer information, including location. The Progress DataDirect product and the version that you are using. The type and version of the operating system where you have installed your product. Any database, database version, third-party software, or other environment information required to understand the problem. A brief description of the problem, including, but not limited to, any error messages you have received, what steps you followed prior to the initial occurrence of the problem, any trace logs capturing the issue, and so on. Depending on the complexity of the problem, you may be asked to submit an example or reproducible application so that the issue can be re-created. A description of what you have attempted to resolve the issue. If you have researched your issue on Web search engines, our Knowledgebase, or have tested additional configurations, applications, or other vendor products, you will want to carefully note everything you have already attempted. A simple assessment of how the severity of the issue is impacting your organization.
June 2012, Release 4.0.0 of DataDirect Connect for ADO.NET, version 0000
Diagnostic Tools
This chapter provides information about troubleshooting tools for the data providers. The data providers delivers advanced diagnostic capability:
Ability to trace method calls PerfMon counters that let you tune connection information for your application Run-time statistics Support for the Logging Application Blocks of the Microsoft Enterprise Library Version 5.0 in your ADO.NET Entity Framework application code
Table 1-1. Environment Variables for Tracing Variable DDTek_Trace_File DDTek_Recreate_Trace Description Specifies the path and name of the trace file, for example, \ProviderNameTrace.txt. When set to 1, re-creates the trace file each time the application restarts. When set to 0 (the initial default), the trace file is appended. When set to 1 or higher, enables tracing. When set to 0 (the initial default), tracing is disabled.
DDTek_Enable_Trace
10
Table 1-1. Environment Variables for Tracing Variable DDTek_XA_Trace_File Description When set to 1, enables tracing of the Helper library. When set to 0 (the initial default), tracing of the Helper library is disabled. When set to 1, enables tracing of the Logging Application Block. When set to 0 (the initial default), tracing of the Logging Application Block is disabled.
DDTek_Enable_Logging_ Application_Block_Trace
NOTE: If tracing is enabled and no trace file is specified by either the connection string option or the environment variable, the data provider saves the results to a file named DDTekTrace.txt.
PerfMon Support
11
PerfMon Support
The Performance Monitor (PerfMon) utility allows you to record application parameters and review the results as a report or graph. You can also use Performance Monitor to identify the number and frequency of CLR exceptions in your applications. In addition, you can fine-tune network load by analyzing the number of connections and connection pools being used. All DataDirect Connect for ADO.NET data providers install a set of PerfMon counters that let you tune and debug applications that use the data provider. The data providers counters are located in the Performance Monitor under a category name, for example, DataDirect Oracle ADO.NET Data Provider. Table 1-2 describes the counters that you can use to tune connections for your application. Table 1-2. PerfMon Counters Counter Current # of Connection Pools Current # of Pooled Connections Current # of Pooled and Non-Pooled Connections Description Returns the current number of pools associated with the process. Returns the current number of connections in all pools associated with the process. Returns the current number of pooled and non-pooled connections. If the Max Pool Size Behavior connection string option is set to SoftCap, the value returned can be greater than the value defined for the Max Pool Size connection string option. Returns the highest number of connections in all connection pools since the process started. Returns the total number of attempts to open a connection that failed for any reason since the process started. Returns the total number of command executions that failed for any reason since the process started.
For information on using PerfMon and performance counters, refer to the Microsoft documentation library.
12
Automate analysis of application performance. Identify trends in application performance. Detect connectivity incidents and send notifications. Determine priorities for fixing data connectivity problems.
Enabling the statistics items affects performance slightly. For best results, consider enabling statistics gathering only when you are analyzing network or performance behavior in your application. NOTE: Applications that use the ADO.NET Entity Framework require some implementation differences from that shown in the examples in this chapter, although the resulting functionality is the same. See "Using Statistical Items with an ADO.NET Entity Framework Data Provider" on page 14 for more information.
Overview
Statistics gathering can be enabled on any Connection object, for as long as it is useful. For example, you can define your application to enable statistics before beginning a complex set of transactions related to performing a business analysis and disable statistics when the task is complete. You can retrieve the length of time the data provider had to wait for the server and the number of rows that were returned as soon as the task is complete or wait until a later time. Because the application disables statistics at the end of the task, the statistical items are measured only during the period in which you are interested. Functionally, the statistical items can be grouped into five categories:
Network layer items retrieve values associated with network activities, such as the number of bytes and packets that are sent and received and the length of time the data provider waited for replies from the server. Aggregate items return a calculated value, such as the number of bytes sent or received per round trip to the server. Row disposition statistical items provide information about the time and resources required to dispose of rows not read by the application. Statement statistical items return values that pertain to the number of statements and stored procedures that have been executed. Statement cache statistical items return values that describe the activity of statements in a statement cache. For more information on using the statement cache, refer to "Using Statement Caching" in Chapter 3 in the DataDirect Connect Series for ADO.NET Users Guide.
13
14
Table 1-3. Mapping to Pseudo Stored Procedure Property and Method StatisticsEnabled property ResetStatistics method RetrieveStatistics method Pseudo Stored Procedure DDTek_Connection_StatisticsEnabled DDTek_Connection_StatisticsDisabled DDTek_Connection_ResetStatistics DDTek_Connection_RetrieveStatistics
You can create a function mapping in the entity model to invoke the pseudo-stored procedure. Alternatively, applications can use the ObjectContext to create a stored procedure command as shown in the following C# code fragment: using (MyContext context = new MyContext()) { EntityConnection entityConnection = (EntityConnection)context.Connection; // The EntityConnection exposes the underlying store connection DbConnection storeConnection = entityConnection.StoreConnection; DbCommand command = storeConnection.CreateCommand(); command.CommandText = "DDTek_Connection_EnableStatistics"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new OracleParameter("cid", 1)); } bool openingConnection = command.Connection.State == ConnectionState.Closed; if (openingConnection) { command.Connection.Open(); } int result; try { result = command.ExecuteNonQuery(); }
Analyzing Performance With Connection Statistics finally { if (openingConnection && command.Connection.State == ConnectionState.Open) { command.Connection.Close(); } }
15
BytesSent
16
Table 1-4. Statistical Items (cont.) Statistical Item PacketsSent Description Returns the number of packets sent to data source by the data provider after statistics are enabled. Large commands can require multiple buffers. For example, if a large command is sent to the server and it requires six packets, ServerRoundtrips is incremented by one and BuffersSent is incremented by six. SocketReads SocketWrites Measurements for Aggregates BytesReceivedPerRoundTrip BytesReceivedPerSocketRead BytesSentPerRoundTrip BytesSentPerSocketWrite PacketsReceivedPerRoundTrip PacketsReceivedPerSocketRead PacketsSentPerRoundTrip PacketsSentPerSocketWrite Measurements for Statements DDLCount IDUCount Returns the number of DDL statements (Create, Alter and Drop) executed. Returns the total number of Insert, Delete, and Update statements executed through the connection, including those executed using a stored procedure. The count starts after the application starts using the data provider and enables statistics on the Connection object. Returns the number of Select statements executed through the connection, including Fetch statements to retrieve rows from cursors. The count starts after the application starts using the data provider and enables statistics on the connection, and is updated when the end of a DataReader is reached. NOTE: This count does not include Select statements executed within a stored procedure. SelectRowsRead Returns the number of rows read by the application, including rows read as a result of Select statements executed within stored procedures. This count may be less than the total number of rows returned by the server. Returns the aggregate of BytesReceived divided by ServerRoundTrips. Returns the aggregate of BytesReceived divided by SocketReads. Returns the aggregate BytesSent divided by ServerRoundTrips. Returns the aggregate of BytesSent divided by SocketWrites. Returns the aggregate of PacketsReceived divided by ServerRoundTrips. Returns the aggregate of PacketsReceived divided by SocketReads. Returns the aggregate of PacketsSent divided by ServerRoundTrips. Returns the aggregate of PacketsSent divided by SocketWrites. Returns the number of times the data provider reads from the socket. Returns the number of times the data provider writes to the socket.
SelectCount
17
Table 1-4. Statistical Items (cont.) Statistical Item ServerRoundTrips Description Returns the number of times the connection sent commands to the server and received a reply. The count starts after the application starts using the data provider and enables statistics on the connection. Returns the cumulative amount of time the data provider spent waiting for replies from the server. The count starts after the application starts using the data provider and enables statistics on the connection. Returns a time statistic that represents the cumulative amount of time the data provider spent sending requests to the server. Returns the number of stored procedure statements executed. Returns the number of times a statement was successfully found in the statement cache. Returns the number of times a statement was not found in a statement cache. Returns the number of times a statement, though not found in the statement cache, was added to the cache after removing another. Returns a sampling statistic that returns the highest hit count of all the statements in the cache. Returns a sampling statistic that returns the second highest hit count of all the statements in the statement cache. Returns a sampling statistic that returns the third highest hit count of all the statements in the statement cache. Returns the number of additional bytes received from the server to dispose of rows not read by the application. Returns the number of additional socket reads required to dispose of rows not read by the application. Returns the time required to dispose of rows not read by the application.
SocketReadTime
SocketWriteTime StoredProcedureCount Measurements for Statement Cache StatementCacheHits StatementCacheMissed StatementCacheReplaces StatementCacheTopHit1 StatementCacheTopHit2 StatementCacheTopHit3 Measurements for Disposing of Rows BytesReceivedToDisposeOfUnreadRows SocketReadsToDisposeOfUnreadRows TimeToDisposeOfUnreadRows
18
Chapter 1 Diagnostic Tools When you let the database filter the rows for you, only the data that you need is sent across the network to the application. The following SQL statement is carefully written so that the application reads all rows retrieved: SELECT * FROM employee WHERE hiredate > 2000 AND job_title='Manager' The statistical items returned show that there is virtually no cost associated with disposing rows. TimeToDisposeOfUnreadRows = 9.07936623230047E-05 SocketReadsToDisposeOfUnreadRows = 0 BytesReceivedToDisposeOfUnreadRows = 0 SelectRowsRead = 1000 With a less focused SQL statement, the application returns 1000 rows and reads only half of the rows returned. Disposing 500 rows has a cost. TimeToDisposeOfUnreadRows = 0.56059694737739 SocketReadsToDisposeOfUnreadRows = 344 BytesReceivedToDisposeOfUnreadRows = 87989 SelectRowsRead = 500 Suppose the application reads none of the 1000 rows returned. The cost of disposing all 1000 rows roughly doubles. TimeToDisposeOfUnreadRows = 1.12182134880271 SocketReadsToDisposeOfUnreadRows = 692 BytesReceivedToDisposeOfUnreadRows = 177077 SelectRowsRead = 0 If you cannot properly qualify your queries so that the application reads all the rows you request of the server, you might be able to mitigate the effect on performance of disposing of unread rows using a connection string option. For the Sybase data provider, use ReaderCloseBehavior=0. This option cancels the query and efficiently processes the remaining reply. Running with this option improves the results of the previous examples dramatically. Suppose the application reads 500 of the 1000 rows. Disposing of 500 rows is 10 times faster! TimeToDisposeOfUnreadRows = 0.0508947366215539 SocketReadsToDisposeOfUnreadRows = 34 BytesReceivedToDisposeOfUnreadRows = 8313 SelectRowsRead = 500 However, if the application reads 0 of the 1000 rows, disposing of all 1000 rows is roughly the same cost as 500 rows. TimeToDisposeOfUnreadRows = 0.0513160192147326 SocketReadsToDisposeOfUnreadRows = 34 BytesReceivedToDisposeOfUnreadRows = 8349 SelectRowsRead = 0
19
DDTek Detailed Information: Enables SQL, Parameter, and DbCommandTree logging DDTek Error: Information related to errors DDTek Information: Information not related to errors
EnableLoggingApplicationBlock: Enables the Logging Application Block. LABLoggerTypeName: Specifies the type name for the Logging Application Block.
20
LABLogEntryTypeName: Specifies the type name for the LogEntry object. LABAssemblyName: Specifies the assembly name to which the Logging Application Block applies. NOTE: If you are using any version of the LAB other than the Microsoft Enterprise Library 5.0 (April 2010) binary release, you must set the LABAssemblyName. For example, if you are using an older or newer version of the LAB, or a version that you have customized, you must specify a value for LABAssemblyName.
The following code fragment provides an example of a Logging Application Block that could be added to an Oracle data access application. <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="" logWarningsWhenNoCategoriesMatch="true"> <listeners> <add fileName="rolling.log" footer="----------------------------------------" header="----------------------------------------" rollFileExistsBehavior="Overwrite" rollInterval="None" rollSizeKB="0" timeStampPattern="yyyy-MM-dd" listenerDataType= "Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken= 31bf3856ad364e35" traceOutputOptions="None" filter="All" type= "Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken= 31bf3856ad364e35" name="Rolling Flat File Trace Listener" /> </listeners> <formatters> <add template="Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}

" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken= 31bf3856ad364e35" name="Text Formatter" /> </formatters> <categorySources> <add switchValue="All" name="DDTek"> <listeners> <add name="Rolling Flat File Trace Listener" /> </listeners> </add> </categorySources> <specialSources> <allEvents switchValue="All" name="All Events" /> <notProcessed switchValue="All" name="Unprocessed Category" /> <errors switchValue="All" name="Logging Errors & Warnings"> <listeners> <add name="Rolling Flat File Trace Listener" /> </listeners>
21
22
23
Error Messages
Error messages can be generated from:
Database Errors
An error that occurs in the data source includes the data store name, in the following format: [vendor] [dotnet_component] [data_store] message With this type of message, dotnet_component is the component that received the error specified by the data store. For example, you may receive the following message from an Oracle data store: [DataDirect] [.NET Oracle Provider] [Oracle] ORA-0919: specified length too long for CHAR column. This type of error is generated by the database system. Check your database system documentation for more information or consult your database administrator. In this example, you would check your Oracle documentation.
24
25
Setup/Connection issues Interoperability issues Performance Issues Distributed transaction issues Entity Framework implementation issues
This chapter describes these types of issues, provides some typical causes of the issues, lists some diagnostic tools that are useful to troubleshoot the issues, and, in some cases, explains possible actions you can take to resolve the issues.
Setup/Connection Issues
Setup/connection issues, such as an error or hang, can occur while you are trying to make a database connection with the data provider or are trying to configure the data provider. Some common errors that are returned by the data provider if you are experiencing a setup/connection issue include:
Specified data provider could not be loaded Data source name not found and no default data provider specified ORA-12203: Unable to connect to destination ORA-01017: invalid username/password; logon denied
In some cases, the solution to the problem might be as simple as starting the database or the listener, or changing the user name and password. Refer to our Knowledgebase for other possible solutions.
26
Interoperability Issues
Interoperability issues can occur when you have a working ADO.NET application in place. In these cases, the issue occurs in one or more of the following components of ADO.NET the ADO.NET application, ADO.NET data provider, and/or data source. Refer to the DataDirect Connect Series for ADO.NET Users Guide for an explanation of the components of ADO.NET. Some common examples of what you might experience if you have an interoperability issue are:
SQL statements fail to execute. Data is returned/updated/deleted/inserted incorrectly. A hang or core dump occurs.
Performance Issues
27
Performance Issues
Developing performance-oriented .NET applications is not easy. The .NET standard includes only basic guidelines and interface definitions to help programmers develop .NET applications. The ADO.NET data providers do not automatically throw exceptions to say that your code is running too slowly. Designing a .NET application is a complex process, in part because the code can be very data provider-specific. If you are working with several databases, you will find that the programming concepts vary between the different data providers. You will need much more database knowledge to design your application effectively. Some guidelines for developing performance-oriented ADO.NET applications include:
Retrieving only required data Selecting objects and methods that optimize performance Managing connections and updates
Refer to "Designing .NET Applications for Performance Optimization" on page 89 in Chapter 7 in the DataDirect Connect Series for ADO.NET Reference for detailed information.
For the DB2, Oracle, and Sybase data providers, select the Enable XA Transactions check box and click OK. For the SQL Server data provider, select the Network DTC Access check box and click OK.
NOTE: The location of the MS DTC configuration varies by Windows version. Refer to the Microsoft Windows help for detailed information for your environment.
28
Configuration Issues
Check for the following issues when problems occur while using distributed transactions. MS DTC is configured improperly Error occurred when enlisting connection in distributed transaction. The MS DTC service must be in a running state, with the appropriate values selected on the Security Settings tab of the Component Services Administrative Tool:
For the SQL Server data provider, select the Network DTC Access check box. For the Oracle, DB2, and Sybase data providers, select the Enable XA Transactions check box.
MS DTC registry entry is missing Error occurred when enlisting connection in distributed transaction. The product installation may have been damaged. Uninstall the data provider and reinstall it. The DDTek.providerHelper assembly is missing from the GAC The optional DTC support components cannot be located. Please make sure you have installed them and that they are on your path. See the product documentation for more details. The product installation may have been damaged. Uninstall the data provider and reinstall it.
29
Your application has an explicit reference to the Oracle Entity Framework data provider. Your application references an earlier revision of the EntityFramework.dll (for example, Entity Framework 4.1) or an EntityFramework.dll revision subsequent to 4.2.
The following code snippet demonstrates the only scenario in which your application would need to specify an explicit reference to the Oracle Entity Framework data provider: Database.DefaultConnectionFactory = new DDTek.Oracle.Entity.OracleConnectionFactory(); In the following example, an error occurs because the application refers to a different EntityFramework.dll from the version used by the Oracle Entity Framework data provider: Assembly 'DDTek.Oracle.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c84cd5c63851e072' uses 'EntityFramework, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' which has a higher version than referenced assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' In the following example, an error occurs because the application refers to an EntityFramework.dll revision that is subsequent to the 4.2 revision used by the Oracle Entity Framework data provider: Could not load file or assembly 'EntityFramework, Version=4.2.0.0, Culture= neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. To avoid these error scenarios, your application can create the model using a named connection string to set the Database.DefaultConnectionFactory: app.config entry <configuration> <connectionStrings> <add name="EF_Oracle_10g_UTF8" connectionString="host=server1;port=1522;user id=test;password=xxx;sid=NorthwindEFUTF8" providerName="DDTek.Oracle" /> </connectionStrings> </configuration> Create the context as follows: model2 ctx = new model2("EF_Oracle_10g_UTF8");
30
Table 3-2. Error Messages for the Sybase Entity Framework Data Provider Problem Tried to use Code First Tried to use Entity Framework 4.0 Canonical Functions Error Message dbo.EdmMetadata not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce a lot of output). Function 'AddDays' not found. If this is a SQLJ function or SQL function, use sp_help to check whether the object exists (sp_help may produce a lot of output).
31
Index
A
ADO.NET Entity Framework, versions supported 28 aggravate values, retrieving 15 Entity Framework data providers limitations 28 using connection statistics 13 using Logging Application Block 18 environment variables, using to enable tracing 9 error messages 23 establishing a listener for the Logging Application Block log 20
B
books HTML version 6 PDF version 7
H
help file 7
C
Code First issues 30 compiled help file 7 configuring Logging Application Block 19 connection issues 25 connection pool, tracking number used 11 connections statistical analysis of behavior 12 tracking performance using PerfMon 11 contacting Customer Support 8 conventions, typographical 5 counters, PerfMon 11 Customer Support, contacting 8
I
interoperability issues 26
L
Logging Application Block configuring 19 establishing a listener for the log 20 support 18 using in application code 19 when to use 21
D
debugging maintaining security of passwords 9 using PerfMon 11 diagnostic support connection statistics 12 PerfMon counters 11 disposing of rows measuring the cost of 17 unread rows 17 distributed transaction issues 27 documentation, about 6
M
methods, tracing calls 9 Model First issues 30 MS DTC service, enabling 27
N
network layer statistics 15
O E
enabling statistics gathering 13 enabling the MS DTC service 27 enabling tracing using environment variables 9 using static methods 10 online books, installing 6
32
Index
P
password, concealed in trace log 9 PerfMon support 11 performance optimizing with connection statistics 12 troubleshooting issues 27
R
retrieving statistical items 13 rows, disposing of unread 17
S
security, enabling for tracing 9 setup issues 25 statement cache, retrieving statistics from 16 static methods, enabling tracing with 10 statistics aggregate values 15 disposing rows 17 enabling gathering of 13 network layer 15 reducing the performance impact of gathering 12, 17 retrieving 13 statement cache 16 statements 16 statistical items supporting 14
T
tools PerfMon support 11 tracing method calls 9 Trace class, enabling tracing 9 tracing enabling through environment variables 9 enabling through static methods 10 method calls 9 overview 9 re-creating the trace file 9 setting the path to the trace file 9 tracking performance 11 troubleshooting interoperability issues 26 performance issues 27 setup/connection issues 25 tuning statistics gathering 17 using connection statistics 12 typographical conventions 5