jdbc

What is required for building Java Windows Application to access Online MySQL Database

Hello Can anyone list the requirements (i.e. any books, tutorials, libraries etc) to build an application in Java, which could communicate with my MySQL Database which is running on web. I am running an online webstore built in PHP and MySQL. I would like to build a Java Application through which I can (CRUD) Products, Categories, Orde...

How to auto reconnect Oracle connection pool after connection interruption?

I'm running across a problem with Oracle connection pooling via OracleConnectionCacheImpl. When I connect to a connection pool on my database server (Oracle 10g) via the thin driver, everything works fine until after an unspecified time, the db connection gets dropped (possibly due to idle connections?) and I get an error message: C...

How can I make MS SQL Server available for connections?

I'm trying to connect to MS SQL Server (running on my machine) from a Java program. I'm getting the following long winded exception: Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection pr...

Is there a way to force a jdbc connection to use TCP?

In a normal SQL Server 2005 connection string, it's possible to specify the desired protocol in the following format: Data Source=tcp:myServerAddress; Initial Catalog=myDataBase; Integrated Security=SSPI; Is there a way to do something similar in a JDBC connection string to SQL Server? Edit: My JDBC Connection String looks like this...

java.sql.SQLException encountered when connecting to Oracle database

I get the following error when I try to run my project: java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169870080)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))) Any ideas? ...

Hibernate for stored procedure access

We have business restriction in accessing the database only through stored procedure calls. Caching is also not allowed. Is there value in using Hibernate framework where in you are not using the features like building object relationship based complex queries or caching? We are using considering using the lightweight jdbc option. ...

How Does One Interrupt Bean Methods on Jboss?

EJB 3.1 is a few months away and starting threads in Beans is discouraged since it may have nasty side effects. So what other options are there to interrupt bean methods on Jboss and Enterprise servers? JDBC's setQueryTimeout is not an option since some drivers do not enforce the value. ...

Migration of Java App Oracle 9i R2 database from 32 bit Windows to 64 bit Linux

We will be migrating our Oracle 9i R2 database from 32 bit Windows to 64 bit Linux (maintaining same Oracle version). Our Java (jdk 1.5) apps running on Linux 32 bit use the jdbc thin client ojdbc to connect to the db. While we don't as yet anticipate any issues for the Java app's connectivity and operation, we are working on a risk ass...

Using a variable instead of a parameter index with a JDBC prepared statement.

Hi. In many programming languages something like this is possible for prepared statements: PreparedStatement statement = connection.prepareStatement( "SELECT id FROM Company WHERE name LIKE ${name}"); statement.setString("name", "IBM"); But not with java.sql.PreparedStatement. In Java one has to use parameter indices: PreparedSt...

How do I in JDBC read a possibly null double value from resultSet?

I have a column in my database that is typed double and I want to read the value from it using a JDBC ResultSet, but it may be null. What is the best way of doing this? I can think of three options none of which seem very good. Option 1: Bad because exception handling verbose and smelly double d; try { d = rs.getDouble(1); // do ...

Can I set the JDBC isolation level from a Tomcat Context?

I have a web application running in Tomcat 6, and I've managed to configure it to use the built-in DBCP connection pooling, and all is working very well, however I suspect it is running in the wrong isolation level on the database. I'd like it to run in read uncommitted, but I think it's running in read committed and don't know how to se...

how do i get the current schema on DB2 if i have a JDBC conneciton?

If I have an instance of a JDBC DB2 connection, how do I get the current schema? Either a SQL statement would work, or just a JDBC method call. ...

Concurrent process inserting data in database

Consider following schema in postgres database. CREATE TABLE employee ( id_employee serial NOT NULL PrimarKey, tx_email_address text NOT NULL Unique, tx_passwd character varying(256) ) I have a java class which does following conn.setAutoComit(false); ResultSet rs = stmt.("select * from employee where tx_email_address = 'test1...

Problem with Date in Oracle using JDBC

I've the following scenario: Two computer: First computer running under Windows Vista, second computer running under Linux, connecting both to Oracle 10g. Oracle 10g is running in the second computer. I've have done one test program in Java that conecting to Oracle using ojdbc14.jar This test program is only connecting to database, re...

How to get values of bind parameters from Oracle JDBC PreparedStatement object

I want to implement logging of all executed statements with actual bind parameters when using Oracle JDBC. And I would prefer that I could create such logging method only passing PreparedStatement object as parameter. For example I have created PreparedStatement and have bound one parameter PreparedStatement ps = conn.prepareStatement(...

Weird DB2 database issue : Websphere Connection Pooling

I am running a query from my java based web app running in a Websphere container. This query however, being pretty simple, fails with a weird erorr as follows: [5/15/09 16:50:33:828 IST] 0000001e SystemErr R com.ibm.db2.jcc.b.zd: Invalid data conversion:Requested conversion would result in a loss of precision of 40000 [5/15/09 16:...

Dealing with intermittent Database Connectivity by Writing/Executing SQL Script From Scala/Java

I am developing an application that needs to store information to a database. I would like to use a Scala solution if possible. If the database connectivity fails for some reason, I would like to write the raw SQL statements that would have been executed to a .sql script file. The idea is that when/if the connectivity to the database is ...

Implement a Tomcat Realm with LDAP authentication and JDBC authorization

I'm working in a legacy environment where an LDAP server is used only for authentication and contains no roles, and authorization is done against a database which contains the user-role mapping, but no passwords. My plan is to implement a new Tomcat Realm by extending JNDIRealm, and overriding the role methods to call an encapsulated JD...

hadoop hive question

I'm trying to create tables pragmatically using JDBC. However, I can't really see the table I created from the hive shell. What's worse, when i access hive shell from different directories, i see different result of the database. Is any setting i need to configure? Thanks in advance. ...

What causes a JDBC Type 91 error

This seems like a simple question but if you Google it there isn't much help. I have a web app being hosted on BEA Weblogic 10.x with an Oracle 10g database back end. It works perfectly with one database, but when we make a clone of it and try to use a different WebLogic and Oracle instance we are getting this JDBC Type 91 error every t...