jdbc

How to connent to a remote mysql database with java?

I am trying to create a JSF application using the Eclipse IDE. I am using a remote mySQL server as my database. How do I connect to this remote database for creating tables and accessing them? ...

mixing basic DataSource with connection pooling DataSource: when to call close()?

I'm in the process of adding connection pooling to our java app. The app can work with different rdbmses, and both as a desktop app and as a headless webservice. The basic implementation works fine in desktop mode (rdbms = derby). When running as a webservice (rdbms = mysql), we see that connection pooling is needed to get good concurr...

Mac OS X SIGBUG in PostgreSQL JDBC Driver

I am trying to run an application which has worked fine for awhile, and now when I try and run it on Mac OS X, I get SIGBUS. I can't figure out why. This is also printed on the console: Invalid access of stack red zone 0x100401730 rip=0x115ae088e If I turn off PostgreSQL, it fails with connection failed. Current thread (0x000...

Java - MySQL - Temporary Tables

Hi all, I periodically receive data that I use to update my database with. The external structure differs from my internal structure so what I end up doing is running the import and then running alter table commands. I do this manually. After I format it to my liking, I export the data and then import it into my existing schema. My ...

No mapping for LONGVARCHAR in Hibernate 3.2

I am running Hibernate 3.2.0 with MySQL 5.1. After updating the group_concat_max_len in MySQL (because of a group_concat query that was exceeding the default value), I got the following exception when executing a SQLQuery with a group_concat clause: "No Dialect mapping for JDBC type: -1" -1 is the java.sql.Types value for LONGVARCHAR....

Oracle JDBC intermittent Connection Issue

I am experiencing a very strange problem This is a very simple use of JDBC connecting to an Oracle database OS: Ubuntu Java Version: 1.5.0_16-b02 1.6.0_17-b04 Database: Oracle 11g Release 11.1.0.6.0 When I make use of the jar file JODBC14.jar it connects to the database everytime When I make use of the jar file JODBC5.jar...

DB2 jdbc performance

Hi, doing profiling on an java application running websphere 7 and DB2 we can see that we spend most of our time in the com.ibm.ws.rsadapter.jdbc package handling connections to and from the database. How can we tune our jdbc performance? What other strategies exist when database performance is a bottleneck? Thanks ...

How do I get name of the target table and column of foreign key column with plain JDBC

I'm trying to make a piece of code using plain JDBC that fetches me the name of both target table and column of a foreign key of a specific column in specific table but going through the core interfaces I can't seem to find a direct way to do this. Is there a way to get such information about foreign keys through JDBC directly or do I h...

How to find whether a ResultSet is empty or not in Java?

How can I find that the ResultSet, that I have got by querying a database, is empty or not? ...

How to implement a database GUI in java

I want to write a java program that acts as a user interface to a mysql database,the program should do the following: 1.connect to the database,show available tables in the database 2.display table data 3.modify table data (insert,edit,delete,sort) rows I've tried to use JDBC only,but couldn't figure out a way to put the table data i...

Fast Oracle Select [Huge Data]

I have a project whereby I'm reading huge volumes of data from an Oracle database from Java. I have the feeling that the application we are writing is going to process the data far faster than it will be given to us using a single threaded SELECT query and so I've been trying to research faster ways of obtaining the data. Does anyone h...

Error in getting Date input form user and storing in database using JSF

I am developing a web application based on JSF technology. I use Eclipse as the IDE and using Apache Derby as a database. When getting user input, I have one of the fields as a date field, i.e, Date of Birth. But when I update the database table, I get error report. Date Of Birth: <h:inputText value="#{employeeBean.dob}"> <f:convert...

Retrieve multiple images from MySQL

How to retrieve multiple blob images from MySQL database in JSP page? ...

Unable to connect to MS Access database through JDBC on Win 7 64-bit

Hello. I've been trying to connect to a MS Access 2007 database through JDBC. My JDK is JDK 1.6u18 64-bit and OS is Windows 7 64-bit. But problem is I am unable to create a DSN using Windows\system32\odbcad32.exe because it doesn't show ODBC drivers for MS Access at all, it's only showing drivers for MS SQL Server. When tried to click ...

Guice, JDBC and managing database connections

I'm looking to create a sample project while learning Guice which uses JDBC to read/write to a SQL database. However, after years of using Spring and letting it abstract away connection handling and transactions I'm struggling to work it our conceptually. I'd like to have a service which starts and stops a transaction and calls numerou...

MySQL jdbc driver and Eclipse: ClassNotFoundexception com.mysql.jdbc.Driver

There is a VERY similar question to mine but in my case I don't have any duplicate jars in my build path, so the solution does not work for me. I've searched google for a couple of hours now, but none of the solutions I've found there actually resolve my issue. I'm creating a web site with some database connectivity for a homework. I'...

Default Schema in Oracle Connection URL

I'd like to set default database schema in Oracle Connection URL jdbc:oracle:thin:@<server>:<port1521>:<sid> My sample SQL statement: select monkey_name from animals.monkey I need to query database without schema prefix anymals. i.e. when I run this statement select monkey_name from monkey it will uses animals schema by default....

Is there any way to prepare a sql statement in Java without using a Connection object?

I'm pretty new to JDBC, so this is probably a very straightforward question. I have to run several SQL statements, so I'm trying to write a generic "runSQLResultSet" method that takes a String sql statement and returns a ResultSet. I want it to take care of opening the database connection, executing the statement, storing the ResultSet ...

What's the difference between Tomcat JNDI based and Spring/Hibernate DS based connection pooling

I have been looking into connection pool options and it is somewhat unclear to me what the differences in Tomcat JNDI connection pool approach is, compared to the Spring/Hibernate solution to the same. Whilst it's possible to achieve the pooling using either 1, 2, the specific application we have would lend itself better to us using To...

Cannot select Unicode data from PostgreSQL with LIKE

I have a PostgreSQL database with some Unicode values. For example "vaishali" in Marathi. I want to fire a query SELECT * FROM table WHERE name LIKE vaishali (I type "vaishali" in Marathi, so I first convert to unicode in my prog). But it matches nothing. Why? ...