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 exception parameter not set

I am trying to get data from a database in a table with 2 where parameters, When i try to execute this code it gives the error: Parameter not set. I think it is a small mistake but I can't find it. The problem could be with the 2 where parameters, i…
gilles coene
  • 33
  • 1
  • 1
  • 6
3
votes
2 answers

Is there a 64bit driver for Microsoft Access?

java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application I get the following error when I try to connect to my Microsoft Access database from an eclipse project…
shane87
  • 3,090
  • 12
  • 51
  • 65
3
votes
5 answers

Finer granularity of SQL Exceptions?

In C# Is there a way of getting a finer granularity with SQL exceptions? I'm aware that an aweful lot can go wrong but I want to deal with certain cases differently and parsing the Error message doesn't seem to be very elegant. Also Are the error…
Omar Kooheji
  • 54,530
  • 68
  • 182
  • 238
3
votes
1 answer

Getting SQLEXCEPTION message in procedures MySQL 5.5.x

How can I get error text in MySQL 5.5 stored procedure when SQLEXCEPTION occurs? I need something along these lines to see what went wrong: DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN GET DIAGNOSTICS CONDITION 1 SELECT "Table @p5 (Msg…
user153923
3
votes
1 answer

JDBC for SQLite in Netbeans: No suitable driver found

I need to load data from an SQLite file into a java program which I develop in Netbeans. The file is to be loaded via a swing menu item. I'm using sqlitejdbc as driver. Here are the code blocks I assume to be important: // header stuff package…
Levent B.
  • 33
  • 1
  • 5
3
votes
3 answers

java.sql.SQLException: Invalid value for getInt() - 'foo'

I have this error "Invalid value for getInt() - 'sirocodir'" , i have search in many forum but no response for my case. In my database the "Auteur_Id" type is a varchar(20). My Facture Entity: @Entity @Table(name = "Factures") public class Factures…
wal-78
  • 41
  • 1
  • 1
  • 4
3
votes
2 answers

resolving invalid cursor state in a for loop

I have a method which retrieve its values from a database. The query that I'm passing worked fine when i tried it in ms access. the error occurs in "results[rowCount][i] = rs.getString(i+1);" this is my full code for the method. private String[][]…
Rocky
  • 429
  • 1
  • 9
  • 26
3
votes
0 answers

java.sql.SQLException: Invalid state, the Connection object is closed

I have a java web application that is running on jetty that connects to SQL server local database (I'm using hibernate). Both the application and the database are in the SAME PC. Everything runs smoothly until I disable the network adapter or unplug…
Nicolasllk
  • 115
  • 1
  • 10
3
votes
1 answer

Hibernate JSF MySql , loss DB connection

I am developing a webapp with JSF 2.2 and hibernate the app works fine, but if I don't use in X hours when I try logged in to the app, it throws this exception: …
3
votes
2 answers

Why does a SqlException thrown by SqlCommand.ExecuteNonQuery contain all the PRINTs as errors?

When I run the following snippet try { using (SqlConnection conn = new SqlConnection("I'm shy")) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = "PRINT 'A';PRINT 'B';PRINT 'C';RAISERROR('SQL_Error', 18,…
Kevin Doyon
  • 3,464
  • 2
  • 33
  • 38
3
votes
1 answer

How to store byte from Java into a bytea in PostgreSQL?

I am getting a problem when I try to insert a variable of type "byte" in Java into a variable of type "bytea" in PostgreSQL. This is my table in postgresql: CREATE TABLE mesa ( id_mesa serial PRIMARY KEY, tag …
Renato Pereira
  • 834
  • 2
  • 9
  • 22
3
votes
3 answers

[Microsoft][ODBC Driver Manager] Invalid string or buffer length exception

this is part of my code my code: Connection dbcon=null; Statement stm; ResultSet rs; ResultSetMetaData metadata; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch (java.lang.ClassNotFoundException e) { …
theosot
  • 327
  • 2
  • 4
  • 8
3
votes
2 answers

Why is there a timeout in a simple select

I have an application which uses SqlCommand.ExecuteReader() to read data from a SQL Server 2008 database. When I use this, I will get a TimeoutException. The CommandTimeout is set to 40s - it takes also 40s till the exception occurs. I have also set…
BennoDual
  • 5,865
  • 15
  • 67
  • 153
3
votes
2 answers

SqlException: System.Data.SqlClient.SqlException (0x80131904)

I wrote a code in C#, which works great at my computer, with Windows 7 (MS SQL Server 2008) but not at the other with Windows Vista (MS SQL Server 2005). I can not change system on the second computer ;) I'm using Visual Studio 2010. So this is the…
3
votes
3 answers

SQLException: No suitableDriver found

This is one of the most topics, but no other on stackoverflow fits. My enviroment is a Tomcat 7 with a JNDI-DataSource defined in context.xml. When i start my Tomcat the following exception is thrown org.apache.tomcat.dbcp.dbcp.SQLNestedException:…
George Krause
  • 59
  • 1
  • 3
  • 11