jdbc

We're using JDBC+XMLRPC+Tomcat+MySQL to execute potentially large MySQL queries. What is a better way?

I'm working on a Java based project that has a client program which needs to connect to a MySQL database on a remote server. This was implemented is as follows: Use JDBC to write the SQL queries to be executed which are then hosted as a servlet using Apache Tomcat and made accessible via XML-RPC. The client code uses XML-RPC to remotely...

What is the equivalent of Oracle’s REF CURSOR in MySQL when using JDBC?

In Oracle I can declare a reference cursor... TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE; ...and use it to pass a cursor as the return value... FUNCTION end_spool RETURN t_spool AS v_spool t_spool; BEGIN COMMIT; OPEN v_spool FOR SELECT * FROM ...

programmatically checking for open connection in JDBC

How do I check for an open connection in jdbc for oracle database? Note: conn.isClosed() cannot be used for this. ...

Oracle ADF on JBoss: Wrapped Jdbc Connection problem.

I'm trying to run an application using Oracle ADF Business Components on a JBoss Server. I've maneged to deploy it, but when I try to load the page I get this: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection Is there a way solve this? Maybe configur...

JDBC - Oracle ArrayIndexOutOfBoundsException

I'm getting an Exception while trying to insert a row in oracle table. I'm using ojdbc5.jar for oracle 11 this is the sql i'm trying INSERT INTO rule_definitions(RULE_DEFINITION_SYS,rule_definition_type, rule_name,rule_text,rule_comment,rule_message,rule_condition,rule_active, rule_type,current_value,last_modified_by,last_modified_dttm...

How to deal with SQL column names that look like SQL keywords?

One of my columns is called "from". I can't change it, I didn't make it. Am I allowed to do something like "SELECT from FROM TableName"? Or is there a special syntax to avoid the SQL server being confused? I am using Microsoft SQL Server (express i think) and Java JDBC, if that matters... Thanks Nathan ...

How to use a JDBC driver from an arbitrary location

I need to test a JDBC connection to a database. The java code to do that should be as simple as: DriverManager.getConnection("jdbc connection URL", "username", "password"); The driver manager will lookup the appropriate the driver for the given connection URL. However I need to be able to load the JDBC driver (jar) at runtime. I.e I d...

JDBC: Can I share a connection in a multithreading app, and enjoy nice transactions?

It seems like the classical way to handle transactions with JDBC is to set auto-commit to false. This creates a new transaction, and each call to commit marks the beginning the next transactions. On multithreading app, I understand that it is common practice to open a new connection for each thread. I am writing a RMI based multi-client...

Spring Integration as embedded alternative to standalone ESB

Hi All. Does anybody has an experience with Spring Integration project as embedded ESB? I'm highly interesting in such use cases as: Reading files from directory on schedule basis Getting data from JDBC data source Modularity and possibility to start/stop/redeploy module on the fly (e.g. one module can scan directory on schedule basi...

Connecting to SQLServer using JDBC-ODBC Bridge

I'm writing an applicationt hat was prototyped on MySQL and is now connecting to an Oracle database. All I had to do to connect to the oracle database (having built up the table structure) was change the connection string. What is the format to connect to a SQL Server DB on another machine? I've read some tutorials which tell you to u...

Pattern for connecting to different databases using JDBC

I'm writing an application which has to be configurable to connect to Oracle, SQL Server and MySQL depending on client whim. Up till now I'd been planning on using the JDBC-ODBC bridge and just connecting to the databases using different connection strings. I'm told this is not very efficient. Is there a pattern or best practice for ...

How can I abort a running JDBC transaction?

Is there a way to prematurely abort a transaction? Say, I have sent a command to the database which runs five minutes and after four, I want to abort it. Does JDBC define a way to send a "stop whatever you are doing on this connection" signal to the DB? ...

simple jdbc wrapper

To implement data access code in our application we need some framework to wrap around jdbc (ORM is not our choice, because of scalability). The coolest framework I used to work with is Spring-Jdbc. However, the policy of my company is to avoid external dependencies, especially spring, J2EE, etc. So we are thinking about writing own han...

JDBC built in functions and prepared statements

Is there a way to execute a query(containing built in DB function) using PreparedStatement? Example: insert into foo (location) values (pointfromtext('12.56666 13.67777',4130)) Here pointfromtext is a built in function. ...

Accessing an SDF SQLServer Mobile file from Java

Here at work we want to access the data inside a .sdf file generated in a PDA with SQLServer Mobile Edition. We use the SqlJDBC4 packet for JDBC but can't get into the server. We know it's running because we can telnet into it, but from the Java code we just get once and again that we can't connect to server. We use this connection Stri...

How do I bind an ArrayList to a PreparedStatement in Oracle?

I was wondering if there was a way to bind an ArrayList (or any kind of List, for that matter) to a PreparedStatement which will eventually be used to access an Oracle database. I found: http://stackoverflow.com/questions/178479/alternatives-for-java-sql-preparedstatement-in-clause-issue And that seems similar to my issue, but this qu...

What is JDBC?

What is JDBC and where can I start learning about? I know it's a way to access databases with Java, but what problems does it solve? Is it an ORM (or does it try to be)? Does it abstract away differences between databases, at the syntax level? What does it do? and what does it not do? ...

JDBC simplified connection

Is there any library that would simplify the task of connecting to a server with JDBC? Something that can take a string like "mysql://username:password@host/db", similar to what PHP MDB2 do: http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2.html#methodparseDSN I'm not interested on any ORM or complex library such as Spring as I'm n...

How can I set the program name for sybase connections in jdbc?

I can do it in C, and I can do it in perl, but I don't see how to set the program name on sybase connections using jdbc? ...

How to limit number of rows returned from oracle at the jdbc data source level?

Hi, Is there a way to limit the rows returned at the oracle datasource level in a tomcat application? It seems maxRows is only available if you set it on the datasource in the java code. Putting maxRows="2" on the datasource doesnt apply. Is there any other way limit the rows returned? without a code change? Thanks, Dan ...