jdbc

Hibernate database connection configuration

We have 2 different server environments using the same Hibernate configuration. One server has JNDI support for datasource, but the other does not. Currently the Hibernate configuration is configured to use JNDI, which is causing problem on the server that does not support JNDI. I have also tried to put the direct JDBC configuration tog...

How good is Oracle Universal Connection Pool (UCP)

Does anybody have experience with using Oracle UCP under real production load? Does it handle database reconnects well? Are there any multi-threading issues? Has anybody compared it with C3P0 or Apache DBCP? ...

Is there anyway to get the generated keys when using Spring JDBC batchUpdate?

I am using JDBC and want to batch insert, but I need the generated keys for the next round of inserts - is there anyway to accomplish this? MapSqlParameterSource[] batchArgs .... DAL.getNamedParameterTemplate().batchUpdate("INSERT INTO...", batchArgs); Thanks ...

oracle sql converter CharacterConverter12Byte problem in jdbc

I was working on a simple GUI script yesterday using jdbc in eclipse. When I went to run the program, I got a pop up screen asking me about character conversion in jdbc. I had no idea what this was and neither did my professor (no surprise there). Now every time I run a program, even one that doesn't use SQL I get the same error. 0 - ...

How to I retrieve an image from a URL and store it as a Blob in Java (google app engine)

I understand how to fetch a URL text page and loop over the results URL url = new URL(this.url); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { .... How would I do this to fetch an image and store it as a Blob? ...

Java & Tomcat: SQL JDBC/JNDI Exceptions

I am deploying a webapp from eclipse to tomcat. I am having an issue with my application and JNDI lookups. When the app tries to load the JNDI resource I am this stacktrace: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.Con...

How can I get Weblogic to connect to a RedBrick database?

I am trying to get Weblogic 9.2.3 to talk to a legacy RedBrick database and am having trouble. I have the redbrick.jar file from the software installation and have added to my APP_RUNTIME_CLASSPATH and my MANIFEST_CLASSPATH. This is my jConnect template line: <url>jdbc:rbw:protocol:${DB_LT_SERVER}:${DB_LT_PORT}/${DB_LT_NAME}</url> <dr...

SQL query in JSP file pulling variable from VXML file

Hi I'm trying to get an SQL query to work within a JSP file. The JSP file is pulled by a VXML file here is my JSP file code: <?xml version="1.0"?> <%@ page import="java.util.*" %> <%@ page import="java.sql.*" %> <% boolean success = true; // Always optimistic String info = ""; String schoolname = request.getParameter("schoolname"); ...

Want to extend from java.sql.ResultSet

Hi, I would like to create myRecordSet object that extends java.sql.ResultSet and to implement a method that returns UTC date from SQL statement. How can I extend from java.sql.ResultSet, I need an example. 10X ...

servlet connection to DB

Initially, after reading books on the subject, I firmly believed that the algorithm for working with a database from a servlet is as follows: create a connection -> connect to the database -> form a request -> send the request to the database -> get the query results -> process them -> close connection -> OK. Now, with a better unde...

How do I connect to a SQL Server 2008 database in Java with 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 like get some help on creating user login for my Java application and getting connection via JDBC. So far I tried to create a user login for my app and used following connection string, but I doesn't w...

java.sql.SQLException: SQL logic error or missing database, SQLite, JDBC

Hi All, I ahve created database connection with SQLite using JDBC in java. My sql statements execute properly. But sometimes I get the following error while i use conn.commit() java.sql.SQLException: SQL logic error or missing database Can anyone please help me how to avoid this type of problem. Can anyone give me better approa...

jdbc query - date ranges as parameters

Hi all, I'd like to write a single JDBC statement that can handle the equivalent of any number of NOT BETWEEN date1 AND date2 where clauses. By single query, i mean that the same SQL string will be used to create the JDBC statements and then have different parameters supplied. This is so that the underlying frameworks can efficiently...

Reusing a PreparedStatement multiple times

Hello, in the case of using PreparedStatement with a single common connection without any pool, can I recreate an instance for every dml/sql operation mantaining the power of prepared statements? I mean: for (int i=0; i<1000; i++) { PreparedStatement preparedStatement = connection.prepareStatement(sql); preparedStatement.setO...

Performing static SQL queries against DB2 without PureQuery

I'd like to use JPA over JDBC for a new application. I'm strictly using Named queries and basic CRUD methods of JPA Entity manager, which allows me (with the help of Hibernate, or any other JPA implementation) to extract all SQL native queries that will be performed on the database. With this list of static queries, I understand that I c...

Which jar to use for connecting to MS SQL server

Hi, Can some one please guide me to understand which jar file i need to include in my application to be able to set up a jdbc connection with ms sql server. thanks in advance. ...

db2 jdbc driver does not release table locks

situation: We have a web service running on tomcat accessing DB2 database on AS400, we are using JTOPEN drivers for JNDI connections handled by tomcat. For handling transactions and access to database we are using Spring. For each select system takes JDBC connection from JNDI (i.e. from connection pool), does selection, and in the end ...

java.lang.OutOfMemory error when fetching records from Database

Hi All, When I try to fetch around 20,000 records and return to ArrayList then it throws java heap space error. JdbcTemplate select = new JdbcTemplate(dataSource); String SQL_SELECT_XML_IRP_ADDRESS = " SELECT * FROM "+ SCHEMA +".XML_ADDRESS "+ " WHERE FILE_NAME = ? "; ...

Tomcat6 MySql JDBC Datasource configuration

I've always used Spring's dependency injection to get datasource objects and use them in my DAOs, but now, I have to write an app without that. With Spring I can write something like this: <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql...

what databases can be used with java?

I am doing an undergrad final project, and need to justify my choice of MySQL for the database element of my project. Truth is, it's the only one I can really use, and hence I went for it. What other database systems could I have used? Any advantages and disadvantages of these over MySQL? ...