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
9 answers

A connection was successfully established with the server, but then an error occurred - provider: TCP Provider, error: 0

My web site was working flawless in the old Host, But now i Moved to a new host Please pay attention: The Old host was a VPS on the same host So i'v stoped paying him and now i'm hosting on the same host as a shared host. So I moved all the files…
Ofir Hadad
  • 1,800
  • 3
  • 26
  • 47
4
votes
5 answers

Troubleshooting Timeout SqlExceptions

I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid…
Joel Martinez
  • 46,929
  • 26
  • 130
  • 185
4
votes
2 answers

Procedure times out from ADO.NET but not in SSMS

I've got a stored procedure that is giving me a SqlException because of a timeout when I run it from code (with timeout set to 30). When I run the procedure directly in Management Studio, it executes in under 1 second. I also only get the timeout…
xr280xr
  • 12,621
  • 7
  • 81
  • 125
4
votes
2 answers

Spring JDBCTemplate gives InvalidResultSetAccessException Invalid column index

I use Spring's SimpleJDBCTemplate to access Oracle DB. Here is my code. String sql = "SELECT from_bin_code FROM hbin_import_mapping"; return jt.query(sql, new BeanHbinImportMappingMapper(), (Object) null); The row mapper is: public class…
Will Sumekar
  • 1,249
  • 5
  • 16
  • 25
4
votes
1 answer

Why ResultSet's index in Java Starts with '1' instead of zero?

I am trying to access index 0 in ResultSet but I am getting exception java.sql.SQLException: Column Index out of range, 0 < 1. Code : c = db.getConnection(); String prefQuery = "SELECT pLab from practicals where className = ? AND pFacName =…
AKASH GUDADHE
  • 317
  • 1
  • 6
  • 15
4
votes
2 answers

Access denied for user 'root'@'localhost' with two DataSources in context.xml

I'm facing a problem with Java 8, MySQL Server 5.7.23, MySQL Connector for Java v5.1.45 and Tomcat v9.0.12 (running on Ubuntu Server 18.04). I've built a simple Java application (war) that executes a query in a MySQL database. My context.xml (I've…
Roberto Milani
  • 760
  • 4
  • 20
  • 40
4
votes
1 answer

'Invalid column name [ColumnName]' on a nested linq query

Last update After alot of testing, I realised that if i ran the same query over the same dataset (in this case a Northwind) table on SQL 2000 and SQL 2005, I get two different results. On SQL 2000, i get the error that's in the question. On SQL…
Joe
  • 11,147
  • 7
  • 49
  • 60
4
votes
4 answers

How to get exact sql query that contains exception in batch processing

I want to execute the following: (a transfer to PRESENTATION DB of a row from a fetched row of PROCESSING DB) PreparedStatement stmt; Statement st; Connection conn =…
eunique0216
  • 875
  • 1
  • 16
  • 28
4
votes
2 answers

System.Data.SqlClient.SqlException: Login failed for user 'null'. When publishing asp.net to Azure

I am currently getting the error: System.Data.SqlClient.SqlException: Login failed for user 'null'. When trying to get a token from Asp.net web api. This only happens on Azure and not any other server. Even when running the site locally connecting…
cobus swart
  • 176
  • 1
  • 5
4
votes
3 answers

Is it possible that SqlException is thrown and property Number == 0?

Is it possible that SqlException will be thrown when trying to execute sql procedure and property Number will be 0? Specific situation: domain controller is not available/not responding and no real communication with sql server occurred.
4
votes
2 answers

Java SQLException separate according to errorcode

I need to separate SQLExceptions according to ErrorCode. I have the following if statement in catch block but the else condition is printed always. catch (SQLException ex) { if (ex.getErrorCode() == 28502){ …
Black White
  • 700
  • 3
  • 11
  • 31
4
votes
3 answers

Where is constructor of SqlException?

I am writing unit test to verify detection of exception caused by database overload. But I cannot find constructor of SqlException. Why I cannot see constructor in metadata? Following code is just to help understand why I am looking for…
Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148
4
votes
1 answer

Ucanaccess SQL Exception: feature not supported (Access and Netbeans)

I've been researching this problem for days and have decided to ask this question here to see if anyone can help point me in the right direction. I'm trying to populate combo boxes in my Netbeans 8.0.2 program with data from an MS Access 2013 table.…
tman091
  • 483
  • 1
  • 6
  • 17
4
votes
3 answers

java Unreachable catch block for SQLException

I want to catch SQLException on the try-catch block of Foo method and here is my code which is not working actually; public int Foo() { try { DB.delete("table", "fname=" + name); } catch (SQLException e) { …
BufBills
  • 8,005
  • 12
  • 48
  • 90
4
votes
1 answer

Jdbc Hive2 Invalid Url Exception

I have a Hortonwork cluster (Linux) and want to use JDBC for loading data into Hive from a remote host. I am trying to get the JDBC connection to work locally on the cluster first so that I know I have done it correct before trying remotely. Hive…
C.A
  • 620
  • 1
  • 11
  • 23