sqlexception

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

无人久伴 提交于 2019-12-22 10:49:44
问题 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, mname, lname, bdate, nation, statusq,InstNo, photo, combo, place, mimi; int status; public Brothers() { dbconnect _db = new dbconnect(); /*//////////////the above is just to show that I have two prepared statement each for each sql statement that i have //////////*/ try { Class.forName(

Is there a 64bit driver for Microsoft Access?

喜你入骨 提交于 2019-12-22 09:36:42
问题 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 using jdbc. I am using 64bit windows and microsoft office 2007. any help on this matter would be great. 回答1: Access 2010 has 64 bit drivers and can be downloaded http://www.microsoft.com/downloads/details.aspx?FamilyID=C06B8369-60DD-4B64-A44B

How to catch properly an SqlException: A transport-level error has occurred

不想你离开。 提交于 2019-12-22 05:32:11
问题 I am getting an SqlException in the logs of .NET 3.5 app, I am looking for the corresponding number (value of the property SqlException.Number ). System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) at System.Data.SqlClient.SqlConnection.OnError I am also getting error such as: System.Data.SqlClient.SqlException: A network-related or instance

ORA-00604: error occurred at recursive SQL level 1

最后都变了- 提交于 2019-12-22 00:34:25
问题 I started getting the below SQL exception and I don't know what's the root cause for this exception? I am also closing dbconnection and prepared statement too. Then what's the problem? java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded ORA-01000: maximum open cursors exceeded Below is my code which I am using. Anything wrong in my code?

java sql exception parameter not set

放肆的年华 提交于 2019-12-20 02:09:12
问题 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 never used 2 before. Can anyone help me? public static void tabelVullen(int Kaartnummer,int Datum){ Connection con; try { con = DriverManager.getConnection(DB, "", ""); PreparedStatement s = con.prepareStatement("Select Kaartnummer, Datum,

java.util.Date to java.sql.Date doesn't contain Time

二次信任 提交于 2019-12-19 10:45:16
问题 I'm getting a SqlException on a PreparedStatement for violating a uniqueness constraint on a table (dupe key). Essentially my table looks like this: mytable ======= mytable_id PRIMARY KEY INT NOT NULL fizz_id INT NOT NULL buzz_timestamp DATETIME The uniqueness constraint is on the buzz_timestamp ; that is, no 2 records may have the same date/time "timestamp". The PreparedStatement that inserts records into this table looks like this: PreparedStatement ps = conn.prepareStatement(insertQuery);

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

元气小坏坏 提交于 2019-12-19 04:05:38
问题 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 because of which when I run my update query all the columns in my database store those null values. I have browsed the web and looked at various solution on stack. I found this as a tested solution but it's not working for me. I am new to this so I am

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

拈花ヽ惹草 提交于 2019-12-19 00:57:07
问题 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? 回答1: They're available in the MySQL documentation. Server error codes Client error codes 来源: https://stackoverflow.com/questions/7799086/where-can-i-find-the-list-of-sqlexception-error-codes-for-mysql

How to get parameters from PreparedStatement?

耗尽温柔 提交于 2019-12-18 18:47:50
问题 I'm writing generic logger for SQLException and I'd like to get parameters that were passed into PreparedStatement, how to do it ? I was able to get the count of them. ParameterMetaData metaData = query.getParameterMetaData(); parameterCount = metaData.getParameterCount(); 回答1: Short answer: You can't. Long answer: All JDBC drivers will keep the parameter values somewhere but there is no standard way to get them. If you want to print them for debugging or similar purposes, you have several

Jdbc Hive2 Invalid Url Exception

自古美人都是妖i 提交于 2019-12-18 08:53:24
问题 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 has been succesfully installed and I can connect through beeline without any problems: /usr/lib/hive/bin/beeline Beeline version 0.13.0.2.1.4.0-632 by Apache Hive beeline> !connect jdbc:hive2://localhost:10000 scan complete in 3ms Connecting to jdbc