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
9
votes
1 answer

Multiple LCID error with SQL Server Full-text Index

Changing one full-text index column Language (LCID) to Neutral when the others are English results in the following error: System.Data.SqlClient.SqlException (0x80131904): Full-text table or indexed view has more than one LCID among its full-text…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
8
votes
4 answers

Get the SQLException java.sql.SQLException: ResultSet.next was not called

I'm developing a Webservice at the moment. I thought I was ready to release my first productive version but I keep getting a SQLException which doesn't make any sense to me. I'm developing against a Oracle db btw. Let me give you my code at first:…
OddDev
  • 3,644
  • 5
  • 30
  • 53
8
votes
2 answers

how do I fix SqlException Time-out occurred while waiting for buffer latch type 2 for page (1:37660679), database ID 10

I was running an application for a few hours and then suddenly: SqlException was unhandled by user code: Time-out occurred while waiting for buffer latch type 2 for page (1:37660679), database ID 10. Viewing details of the exception shows it is…
tomsv
  • 7,207
  • 6
  • 55
  • 88
7
votes
7 answers

Delete sqlite db file

I am developing a C# application with its backend as sqlite. In my application I have a button for cleaning the database (deleting the .db file and creating it again with some initial data). Sometimes when I try to delete the db it says it cannot be…
Sangeetha
  • 601
  • 3
  • 12
  • 26
7
votes
3 answers

ActiveRecord::StatementInvalid SQLite3::SQLException: no such column: true:

I want to have @messages return @folder.messages where the value of column "deleted" is NOT equal to true. I'm not sure why this keeps throwing a SQLException. I guess I'm not formatting the deleted attribute properly, but I'm not sure how to fix…
7
votes
2 answers

How to handle the SQLIntegrityConstraintViolationException in Spring Boot?

I'm working at a RestController and I try to handle the SQLIntegrityConstraintViolationException using try-catch blocks but I don't know why the catch block is never executed. This is the RestController: import java.net.URI; import…
user9608350
7
votes
2 answers

How to know actual problem because of which SqlException is thrown?

I want to handle different problems, while doing database operations, differently. e.g. The operation may fail because of wrong database credentials or due to network problem. Or it may fail because the query is not correct (if string value is being…
Learner
  • 4,661
  • 9
  • 56
  • 102
7
votes
1 answer

Accessing a oracle sql field through java

I have connected the oracle to my Java program, and it is working fine but it gives a problem on a primary key field, when I try to access it it throws an java.sql.SQLException: select user_id from users where users.user_name = '"+username+"' …
Haider Sultan
  • 121
  • 1
  • 8
7
votes
3 answers

Generic way to catch Unique Key Violation

I use System.Data.Common.DbCommand to insert a new row to database. The point is, that this row already exists. try { [...] DbCommand insertCommand = [...] insertCommand.ExecuteScalar(); [...] } catch (System.Exception exception) { …
kbisang
  • 558
  • 4
  • 13
7
votes
7 answers

C# try catch confusion

I'm very new to C#. When I try catch something like this: try { connection.Open(); command.ExecuteNonQuery(); } catch(SqlException ex) { MessageBox.Show("there was an issue!"); } How do I know if the problem happened with the Open or…
Nathan
  • 305
  • 2
  • 3
  • 12
7
votes
4 answers

Strange SQLException: Column not found

I'm getting a weird SQLException on a function I run against a database using JDBC. SQLException: Column 'Message' not found. I have this in my function: st = con.prepareStatement("SELECT…
akafortes
  • 149
  • 1
  • 5
  • 18
7
votes
2 answers

How is SqlException Number assigned

SqlException has the property Number. Then there is this: http://msdn.microsoft.com/en-us/library/cc645603.aspx and this: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx And it seems to be one or the…
Arie
  • 5,251
  • 2
  • 33
  • 54
7
votes
4 answers

Unable to handle System.Data.SqlTypes.SqlNullValueException

I have the following code: public string getFinalCon(string desid) { string finalConId = null; try { query = "select finalConID from discussions where desid=@did"; com = new SqlCommand(query, con); …
Shiva Pareek
  • 1,719
  • 5
  • 21
  • 42
7
votes
1 answer

No compiler error/warning for not catching/throwing exception

I don't understand why the compiler does not warn me about not catching or throwing an SQLException. Here's the situation: I have defined this interface: public interface GenericDatabaseManager { public void createTables(DataBase model) throws…
m0skit0
  • 25,268
  • 11
  • 79
  • 127
6
votes
3 answers

Not able to fetch data from Sqlite Database

I want to fetch data from SQLITE database and display it in a LIST. My database name is AppDB.db and table name is Scrip which contains 3 columns _id(primary key) and symbol&company_name which are text. I want to fetch only 2nd and 3rd column. I…
GAMA
  • 5,958
  • 14
  • 79
  • 126
1 2
3
58 59