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
15
votes
3 answers

What causes Timeout expired SqlExceptions in LINQ to SQL?

My application keeps running into Timeout Expired SqlExceptions. The thing is that this query is one that will simply have to run for a decent amount of time. I'm having trouble figuring out where this exception is occurring though. Is this a…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
15
votes
4 answers

How can I get the actual SQL that caused an SqlException in C#?

Possible Duplicate: Obtain the Query/CommandText that caused a SQLException I am working on some error handling code (using elmah) and the default setup only sends the error message. I would like to know the actual SQL that throws an error (i.e.…
Aaron Silverman
  • 22,070
  • 21
  • 83
  • 103
15
votes
4 answers

Obtain the Query/CommandText that caused a SQLException

I've got a logger that records exception information for our in house applications. When we log SQL exceptions it'd be super useful if we could see the actual query that caused the exception. Is there a way we can achieve this?
Doctor Jones
  • 21,196
  • 13
  • 77
  • 99
14
votes
12 answers

No suitable driver found for Oracle Database connection

I have small Java Application, which execute every day and checks for data in database using Cronj Schedular and everything works fine, but recently I have observed that, it is failing due to java.sql.SQLException: No suitable driver found for…
Ravi
  • 30,829
  • 42
  • 119
  • 173
13
votes
7 answers

What does "if (rs.next())" mean?

I am currently getting the error, java.sql.SQLException: Method 'executeQuery(String)' not allowed on prepared statement. because I am using PreparedStatement stmt = conn.prepareStatement(sql); and also had ResultSet rs =…
Turk
  • 269
  • 2
  • 11
  • 17
12
votes
2 answers

SQLException: no suitable driver found for jdbc:mysql between two maven projects

I've 2 maven projects in my Eclipse (v4.7.0) workspace. The first project contains some utility stuffs and holds the connection to my MySQL database through JDBC driver.
Roberto Milani
  • 760
  • 4
  • 20
  • 40
12
votes
4 answers

java.sql.SQLException: No database selected - why?

the last days I was trying to learn how to access mySQL databases via Java. I am able to load the driver and get a connection to the database ( at least I think so, since I don't get an exception there..) the code is: import java.sql.*; …
sepphuber3
  • 135
  • 1
  • 1
  • 8
12
votes
5 answers

ResultSet.getString(1) throws java.sql.SQLException: Invalid operation at current cursor position

When I run the following servlet: // package projectcodes; public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException { String UserID = request.getParameter("UserID"); String UserPassword…
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
11
votes
5 answers

SQLException: No suitable driver found

I have a Java class that accesses a MySQL database through JDBC that I use in a JSP running on Tomcat, and I am getting No Driver Found Exception. I have a method: private static Statement makeStatement() { try{ com.mysql.jdbc.Driver d =…
Eliezer
  • 7,209
  • 12
  • 56
  • 103
10
votes
2 answers

RAISERROR―How to distinguish with SqlException?

I have some 3-4 stored procedures ― which I can modify if needed ― that use RAISERROR to inform my application of some fatal errors on the database side. Some of these stored procedures are executed from the C# side with ExecuteNonQuery, while…
User
  • 3,244
  • 8
  • 27
  • 48
10
votes
3 answers

provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host

I wrote a console app that just calls a stored procedure in a SQL Server database. Then I set up a Windows Task Scheduler event to call the console app's .exe file every 5 minutes. Most of the time it works, however about 10 times a day or so we get…
10
votes
3 answers

SQLiteException: cannot start a transaction within a transaction (code 1)

I'm having a problem finishing an SQLite transaction and I'm totally baffled on how to do it. It totally looks like this bug from 2007. I'm creating my employee table (which references another table entity) as follows (edited for brevity): CREATE…
m0skit0
  • 25,268
  • 11
  • 79
  • 127
9
votes
1 answer

Where can I find the list of SQLException error codes for MySQL?

java.sql.SQLException offers an int getErrorCode() function so the program can know what in particular has happened to cause the exception. Any chance to get a list of these codes for MySQL?
Ivan
  • 63,011
  • 101
  • 250
  • 382
9
votes
5 answers

Ambiguous column name error

When executing the following (complete) SQL query on Microsoft SQL Server 2000: SELECT B.ARTIFACTTNS, B.ARTIFACTNAME, B.ARTIFACTTYPE, B.INITIALBYTES, B.TIMESTAMP1, B.FILENAME, B.BACKINGCLASS, B.CHARENCODING, B.APPNAME, B.COMPONENTTNS,…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
9
votes
2 answers

java.sql.sqlRecoverableException: Closed statement: next

My code throws java.sql.sqlRecoverableException: Sentencia cerrada: next which, in English, I guess it would be: java.sql.sqlRecoverableException: Closed statement: next This is my code: public TransactionArray() throws SQLException { /*…
Josep
  • 495
  • 2
  • 6
  • 16
1
2
3
58 59