Tagged Questions
4
votes
1answer
60 views
Postgres + Play Framework + Slick no suitable driver found
I'm writing a Scala web app with the Play Framework 2.1.1 using using a local Postgres database along with Slick 2.10, and I'm running into what seems to be a contradiction here.
The Problem
This is ...
0
votes
1answer
13 views
postgres multiple JDBC select statements in batch
How do you issue a single JDBC call to Postgres which includes 2 select statements? The two select statements select from different sets of tables and return two different result sets - so cannot be ...
1
vote
1answer
21 views
JDBC connection created ineclipse does not work as it should
I created a jdbc connection which seems to show all the tables from all the other schemas ( information_schema, pg_catalog, pg_toast_temp_1 ) except for the tables in the public schema. Any ...
0
votes
1answer
24 views
Postgres aborts transactions and ignores queries until the transaction is ended, is it possible to process the transaction before its rolled back?
I'm trying to improve upon error handling in a Java/Postgres application and an error that occurs frequently is input being too long for a column with a fixed length. I roll the transaction back when ...
0
votes
0answers
70 views
Exception with batch insert jdbc
I am trying to read the data from a csv files from a particular folder and based on the first parameter I insert the data into a table.The database is postgres. But I am getting ...
0
votes
2answers
29 views
($Proxy6) org.postgresql.jdbc4.Jdbc4Connection@5894585b, what does it mean?
I am trying to downcast java.sql.Connection to org.postgresql.jdbc4.Jdbc4Connection like this:
As you can see, Netbeans tells me localConn is ($Proxy6) ...
2
votes
2answers
43 views
Clojure JDBC: Failing to Find Postgres Driver
I am working on a web service that needs to talk to a database, so I am tooling up my basic libraries to give me access to postgres on my desktop.
Jun 5, 2013 1:27:46 PM ...
1
vote
1answer
21 views
Is it possible to supply parameters for table or column name in Prepared Statements or QueryRunner.update()?
DELETE from ? WHERE ? = ?
Is it possible to feed in parameters for all of these ?s? It seems that if I don't supply Strings, I get errors. For example, it only seems to work if I have something like:
...
1
vote
1answer
36 views
Reconnecting to a postgres database after postgres restart from Java
I'm using postgres 9.1, org.apache.commons.dbcp.BasicDataSource (for my connection pool) and Java 1.7. When I restart my postgres server, I get exceptions like org.postgresql.util.PSQLException: ...
0
votes
2answers
45 views
Postgresql: assign default timezone during table creation [duplicate]
I have the following definition of employees table
CREATE TABLE employees
(
id integer NOT NULL,
name text,
withouttz timestamp without time zone,
withtz timestamp with time zone,
...
0
votes
2answers
23 views
Postgres : Update user table using java in Postgres
In postgres the user is the reserve word for internal table, but i have the user table in my project database , when i try to insert or update the values in user table , it generate an error The ...
0
votes
1answer
83 views
org.postgresql.util.PSQLException: Connection refused
I wanted to test execution of function of an indexing from other host because this function not absolutely correctly fulfilled in hadoop to the program. But I had problems with connection to a ...
2
votes
1answer
84 views
No suitable driver found for jdbc:postgresql://192.168.1.8:5432/NexentaSearch
I wrote following the java program
import java.io.*;
import java.util.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import ...
0
votes
1answer
33 views
How to get postgresql to work with sequel and jruby
require 'sequel'
require 'jdbc/postgres'
DB = Sequel.connect("jdbc:postgresql://user:pass@domain/database")
DB.tables
Returns:
....(bla bla bla stack trace bla bla bla)....
...
2
votes
2answers
51 views
Postgres SQL in clause and setArray()
I am using Java 1.7 and JDBC 4 and Postgres. I am trying to use a PreparedStatement with an array to fill a SQL in clause. But, the SQL generated seems to have "{" and "}" in it. Here is the code:
...
1
vote
3answers
100 views
How to get array base type in postgres via jdbc
How to get base type / dimension of an array column in Postgres by Java?
I have a tables that contain arrays like int[][] and text[].
When I traverse the metadata from JDBC I can only get type as ...
-1
votes
1answer
50 views
Java app can't connect to local postgresql
I have a simple Java application that needs to connect to a PostgresSQL running on local host. The DB is up and running, and I can connect to it using the username and password using the psql command ...
2
votes
3answers
60 views
Issue inserting timestamp in Postgres table
I am trying to insert a value in the postgres table through Java . Column type is timestamp.
The code is like this :
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", ...
3
votes
1answer
112 views
How to pass BigInteger from java to Postgres?
I need to pass a BigInteger argument to SQL query. (on Postgres 9.2)
I have this code in my DAO:
public List<PersonInfo> select(String id) {
BigInteger bigIntId = new ...
0
votes
1answer
33 views
data comes in a string, inserting into postgresql with java, what's most efficient way to break up the data?
I am writing a program in Java that uses the JDBC driver with Postgresql. I am using an API which when called, returns data in a string like so:
id=-870229851 date = finished-20130501 ...
0
votes
1answer
112 views
PostgreSQL JDBC and Android - NullPointerException
I've got problem with PostgreSQL JDBC driver on Android.
I use postgresql-9.2-1002.jdbc4.jar JDBC driver.
Here's my code:
package xyz;
import java.sql.*;
public class BaseManager {
private String ...
-1
votes
1answer
55 views
Slow INSERTs and DELETEs with a default setup of PostgreSQL on Fedora 17 [closed]
(I'll try to give a short rundown of what I'm trying achieve and then describe the problem I'm facing)
THE GOAL
Ok, so I'm doing a basic benchmark on statement execution times in PostgreSQL (via ...
-1
votes
1answer
27 views
How to connect to other system db using jdbc type 4 driver
I have a JDBC program which connects to my local system postgresql DB.
Class.forName("org.postgresql.Driver");
Connection ...
0
votes
1answer
78 views
Retrieving serial id from batch inserted rows in postgresql
Here is the code that works:
Connection c = ds.getConnection();
c.setAutoCommit(false);
PreparedStatement stmt = c.prepareStatement("INSERT INTO items (name, description) ...
0
votes
2answers
72 views
Batch inserts in JDBC - how much slower will a single transaction be?
I just found out that JDBC's addBatch operation, if given "INSERT INTO mytable (id, name) VALUES (?, ?)" will create something like this:
BEGIN TRANSACTION
INSERT INTO mytable (id, name) VALUES (1, ...
-2
votes
1answer
77 views
Returning PostgreSQL queries as objects using JDBC [closed]
Currently I have a web services that connects to PostgreSQL using the JDBC. As of now the query returns as one long string as it was the only way I could get it to work. I would like to returned ...
0
votes
1answer
42 views
jdbc postgresql transaction error occurred
public class JDBC {
static Connection con;
static Statement stmt;
public static void main(String argv[]){
connect();
con.setAutoCommit(false);
// Statement s= conn.createStatement();
...
0
votes
1answer
62 views
JDBC ERROR: operator does not exist: date = integer
String checkAvailable_flight = String.format("SELECT Flightid, flightdate,"
+ " origin, destination FROM flight"
+ " WHERE Flightdate::Date = %s AND origin = %s"
...
1
vote
2answers
57 views
How to get large data with JDBC and PostgresSQL
I'm trying to fetch millions data from my table, and I'm using Java Play Framework 2.0 but there is some issue. When I set limit to my query it works well and if I ask for all the data it throws error ...
9
votes
2answers
102 views
JDBC what's the purpose of PreparedStatement#setNull
I did an experiment with a table having a VARCHAR column with null values trying to get the number of rows that have a specific column NULL. I used three forms:
form A
SELECT COUNT(*) FROM buyers ...
1
vote
2answers
197 views
why does executeUpdate return 1 even if no new row has been inserted?
here is my very simple table (Postgres):
CREATE TABLE IF NOT EXISTS PERFORMANCE.TEST
(
test text NOT NULL UNIQUE
);
if I try to insert a String using the command below FROM the database,everything ...
2
votes
1answer
586 views
No Suitable Driver found Postgres JDBC
I am receiving a "no suitable driver found" error when I test my web service on tomcat. I have the JDBC .jar in the lib folder as various tutorials says to do. Here is my code:
public class ...
0
votes
1answer
93 views
Troubleshooting in JDBC/Postgres Authentication Example
I am trying to teach myself Java Servlets and JSP, and I am having an issue with authenticating with Tomcat 7 and Postgres 9.1.
It seems to be error free (Tomcat is not throwing any JAVA errors in ...
0
votes
1answer
442 views
java.lang.ClassNotFoundException: org.postgresql.Driver but CLASSPATH set [closed]
I don't know why I get "java.lang.ClassNotFoundException: org.postgresql.Driver" since my CLASSPATH is set properly:
user1@machine:~$ echo $CLASSPATH
:/usr/share/java/postgresql.jar
I installed the ...
5
votes
3answers
483 views
JDBC vs Web Service for Android
Can someone answer on my dilemma which method to use for connecting Android device to mySQL or Postgresql?
I can do it in both ways without any errors and problems, with no noticeable difference but ...
4
votes
2answers
478 views
Call getNextException to see the cause : How to make Hibernate / JPA show the DB server message for an exception
I am using Postgresql, Hibernate and JPA. Whenever there is an exception in the database, I get something like this which is not very helpful as it does not show what really went wrong on the DB ...
1
vote
1answer
51 views
Postgresql commited data not visible
I noticed weird behavior in my application. It looks like commited data is not visible right after commit. Algorithm looks like this :
connection1 - insert into table row with id = 5
connection1 - ...
1
vote
1answer
522 views
org.postgresql.util.PSQLException: The connection attempt failed
I am connecting to postgres data base using java web services (apache axis) with JDBC connections to get the data.But suddenly in most of times i am getting an exception of ...
1
vote
1answer
99 views
Locking Tables with postgres in JDBC
Just a quick question about locking tables in a postgres database using JDBC. I have a table for which I want to add a new record to, however, To do this for the primary key, I use an increasing ...
0
votes
1answer
65 views
postgres hba.conf for jdbc
I'm trying to set up a JDBC connection to postgres from another program.
When I run the program, I get the following error:
[2013-03-24 ...
1
vote
1answer
129 views
Getting “cannot commit when autocommit is enabled” exception while working with CachedRowSet in JDBC
Im trying to implement simple GUI app for working with database records. It would contain view of records and possibility of editing them. Here is how my code looks like:
class MainPanel extends ...
0
votes
1answer
83 views
PostgreSQL “Protocol error. Session setup failed..” error
When running a BIRT report that queries a Postgresql database, I get the following error? How can I fix this?
Mar 18, 2013 4:19:37 PM org.eclipse.birt.data.engine.odaconsumer.ConnectionManager ...
0
votes
1answer
82 views
Java Servlets + JDBC + Postgres: How does it all interact?
I'm having trouble wrapping my head around how to use servlets properly
I've set up a postgres database, and downloaded a JDBC driver for it.
What I want to have is my webpages post to the servlet, ...
0
votes
1answer
82 views
Error: Column does not exist
I have been able to link PostgreSQL to java. I have been able to display all the records in the table, however I unable to perform delete operation.
Here is my code:
con = ...
1
vote
1answer
129 views
PostgreSQL Transaction fails: “there is no transaction in progress”
I've got a pretty long transaction I'm trying to execute using JDBC for PostgreSQL. In JDBC I can't use COMMIT and ROLLBACK, so I'm trying to implement my desired behaviour in Java code...
try {
...
0
votes
1answer
169 views
How do I create a function in PostgreSQL using evolutions in the Play framework?
With the Play Framework 2.1
I have the following SQL defined in my evolution:
CREATE OR REPLACE FUNCTION idx(myArray anyarray, myElement anyelement) RETURNS int AS $$
SELECT i FROM (
SELECT ...
1
vote
1answer
172 views
Postgres JDBC in scala unable to run two queries without restarting sbt
I am connecting to a postgres database with scala (2.9.2).
First time I make a SELECT (by running the code with 'run' in the sbt terminal in IntelliJ) it works well, but if I do 'run' again in the ...
0
votes
2answers
90 views
Connecting to other database postgresql JDBC
I am working on program in Java that can connect to PostgreSQL multiple databases. Problem occurs when I want to reconnect to other database on the same server. I am using JDBC postgresql driver and ...
0
votes
1answer
58 views
JDBC Datasources implemented by app servers
I am learning about datasources and I think I am beginning to understand it but this paragraph I don't get.
From what I know now the database vendors such as MySQL and PostgreSQL write their own ...
1
vote
2answers
104 views
Java Postgres connection limit exceeded
I am using Java 1.7 and Postgres via the Postgres JDBC drivers. The database connection will be used from a Web Service. In testing, I got the following error:
FATAL: connection limit exceeded for ...