tagged [jdbc]

org.postgresql.util.PSQLException: FATAL: sorry, too many clients already

org.postgresql.util.PSQLException: FATAL: sorry, too many clients already I am trying to connect to a Postgresql database, I am getting the following Error: > Error:org.postgresql.util.PSQLException: ...

4 Dec at 15:20

How do I connect to a SQL Server 2008 database using JDBC?

How do I connect to a SQL Server 2008 database using JDBC? I have MSSQL 2008 installed on my local PC, and my Java application needs to connect to a MSSQL database. I am a new to MSSQL and I would lik...

1 Sep at 15:39

How do you access the value of an SQL count () query in a Java program

How do you access the value of an SQL count () query in a Java program I want to get to the value I am finding using the COUNT command of SQL. Normally I enter the column name I want to access into th...

4 May at 07:55

IO Error: The Network Adapter could not establish the connection

IO Error: The Network Adapter could not establish the connection I am new to Oracle, and am trying to run a simple example code with Java, but am getting this error when executing the code.. I am able...

25 Sep at 02:52

Data truncation: Data too long for column 'logo' at row 1

Data truncation: Data too long for column 'logo' at row 1 I am trying to insert a photo into a BLOB column of a MySQL table, and I get an exception: Here is the JDBC: ``` int idRestaurant = 42; Stri...

23 Dec at 19:48

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure My program that connects to a MySQL database was working fine. Then, without changing any code used to set up the co...

24 Nov at 08:47

How do I map a hibernate Timestamp to a MySQL BIGINT?

How do I map a hibernate Timestamp to a MySQL BIGINT? I am using Hibernate 3.x, MySQL 4.1.20 with Java 1.6. I am mapping a Hibernate Timestamp to a MySQL TIMESTAMP. So far so good. The problem is that...

15 Dec at 19:34

How to get row count using ResultSet in Java?

How to get row count using ResultSet in Java? I'm trying to create a simple method that receives a ResultSet as a parameter and returns an int that contains the row count of the ResultSet. Is this a v...

3 Jun at 04:55

Iterating over ResultSet and adding its value in an ArrayList

Iterating over ResultSet and adding its value in an ArrayList I am iterating over an `ResultSet` and trying to copy its values in an `ArrayList`. The problem is that its traversing only once. But usin...

20 Mar at 09:26

Using "like" wildcard in prepared statement

Using "like" wildcard in prepared statement I am using prepared statements to execute mysql database queries. And I want to implement a search functionality based on a keyword of sorts. For that I nee...

21 Jan at 01:34

'0000-00-00 00:00:00' can not be represented as java.sql.Timestamp error

'0000-00-00 00:00:00' can not be represented as java.sql.Timestamp error I have a database table containing dates ``` (`date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'). ``` I'm using MySQL. Fr...

23 Sep at 07:46

Efficient way to do batch INSERTS with JDBC

Efficient way to do batch INSERTS with JDBC In my app I need to do a lot of INSERTS. Its a Java app and I am using plain JDBC to execute the queries. The DB being Oracle. I have enabled batching thoug...

24 Sep at 10:11

How to connect SQLite with Java?

How to connect SQLite with Java? I am using one simple code to access the SQLite database from Java application . My code is ``` import java.sql.Connection; import java.sql.DriverManager; import jav...

15 Apr at 06:28

Oracle DB : java.sql.SQLException: Closed Connection

Oracle DB : java.sql.SQLException: Closed Connection Reasons for java.sql.SQLException: Closed Connection from Oracle?? > java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseErro...

22 Jul at 03:26

Difference between Statement and PreparedStatement

Difference between Statement and PreparedStatement The Prepared Statement is a slightly more powerful version of a Statement, and should always be at least as quick and easy to handle as a Statement. ...

4 Jul at 23:58

PreparedStatement with Statement.RETURN_GENERATED_KEYS

PreparedStatement with Statement.RETURN_GENERATED_KEYS The only way that some JDBC drivers to return `Statement.RETURN_GENERATED_KEYS` is to do something of the following: ``` long key = -1L; Statemen...

9 Jan at 14:45

Reading Data From Database and storing in Array List object

Reading Data From Database and storing in Array List object Hello all i want to display entire content of my database table on html page.I am trying to fetch record from database first and store in `...

16 Aug at 09:6

Passing parameters to a JDBC PreparedStatement

Passing parameters to a JDBC PreparedStatement I'm trying to make my validation class for my program. I already establish the connection to the MySQL database and I already inserted rows into the tabl...

19 Aug at 10:47

How to convert TimeStamp to Date in Java?

How to convert TimeStamp to Date in Java? How do I convert 'timeStamp' to `date` after I get the count in Java? My current code is as follows: ``` public class GetCurrentDateTime { public int data()...

7 Aug at 10:16

Cannot load driver class: com.mysql.jdbc.Driver Spring

Cannot load driver class: com.mysql.jdbc.Driver Spring im getting this error even with the driver-class-name difined > java.lang.IllegalStateException: Cannot load driver class: co

15 Jun at 04:0

Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?

Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL? I want to create a database which does not exist through JDBC. Unlike MySQL, PostgreSQL does not support `create if not exists` syntax. What is t...

16 Sep at 18:24

No suitable driver found for 'jdbc:mysql://localhost:3306/mysql

No suitable driver found for 'jdbc:mysql://localhost:3306/mysql Using Java, I get this error when attempting to connect to a mysql database: I'm using the

7 Apr at 19:44

Where can I download mysql jdbc jar from?

Where can I download mysql jdbc jar from? I installed and tried to use jasper report studio. The first brick wall you hit when you try to create a datasource for your reports is The forums say I need ...

28 Aug at 19:11

Can I connect to SQL Server using Windows Authentication from Java EE webapp?

Can I connect to SQL Server using Windows Authentication from Java EE webapp? I am currently investigating how to make a connection to a SQL Server database from my Java EE web application using Windo...

How can I get the SQL of a PreparedStatement?

How can I get the SQL of a PreparedStatement? I have a general Java method with the following method signature: It opens a connection, builds a `PreparedStatement` using the sql statement and the para...

4 Mar at 20:53