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

Dapper Exception - "The ConnectionString property has not been initialized" when 'buffered' is 'false'

I am trying out Dapper and I have stumbled upon this exception: System.InvalidOperationException: The ConnectionString property has not been initialized. ... Here is the code: public IEnumerable GetAll(string sql, DynamicParameters…
5
votes
1 answer

How to catch SQLException of Data ? (eg. Data not exist)

Searching Solution for this question for long period but still unmanaged to get a answer for this, I'm trying to make a search box in my application made with JAVA. I want to catch the exception from database and telling user that column doesn't…
1myb
  • 3,536
  • 12
  • 53
  • 73
5
votes
1 answer

How can I prevent this exception? java.sql.SQLException: Fail to convert to internal representation:

My code is throwing the above exception on the following line (line 2 of this) : final ArrayDescriptor tParamArrayDescriptor = ArrayDescriptor.createDescriptor("MY_SYSTEM.T_PARAM_ARRAY", databaseHandler.getConnection()); final ARRAY oracleArray =…
Jimmy
  • 16,123
  • 39
  • 133
  • 213
5
votes
1 answer

Intermittent SQLException: OALL8 is in an inconsistent state

Am getting the below error intermittently. ERROR Exception occured while fetching the available subscriptions from the database - Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback…
jai
  • 21,519
  • 31
  • 89
  • 120
5
votes
2 answers

Update columns if input values are not null otherwise ignore and keep the existing values of column in database

I am using JAVA and MySQL for updating a table with the input parameters coming as JSON input. The problem is I don't know what all parameters would be present and absent in the input, so it's possible to get null values for some parameters. And…
Piyush Sharma
  • 53
  • 1
  • 5
5
votes
1 answer

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

I'm getting this error: Exception java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). at…
Rbn
  • 71
  • 1
  • 2
  • 5
5
votes
1 answer

SqlException - A transport-level error has occurred when receiving results from the server

I am coding a MVC 5 internet application and I have a recurring task that executes every hour. This task updates some model objects using a DbContext class. The application is deployed as an Azure website. I am getting the following error every few…
Simon
  • 7,991
  • 21
  • 83
  • 163
5
votes
2 answers

architecture mismatch between the Driver and Application?

I am using JDBC to connect to my microsoft access database. I get the following exception when I try to connect to the database: java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the…
shane87
  • 3,090
  • 12
  • 51
  • 65
5
votes
2 answers

java.sql.SQLException: No value specified for parameter 2

I have here my code for login and I am encountering this error, "java.sql.SQLException: No value specified for parameter 2" sometimes, "java.sql.SQLException:Parameter index out of range (1> number of parameters, which is 0)." I really don't have…
5
votes
2 answers

SQL ERROR: Closed Connection in java

Connection is closing automatically even if i'm not closing in finally block. public String look( long id, String codeName, Connection conn ) throws SQLException { try { StringBuffer sel = new…
user2246725
  • 470
  • 1
  • 6
  • 9
5
votes
3 answers

sqldatetime overflow exception c#.NET

string con = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString; SqlConnection cn = new SqlConnection(con); string insert_jobseeker = "INSERT INTO JobSeeker_Registration(Password,HintQuestion,Answer,Date)" …
user1676130
  • 51
  • 1
  • 4
5
votes
6 answers

Issue in connecting Java thin driver in oracle 11G r2

public static Connection getConnection()throws SQLException,ClassNotFoundException { String username="scott"; String password="tiger"; String url="jdbc:oracle:thin:@localhost:1521"; Connection connection =…
Kali
  • 73
  • 1
  • 2
  • 10
5
votes
2 answers

CommunicationsException: Communications link failure

I used java to query some records from Mysql. But in some querys of one duration, i meet a problem which make query failed, but in others , it query successful. The error message is next: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:…
zhouzuan2k
  • 157
  • 2
  • 8
4
votes
2 answers

How To Get SQLException reason from SQLException Object

I am using JDBC, and am running a query. Is there a way to get the reason it failed from the SQLException object returned? In particular, I want to know if my query violated a foreign key constraint (and which one), or a key constraint. Would this…
Daniel Kats
  • 5,141
  • 15
  • 65
  • 102
4
votes
2 answers

Can't connect to SQL Server database: Login failed for user 'sa''

I can't simply connect to my database because of this error Login failed for user 'sa' Consider these lines of code: SqlConnection conn = new SqlConnection("Data Source=arohbi;Initial Catalog=SPADA_FIS;Persist Security Info=True;User…
Rob
  • 638
  • 3
  • 14
  • 34