Tag Info

Hot answers tagged

3

You should always ensure that the JDBC driver is at least as new as the back-end server. PostgreSQL's catalogs change between major versions, and other details like the bytea quoting method, string escaping features, etc have also changed over time. PgJDBC contains compatibility code to cope with this by querying the server version. If you don't use a ...


3

If the session is active and and on an idle event it's probably on the CPU and not waiting. You can run a query like the following to see for sure select nvl(s.username,s.program) username, s.sid sid, s.serial# serial, s.sql_hash_value sql_hash_value, substr(decode(w.wait_time, 0, w.event, 'ON CPU'),1,15) event , ...


2

There are several ways to rewrite the query and even more because both subqueries use the same base table. Not sure why the error is thrown and who is to blame, the JDBC drivers, the Foxpro or something else, so here are a few alternatives: (1) using one query for both searches: SELECT COALESCE(SUM(CASE WHEN t.btyp = 5 THEN t.netto ...


2

Yes it does support different transaction isolation levels per-connection. You can set the transaction isolation level (as well as the read-only and deferrable status for transactions) for a connection with SET SESSION CHARACTERISTICS: localhost:5432 postgres postgres # SHOW transaction_isolation; transaction_isolation ----------------------- read ...


2

Transaction isolation level is set up per transaction basis. Even one connection can have different isolation level on each transaction. Of course different connection can have different isolation level. Here's some testing : postgres=# begin; BEGIN postgres=# show transaction_isolation ; transaction_isolation ----------------------- read committed (1 ...


2

I'm getting a bit nervous. First, the upside: I've used the MariaDB JDBC driver in an "always on" service in production with a database connection pool and it is running fine for a couple of months now. The service only uses basic JDBC functions with simple queries (e.g. no joins, no blobs). I'm about to release another "always on" service that uses the ...


1

There are too many different topics in one question, and even after many updates not all is clear. I'll just pick the elephant in th room and ignore the rest: Query 1 -> Index Scan using r_pkey_index on relationships r (cost=0.43..57.53 rows=13 width=0) (actual rows=1 loops=1) Index Cond: ...


1

The answer below was taken from Sybase official technical documentation available at http://www.sybase.com/detail?id=1048699 Sybase Servers support the use of date and time data through the datetime and smalldatetime datatypes (and, with newer server, the date and time datatypes), as well as the getdate(), dateadd(), datediff(), and datepart() functions. ...


1

Both missing indexes and long-running queries are available in DMVs, with the caveat that DMVs can get refreshed on some events, such as service restart, certain sp_configure changes, etc. Here's a missing index query from Bart Duncan's blog post, Are you using SQL's Missing Index DMVs?: SELECT migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) ...


1

It is generally a terrible idea to construct SQL queries the way you currently do, as it opens the door to all sorts of SQL injection attacks. To do this properly, you'll have to use Prepared Statements instead. This will also resolve all sorts of escaping issues that you're evidently having at the moment. String[] port = new String[] {"3306"}; ...


1

Specify the columns and use SELECT: "insert into create_request (col1,col2,etc..col6) select ?,?,?,?,?, count(reqno) +1 from create_request" Just make sure the values and columns match.


1

I guess you have forgotten a ')'. try this: stmt=con.prepareStatement("insert into create_request values((select count(reqno) from create_request)+1),?,?,?,?,?");


1

The usual solution is to authenticate the user within the web app, then issue a SET ROLE or SET SESSION AUTHORIZATION to "become" the user on a JDBC session that's already authenticated with the database using a fixed username. In both cases the DISCARD ALL command that should be run by any connection pool when returning connections to the pool will ...



Only top voted, non community-wiki answers of a minimum length are eligible