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

SQLException error handling in android

Hi in my project i need to handling the exception like duplicate value,empty field etc.. I thought of using the try catch method for this public void deleteRegisterID(Object object) { SQLiteDatabase oDBLocal = this.getWritableDatabase(); …
Jagan
  • 692
  • 1
  • 12
  • 38
4
votes
1 answer

What can a repeating stack trace mean?

I have a webservice with a webmethod that is called asynchronously both at set intervals of time and randomly depending on different factors (which basically means it can be called at any time by multiple things). This webmethod calls a database…
S_F
  • 877
  • 7
  • 17
4
votes
5 answers

java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 0)

public class Brothers extends javax.swing.JFrame { /** * declaring connection and SQL statement */ Connection cn; Statement st; PreparedStatement pstmt=null; PreparedStatement pst; ResultSet rs; Object fname,…
Isaiah
  • 41
  • 1
  • 2
  • 3
4
votes
4 answers

Why is android.database.SQLException unchecked?

This might be unsuitable for SO since it isn't really a coding-problem, but I couldn't find a satisfying answer yet and I believe the SO-community can. So, by definition android.database.SQLException and java.sql.SQLException share about the same…
Gerrit-K
  • 1,298
  • 2
  • 15
  • 30
4
votes
3 answers

java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...'

I have code looking like that: @Column(name = COLUMN_DESCRIPTION, columnDefinition = "LONGTEXT") private Map description = new HashMap<>(); after trying to add something to column i got java.sql.SQLException: Incorrect string…
akuzma
  • 1,592
  • 6
  • 22
  • 49
4
votes
1 answer

How can I avoid a java.sql.SQLException due to I/O Error: Connection reset?

After a SQL Server database restart, my Tomcat 6 Spring web applications receives an SQL exception on the first attempt to query the database. Note: Tomcat 6 has continued to run during the SQL Server restart and I'm using myBatis. The exception is…
James
  • 2,876
  • 18
  • 72
  • 116
4
votes
1 answer

An error occured during the pre-login handshake

I had a C# application that communicates with a database using Linq to SQL and was working just fine when I last tested it a month ago. However, it is now throwing the following exception: A first chance exception of type…
Tim
  • 2,731
  • 9
  • 35
  • 72
4
votes
2 answers

SQLiteJDBC and PreparedStatement to use pragma table_info

I'm utilizing Java and SQLiteJDBC to work with SQLite. I need to access name of columns for a given table and I've found that I could accomplish this with the following command: pragma table_info(myTable) However, when attempting to do the…
Frank V
  • 25,141
  • 34
  • 106
  • 144
4
votes
2 answers

How to create a scrollable ResultSet?

I got this simple code to retrieve a recordset from a MSSQL Server 2008 which has to be scrollable due to the fact that I set the ResultSet.TYPE_SCROLL_INSENSITVE, same as the example from the Javadocs: String qry = "SELECT * from…
Pascal Weber
  • 557
  • 3
  • 11
  • 19
4
votes
3 answers

java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line

I'm executing the following: private void createTable() { try { PreparedStatement psCreateTable = con.prepareStatement("CREATE TABLE COMPANIES(" + "name VARCHAR(50), " + "location VARCHAR(50), "…
Marvin Effing
  • 2,693
  • 3
  • 20
  • 35
4
votes
2 answers

How to force a SQLException in JUnit

I'm writing unit tests in JUnit, but have not been able to successfully cover a branch of a particular method that catches a SQLException and returns a null object. This is the class I'm testing: @Component public class UnitOfMeasureRowMapper…
James Dunn
  • 8,064
  • 13
  • 53
  • 87
4
votes
2 answers

Getting SQL Exception while using prepared statement for select query

StringBuilder sqlQry = new StringBuilder(); sqlQry.append("SELECT LIB, PATH") .append(" FROM OBJ") .append(" INNER JOIN SRC ON SRC.MBR = OBJ.LOBJ") .append(" WHERE TYPE = '*PGM'") .append(" AND SRC.PATH LIKE…
NKM
  • 304
  • 2
  • 7
  • 13
3
votes
5 answers

Java Oracle localhost connection error (ORA-12505)

I am trying to currently connect to a database on my current computer. import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static void main(String[] argv) throws Exception { …
k9b
  • 1,457
  • 4
  • 24
  • 54
3
votes
2 answers

How to troubleshoot SqlException deadlocked on lock | communication buffer resources

There are varying versions of this question on stackoverflow already, but none of them helped me to get to the bottom of my issue. So, here I go again with more specific details of my problem. We've been randomly getting Transaction (Process ID xx)…
sbp
  • 913
  • 8
  • 19
3
votes
2 answers

System.Data.SqlClient.SqlException: Invalid column name 'GenreId'

I am new in ASP.NET and I am learning MVC and EF. I could not match any existing answer to my question so please help. Code first is used. I get an error: Error Here is the code for Action method in the Controller: public ActionResult…
JasnaP
  • 31
  • 1
  • 2