Questions tagged [sqlexception]

An exception that is thrown when the database driver encounters an error. This tag could be used for both C# `SqlExpection` and Java `SQLException`.

C#

SqlException is thrown when encounters a SQL Server related error.

SqlException is the class used by System.Data.SqlClient library to represent an error either communicating with, or generated by, SQL Server.

For errors that are generated by the SQL Server, the Number property will contain SQL Server's error number and Class contains the severity. If there was more than one error or warning returned by the server, then the details of the exception will be populated by the first error\warning and any other errors and warnings can be viewed in the Errors property.

For communication errors, the Message will contain the error details from the network provider and, with .Net 4.5 and above, the InnerException will contain the relevant Win32Exception.

For more information onSqlException, see its MSDN page

Java

An exception that provides information on a database access error or other errors, could be thrown by driver. See official javadoc for more details.

875 questions
3
votes
1 answer

"java.sql.SQLException: Connection has already been closed" after closing the connection

I use weblogic application server and oracle database. I use jdbc for communicating with the oracle database. I get the connection from weblogic datasource and insert a record to the table. The problem is that when I want to close the connection…
Kian
  • 211
  • 1
  • 3
  • 17
3
votes
1 answer

MySQL 8.0.11 is throwing CLIENT_PLUGIN_AUTH is required

I am new to Java. I created Java Maven project and am getting the below error while connecting to MySQL. I am posting my code below. In pom.xml, mysql mysql-connector-java
Anjali
  • 1,680
  • 4
  • 26
  • 48
3
votes
2 answers

Determining if PostgreSQL SQL exception is user error or system error

I am implementing a RESTful Web Service backed by PostgreSQL. When PostgreSQL throws a SQLException, the HTTP response status should be 400 Bad Request if the error is something like the input string for a value is too long, or 500 Internal Server…
Mark Lutton
  • 6,959
  • 7
  • 41
  • 57
3
votes
2 answers

PreparedStatementCallback;invalid ResultSet access for SQL[SQLStatememnt];nested exception is java.sql.SQLException:Invalid column index Spring Auth

I am running a Spring Boot app with the Spring BootSecurtiy i.e., authentication manager builder. The login should be done by the entities of the database. But it shows the following error whenever I login. PreparedStatementCallback; invalid…
sam ross
  • 43
  • 1
  • 1
  • 5
3
votes
2 answers

How should I wrap a SQLException to an unchecked one?

We all know that SQLException is a checked Exception and most of us agree that checked Exception are verbose and leads to throw/catch pollution. Which approach should I choose to avoid SQLException throwing? Which wrapper/technique/library is…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
3
votes
0 answers

System.Data.SqlClient.SqlException : Invalid Column Name 'Machine_Id'

I have a code first db using EF 6. I'm facing the similar issue. I tried all the answers but none of them worked out. My entities are: public class UtilizationSummary { public DateTime SummaryDate { get; set; } public Int32 ProcessKey { get;…
Nameless
  • 1,026
  • 15
  • 28
3
votes
2 answers

Timeout exception when timeout set to infinite time

In my C# .NET 3.5 application I am using CastleProject ActiveRecord over NHibernate. This is desktop application using MS SQL Server 2008. I have set ADO command timeout to 0 to prevent timeout exception during bulk operations:
Alex
  • 1,357
  • 3
  • 18
  • 41
3
votes
2 answers

list of all kind sql exceptions

How can i gets the name of all SQL exceptions? For handling them in my project? Thanks.
Farna
  • 1,157
  • 6
  • 26
  • 45
3
votes
1 answer

java.sql.SQLException Closed Statement

I have a problem, the below code runs fine if I run it without the autoCommit property, however I would prefer to run it as a transaction, the code basically inserts an article's header information and then the list each articles associated with it…
Ricardo
  • 169
  • 2
  • 2
  • 11
3
votes
4 answers

ASP.NET SqlException when publishing in IIS Web Server

I've just start working on an ASP.NET Web Application in Visual Studio 2015 and SQL Server 2014. Somewhere, I need to connect to my local database and I use this: ConnStr = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=my_db;Integrated…
Dionis Beqiraj
  • 737
  • 1
  • 8
  • 31
3
votes
2 answers

Why does ReSharper recommend the removal of its own fix?

ReSharper recommends rethrowing an exception and then, when I do that, it says the entire catch clause is redundant anyway, and suggests it be removed. I am using this code (from MethodMan here): public static DataTable ExecuteDataSet(string sql,…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
3
votes
1 answer

Troubleshooting SqlException

EDIT 3 To be clear, at this point: 1) I am seeing SQL Exceptions in the output but it is not "Catching" any exceptions... code is executing normally and the only reason I know there are exceptions is that I am looking at the output window. Entity…
Ed Landau
  • 966
  • 2
  • 11
  • 24
3
votes
2 answers

ADO.net is not closing TCP connections fast enough

I'm running a multi-threaded operation that fetches data from a SQL Server database using SqlConnection and Parallel.ForEach() and following is happening: I wrap SqlConnection in a using statement so that the connection is properly disposed. My…
Suraj
  • 35,905
  • 47
  • 139
  • 250
3
votes
3 answers

System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'IngredientId', table 'RecipeApplicationDb.dbo.IngredientModels';

I have been looking for a way to automatically generate in ID for an ASP.NET MVC application. This is because I get this error when trying to update the database: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column…
Johan Vergeer
  • 5,208
  • 10
  • 48
  • 105
3
votes
3 answers

ORA-12514 error on **DBVisualizer**

Please help with this error on DBVisualizer. No oracle or Sql is installed i just simply use DBVisualizer. I have read lot of answers here on stackoverflow but not able to find a suitable answer. Note : I used Oracle Thin Driver for connection.I…
SwapnilPopat
  • 517
  • 5
  • 26