RMI & JDBC ResultSet
I am developing a project
The basic archeiecture is like this:
a reporting tool
a virtualDB
a real DB
the reporting tool request for data from virtualDB, the virtualDB actually fetch the result for it.
The virtualDB is a remote object using RMI which can be called in the reporting tool(stub)
the virtualDB is connecting to the real DB through JDBC-ODBC driver.
Now comes the problem, when the virtualDB has the ResultSet which is return by JDBC-ODBC. I cannot pass the ResultSet from remote site to my reporting tool, at run time, it will throw NotSerializable Exception, I guess this is because the JDBC-ODBC ResultSet does not implement that interface.
So is there any way I can solve this problem to allow the reporting tool(client) receive the ResultSet that VirtualDB has got???
Thanks in advance, any comment would be a great help for me!!!
I can think of two ways:
I can unpack the resultset at the remote site, and repack them into a new ResultSet which implements the Serializble interface. However, in the case I still dont know how to let me client receive the new ResultSet, quite lost...
Another way, write all datas into XML, and pass the XML from remote site to reporting tool. It can work, but I want it to be efficient. This way is not efficient enough for me, I guess, and I do not want the overhead of creating XML.
Similar Messages
-
Problem with get ResultSet from rmi jdbc method. Help.
Hi,
I am writing a rmi jdbc server. I got all the rmi methods working, but I am trying to get the data from the ResultSet. After the query, I set the fields in the serialiable class and return it back to the client. However, I noticed that it does called init(), but not the setField calls. When it calls the first setField in the serialiable class, the method is never called. Can anyone give some guidance.
Thanks,
Rage
This method is called from the client to set all the data in the Serialiable class and return it to the client.
public Collection fetchResultSet() throws RemoteException
System.out.println("Entering fetchResultSet");
Collection resultSetColl = new ArrayList();
QueryResultSet recordset;
try
int rowCount = 0;
ResultSetMetaData rsmd = rs.getMetaData(); // Get data dictionary information
int columnCount = rsmd.getColumnCount();
System.out.println("got column count");
System.out.println("" + rowCount + " rows, " +
columnCount + " columns");
if (rs == null) System.out.println("rs is null");
if (rs.next())
System.out.println("Parsing RS");
recordset = new QueryResultSet();
for (int i = 1; i <= columnCount; i++)
System.out.println("set Fields = "+ rs.getString(i) );
//recordset.setField(i,rs.getString(i));
String strValue = rs.getString(i);
recordset.setField(i,strValue);
System.out.println("Added recordset" );
resultSetColl.add(recordset);
catch (Exception e)
System.out.println(e.getMessage());
closeResultSet();
return resultSetColl;
Here is my Serializable Class
import java.io.*;
import java.sql.*;
public class QueryResultSet implements Serializable
private String Field1;
private String Field2;
private String Field3;
private String Field4;
private String Field5;
private String Field6;
private String Field7;
private String Field8;
private String Field9;
private String Field10;
private String Field11;
private String Field12;
private String Field13;
/** Creates a new instance of QueryResultSet */
public QueryResultSet()
init();
public void init()
System.out.println("QueryResultSet INIT()");
Field1 = "";
Field2 = "";
Field3 = "";
Field4 = "";
Field5 = "";
Field6 = "";
Field7 = "";
Field8 = "";
Field9 = "";
Field10 = "";
Field11 = "";
Field12 = "";
Field13 = "";
public String getField(int nField)
System.out.println("QueryResultSet getField()");
System.out.println("getField 1 = " + Field1);
if (nField ==1)
return Field1;
else if (nField == 2)
return Field2;
else if (nField == 3)
return Field3;
else if (nField == 4)
return Field4;
else if (nField == 5)
return Field5;
else if (nField == 6)
return Field6;
else if (nField == 7)
return Field7;
else if (nField == 8)
return Field8;
else if (nField == 9)
return Field9;
else if (nField == 10)
return Field10;
else if (nField == 11)
return Field11;
else if (nField == 12)
return Field12;
else if (nField == 13)
return Field13;
return null;
public void setField(int nField, String strField)
System.out.println("QueryResultSet setField()");
System.out.println("field #" String.valueOf(nField) " = " + strField);
if (nField == 1)
Field1 = strField;
else if (nField == 2)
Field2 = strField;
else if (nField == 3)
Field3 = strField;
else if (nField == 4)
Field4 = strField;
else if (nField == 5)
Field5 = strField;
else if (nField == 6)
Field6 = strField;
else if (nField == 7)
Field7 = strField;
else if (nField == 8)
Field8 = strField;
else if (nField == 9)
Field9 = strField;
else if (nField == 10)
Field10 = strField;
else if (nField == 11)
Field11 = strField;
else if (nField == 12)
Field12 = strField;
else if (nField == 13)
Field13 = strField;
}You need to give us some information more. Like what rdbms are you using, what driver and how are you trying to access the resultset from java.
I do not know what are you using. One thing I can tell you for sure is that the execute method returns a boolean. If you need a resultset you should run executeQuery.
Kiros -
BUG JSF h:dataTable with JDBC ResultSet - only last column is updated
I tried to create updatable h:dataTable tag with three h:inputText columns with JDBC ResultSet as data source. But what ever I did I have seceded to update only the last column in h:dataTable tag.
My JSF page is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1250"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1250"/>
<title>Stevan</title>
</head>
<body><h:form>
<p>
<h:messages/>
</p>
<p>
<h:dataTable value="#{tabela.people}" var = "record">
<h:column>
<f:facet name="header">
<h:outputText value="PIN"/>
</f:facet>
<h:inputText value="#{record.PIN}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Surname"/>
</f:facet>
<h:inputText value="#{record.SURNAME}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:inputText value="#{record.NAME}"/>
</h:column>
</h:dataTable>
</p>
<h:commandButton value="Submit"/>
</h:form></body>
</html>
</f:view>
My java been is:
package com.steva;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class tabela {
private Connection conn;
private ResultSet resultSet;
public tabela() throws SQLException, ClassNotFoundException {
Statement stmt;
Class.forName("oracle.jdbc.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
resultSet = stmt.executeQuery("SELECT PIN, SURNAME, NAME FROM PERSON");
public ResultSet getPeople() {
return resultSet;
I have instaled “Oracle Database 10g Express Edition Release 10.2.0.1.0” – product on my PC localy. I have enabled HR schema and I have instaled and pupulated with sample data folloving table:
CREATE TABLE "PERSON"
( "PIN" VARCHAR2(20) NOT NULL ENABLE,
"SURNAME" VARCHAR2(30),
"NAME" VARCHAR2(30),
CONSTRAINT "PERSON_PK" PRIMARY KEY ("PIN") ENABLE
I have:
Windows XP SP2
Oracle JDeveloper Studio Edition Version 10.1.3.1.0.3894
I am not shure why this works in that way, but I think that this is a BUG
Thanks in advance.Hi,
I am sorry because of formatting but while I am entering text looks fine but in preview it is all scrambled. I was looking on the Web for similar problems and I did not find anything similar. Its very simple sample and I could not believe that the problem is in SUN JSF library. I was thinking that problem is in some ResultSet parameter or in some specific Oracle implementation of JDBC thin driver. I did not try this sample on any other platform, database or programming tool. I am new in Java and JSF and I have some experience only with JDeveloper.
Java been(session scope):
package com.steva;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class tabela {
private Connection conn;
private ResultSet resultSet;
public tabela() throws SQLException, ClassNotFoundException {
Statement stmt;
Class.forName("oracle.jdbc.OracleDriver");
conn = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");
stmt = conn.createStatement
(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
resultSet = stmt.executeQuery("SELECT PIN, SURNAME, NAME FROM PERSON");
public ResultSet getZaposleni() {
return resultSet;
JSF Page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1250"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1250"/>
<title>Stevan</title>
</head>
<body><h:form>
<p>
<h:messages/>
</p>
<p>
<h:dataTable value="#{tabela.zaposleni}" var = "record">
<h:column>
<f:facet name="header">
<h:outputText value="PIN"/>
</f:facet>
<h:inputText value="#{record.PIN}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Surname"/>
</f:facet>
<h:inputText value="#{record.SURNAME}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:inputText value="#{record.NAME}"/>
</h:column>
</h:dataTable>
</p>
<h:commandButton value="Submit"/>
</h:form></body>
</html>
</f:view> -
How to implement paging on SQLSERVER JDBC ResultSet?
Dear experts,
Please show me somre tips to implement paging on an JDBC resultset?
Thanks in advanced.JSP pagination ? how many records per page ?
-
Using objects rather than jdbc resultset to fill reports
Hi buddies!
I�m developing a small sample of application that generates reports using values retrieved from objects.
The idea is simple, I have an arraylist of objects and want to fill my report which these objects atributes.
Jasper Project API has a class called JasperFillManager which is used to fill reports and takes 3 arguments, for instance:
JasperFillManager.fillReport(JasperReport reporttofill,HashMap parameters, JRDataSource dataSource)
I�ve created a custom JRDataSource named fonteDadosJasperCustomizada
This class implements an arraylist of objects and two methods from the interface JRDataSource which are responsible for giving the values to fill the report. This class doesn�t take values from a resultset! ;)
but for some reason nothing appears to me after executing the application... everything is alright I think the might be a mistake in the interface methods, the report also is alright.
All sugestions are welcome
thanks
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;
public class relatorioteste1{
public relatorioteste1(){
try{
fonteDadosJasperCustomizada fonte = new fonteDadosJasperCustomizada();
JasperDesign relatoriocarregado = JRXmlLoader.load("c:/relatorioteste1.jrxml");
JasperReport relatoriocompilado = JasperCompileManager.compileReport(relatoriocarregado);
/*the parameter fonte being passed to fillManager is a custom JRDataSource.
* The default JRResultSetDataSource only receives a JDBC ResultSet and
* extracts Data from it to fill the Report, such Object is implements
* the JRDataSource interface which defines methods that are used by
* fillManager to obtain data from the ResultSet.
* My intention is to create my own JRDataSource class which should
* be able to retrieve data from objects instead of ResultSet
* See class fonteDadosJasperCustomizada for details
JasperPrint relatorioimpresso = JasperFillManager.fillReport(relatoriocompilado,new HashMap(),fonte);
JasperViewer.viewReport(relatorioimpresso);
catch(Exception e){
javax.swing.JOptionPane.showMessageDialog(null, e.getMessage());
public static void main(String args[]){
new relatorioteste1();
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
import java.util.ArrayList;
public class fonteDadosJasperCustomizada implements JRDataSource {
public Object getFieldValue(JRField arg0) throws JRException{
/*The following line returns the next object(aluno) from
* the arraylist collection
Aluno aluno = (Aluno) dados.listIterator().next();
/*This block verifies which column value(field) is being
* requested by the jasperFillManager.fillReport and returns
* an object value corresponding to the field
if ("codigo".equals(arg0.getName()))
return Integer.valueOf(aluno.getCodigo());
else if ("nome".equals(arg0.getName()))
return aluno.getNome();
else
return Integer.valueOf(aluno.getIdade());
public boolean next() throws JRException{
/*this decision verifies if there�re more elements in
* the arraylist collection if so returns true... else returns
* false
if (dados.listIterator().hasNext())
return true;
else
return false;
public fonteDadosJasperCustomizada(){
/*The constructor of my custom JRResulSetDataSource should receive
* a JDBC ResultSet in place of an Arraylist of Objects
* The atributes of each object is mapped to a field in
* jasperreports template
dados = new ArrayList();
dados.add(new Aluno(1,"charlles cuba",25));
dados.add(new Aluno(2,"Maicom napolle",25));
dados.add(new Aluno(3,"Gustavo castro",21));
public static void main(String args[]){
new fonteDadosJasperCustomizada();
ArrayList dados;
}Buddies thansk everyone
I�m really grateful... the previous post in here was very useful to me. I
was wrong about ArrayList.listIterator.
I finnaly generated a report from an arraylist of objects.
Here�s the code... I made some changes the first one was wrong
HERE IS MY MAIN CLASS RESPONSIBLE FOR GENERATING THE REPORT
public class relatorioteste1{
public relatorioteste1(){
try{
fonteDadosJasperCustomizada fonte = new fonteDadosJasperCustomizada();
JasperDesign relatoriocarregado = JRXmlLoader.load("c:/relatorioteste1.jrxml");
JasperReport relatoriocompilado = JasperCompileManager.compileReport(relatoriocarregado);
JasperPrint relatorioimpresso = JasperFillManager.fillReport(relatoriocompilado,new HashMap(),fonte);
JasperViewer.viewReport(relatorioimpresso);
catch(Exception e){
javax.swing.JOptionPane.showMessageDialog(null, e.getMessage());
public static void main(String args[]){
new relatorioteste1();
HERE IS MY CUSTOM JRDATASOURCE
public class fonteDadosJasperCustomizada implements JRDataSource {
public Object getFieldValue(JRField arg0) throws JRException{
if ("codigo".equals(arg0.getName()))
return Integer.valueOf(aluno.getCodigo());
else if ("nome".equals(arg0.getName()))
return aluno.getNome();
else
return Integer.valueOf(aluno.getIdade());
public boolean next() throws JRException{
if (iterator.hasNext()){
aluno = (Aluno) iterator.next();
return true;
else
return false;
public fonteDadosJasperCustomizada(){
dados = new ArrayList();
dados.add(new Aluno(1,"charlles cuba",25));
dados.add(new Aluno(2,"Maicom napolle",25));
dados.add(new Aluno(3,"Gustavo castro",21));
iterator = dados.listIterator();
public static void main(String args[]){
new fonteDadosJasperCustomizada();
ArrayList dados;
Iterator iterator;
Aluno aluno;
} -
Pass a jdbc resultset in to a Stored Procedure
Any answer to the following question would be highly appreciated:
How can we pass a jdbc resultset in to a Stored Procedure?
Thanks.You could use Oracle's ANYDATASET type or declare schema TYPEs to support passing the data in a known structure. See "Working with Oracle Collections" in the "JDBC Developer's Guide and Reference" on technet.
-
Casting a JDBC resultSet to VO RowSet?
Is it possible to somehow transform a plain vanilla jdbc ResultSet to a VO RowSet? (Of course without iterating!) Either by passing the entire object (with all rows intact) or by casting?
Thanks
-Nat
PS. Rob, you know why I want to do this, right<g>?We use JDBC to access the database internally. BC4J automates a best-practice use of JDBC PreparedStatements and ResultSet's for you without your having to worry about remembering the low-level details.
Our generic JDBC-interaction code worries about consistently applying the best-practice and highest-performance JDBC techniques for you. When we discover a further improvement and implement it, all of your view objects immediately benefit in the next release.
We had a team in Oracle Applications who claimed they could read large amounts of data faster with hand-coded JDBC than with BC4J. They weren't using BC4J in the optimal way and I illustrated by modifying their benchmark how to make BC4J be faster than hand-coded raw use of JDBC.
Their benchmark wasn't really comparing apples to apples, so I made sure they were comparing roughly equivalent amounts of work before we could conclude what was better. -
NPE in com.mysql.jdbc.ResultSet
hi guys,
config: Connector/J 3.1.11 - mysql 5.0 - java 1.5
is anybody has ever seen this exception??
Caused by: java.lang.NullPointerException
at com.mysql.jdbc.ResultSet.buildIndexMapping(ResultSet.java:597)
at com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:905)
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4977)we've got this exception and we can't understand why!!
the ResultSet class fragment...
for (int i = numFields - 1; i >= 0; i--) {
Integer index = new Integer(i);
String columnName = this.fields.getName();
String fullColumnName = this.fields[i].getFullName();
if (columnName != null) {
this.columnNameToIndex.put(columnName, index);
this.columnNameToIndex.put(columnName.toUpperCase(), index);
this.columnNameToIndex.put(columnName.toLowerCase(), index); // <--- this line caused the exception
if (fullColumnName != null) {
this.fullColumnNameToIndex.put(fullColumnName, index);
this.fullColumnNameToIndex.put(fullColumnName.toUpperCase(),
index);
this.fullColumnNameToIndex.put(fullColumnName.toLowerCase(),
index);
i don't understand why it is possible. columnNameToIndex is protected and only accessed by the ResultSet class. it is in the buildIndexMapping() method and this method is called only in a synchronized method so ???
any ideas??
sup@renoCaused by: java.lang.NullPointerException
at com.mysql.jdbc.ResultSet.buildIndexMapping(ResultSet.java:597)It's an open-source jdbc driver, which maintainted by Mysql. You can try to fix it, and recompile your Connector/J, or report simply Mysql that issue. -
Creating XML from JDBC resultset
Can anyone give me a pointer as the best way to create XML from a JDBC resultset. I have told that XSU cannot be used as it is vendor specific and ties us to Oracle (yawn, yawn).
Any ideas welcomed.import javax.xml.parsers.*;
import org.w3.dom.*;
import javax.xml.dom.*;
import javax.xml.dom.source.*;
import javax.xml.dom.stream.*;
import java.sql.*;
public class CreateXML{
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db=dbf.newDocumentBuilder();
Document doc=db.newDocument();
Element root=doc.createElement("root_element");
// coonect to database
//get resultset metadata rsmd
while(rs.next()){
Element row=doc.createElement("row");
for(int j=1;j<=rsmd.getColumnCount();j++){
String colName=rsmd.getCoulmName(j);
String colValue=rs.getString(j);
Element e=doc.createElement(colName);
e.appendChild(doc.createTextNode(colValue));
row.appendChild(e);
root.appendChild(row);
doc.appendChild(root);
//You can now use XSLT to generate xml file thus:
TransformerFactory tmf=TransformerFactory.newInstance();
Transformer tf=tmf.newTransformer();
DOMSource source=new DOMSource(doc);
StreamResult result=new StreamResult("name of file for output");
tf.transform(source,result);
// of course exceptions will have to be caught in this code. -
Problem with clloudscape rmi jdbc driver
I am using Cloudscape rmi jdbc driver, where Cloudscape runs as
a separate server. I am using WL6.1 running on Red Hat Linux
7.1. I defined a Cloudscape connection pool and data source. I
have to start Cloudscape before WebLogic or I get the following
exception:
<Feb 18, 2002 11:39:42 PM EST> <Error> <JDBC> <Cannot startup
connection pool "EStoreConnectionPool"
weblogic.common.ResourceException:
Could not create pool connection. The DBMS driver exception was:
java.sql.SQLException: Connection refused to host: localhost;
nested exception is:
java.net.ConnectException: Connection refused
at RmiJdbc.RJDriver.connect(RJDriver.java:149)
at java.sql.DriverManager.getConnection
(DriverManager.java:512)
etc.
No surprises here: However if I start Cloudscape first and
WebLogic second, I get the following message in Weblogic:
Starting WebLogic Server ....
<Feb 19, 2002 12:58:21 AM EST> <Notice> <Management>
<Loading configuration file ./config/mydomain/config.xml ...>
<Feb 19, 2002 12:58:43 AM EST> <Notice> <WebLogicServer>
<Starting WebLogic Admin Server "myserver" for domain "mydomain">
<Feb 19, 2002 12:59:00 AM EST> <Notice> <Management>
<Starting discovery of Managed Server... This feature is on by
default, you may turn this off by passing
-Dweblogic.management.discover=false>
This copy of Cloudscape is licensed for DEVELOPMENT ONLY.
It is a violation of the license agreement to deploy this version
in a production application.
For information about licensing Cloudscape for application
deployment, contact [email protected] or call
888/595-2821 ext. 7664.
Additional licensing information can be found at
http://www.cloudscape.com/licensing.
<Feb 19, 2002 12:59:31 AM EST> <Notice> <Management>
<Application Poller started for development server.>
<Feb 19, 2002 12:59:31 AM EST> <Notice> <WebLogicServer>
<ListenThread listening on port 7001>
<Feb 19, 2002 12:59:31 AM EST> <Notice> <WebLogicServer>
<SSLListenThread listening on port 7002>
<Feb 19, 2002 12:59:32 AM EST> <Notice> <WebLogicServer>
<Started WebLogic Admin Server "myserver" for domain "mydomain"
running in Development Mode>
The console running cloudscape then contains this message:
This copy of Cloudscape is licensed for DEVELOPMENT ONLY.
It is a violation of the license agreement to deploy this version
in a production application.
For information about licensing Cloudscape for application
deployment, contact [email protected] or call
888/595-2821 ext. 7664.
Additional licensing information can be found at
http://www.cloudscape.com/licensing.
Tue Feb 19 00:56:43 EST 2002: [RmiJdbc]
COM.cloudscape.core.JDBCDriver registered in DriverManager
Tue Feb 19 00:56:44 EST 2002: [RmiJdbc] Binding RmiJdbcServer...
Tue Feb 19 00:56:44 EST 2002: [RmiJdbc] No installation of RMI
Security Manager...
Tue Feb 19 00:56:46 EST 2002: [RmiJdbc] RmiJdbcServer bound in
rmi registry
WARNING: Cloudscape (instance
c013800d-00ec-1cf6-94ca-007f00000100) is
attempting to boot the database
/app/cloudscape_3.6/database/acme/estore even
though cloudscape (instance c013800d-00ec-1cca-ed1d-007f00000100)
may still be active. Only one instance of cloudscape should boot
a database at a time. Severe and non-recoverable corruption can
result and may have already occurred.
Well, it looks like I'm damned if I do and damned if I don't.
Any suggestions?Actually, it happened because Cloudscape was not properly shut down. Thanks for
responding. I was having some troble with the stopCS script, but its OK now.
"Laurent Goldsztejn" <[email protected]> wrote:
>
Hi Douglass,
The evaluation version of Cloudscape is limited to one concurrent user
per session,
so only one instance of cloudscape can be running at a time. The problem
reported
here can occur if you try to run more than once instance of any product
that
uses Cloudscape -- including WLS or Cloudview. This evaluation version
of Cloudscape
is intended for test purposes only.
This error can also occur on Solaris if you stop the server using ctrl-C
or ctrl-D,
which causes a database lock to remain in place after the server has
stopped.
You can get rid of it by deleting $BEA_HOME/wlserver6.1/samples/eval/cloudscape/data/demo/db.lck
The safest way to stop the server is to use the Admin console or the
SHUTDOWN
command from the command line.
Laurent Goldsztejn
Developer Relations Engineer
BEA Support -
Hello everyone:
I'm using JDBC to connect to SQL Server, normally after executeQuery();, it should return me a opened BaseResultSet in order that i can read datas by stream(next(), getColumn(),etc...) but sometimes it returns a BaseResultSet closed. (I detected it during the debugging by checking the value of the property "closed" in the object returned ), in this case it refused all the following operations with the exceptions "ResultSet has been closed".
Does that sound normal? How to solve it ?
Thanks a lot!!!!Did you close the underlying Statement or Connection objects? It might come back empty (e.g., next() returns false), but it should not come back already closed.
- Saish -
RMI + JDBC + file transference - URGENT!!
Ol� pessoal tenho uma d�vida a qual tenho que utilizar comandos JDBC de forma remota e tenho que fazer a transfer�ncia de arquivos, algu�m tem id�ia de como fazer isso?
Entre RMI e sockets achei sockets mais complicado, o problema que RMI n�o � nada simples, algu�m poderia me ajudar?
Hello people, I have a doubt which I have that to use commands JDBC of remote form and have that to make the transference of archives, somebody has idea of as to make this?
Between RMI and sockets a think that sockets more complicated, and the problem is RMI is not simple, somebody could help me?wanderley.drumond wrote:
Ol� pessoal tenho uma d�vida a qual tenho que utilizar comandos JDBC de forma remota e tenho que fazer a transfer�ncia de arquivos, algu�m tem id�ia de como fazer isso?
Entre RMI e sockets achei sockets mais complicado, o problema que RMI n�o � nada simples, algu�m poderia me ajudar?
Hello people, I have a doubt which I have that to use commands JDBC of remote form and have that to make the transference of archives, somebody has idea of as to make this?
Between RMI and sockets a think that sockets more complicated, and the problem is RMI is not simple, somebody could help me?Please avoid using the highly irritating word "URGENT!!" in your subject line in future.
The first question I would ask is where are these files now? Are they in a database? Or are you trying to put them into a database.
The second question is what is the client? Remote? Web? Internet?
If the files are going in/out of the database directly then the simplest solution is just straight JDBC. If there is some complication (like the client is web-based) then maybe something else is required.
I don't see RMI being a solution here. Possibly but I doubt it (on the basis that if the scenario means that the RMI solution was feasible then I would think the direct JDBC solution would also be feasible) . Maybe FTP.
I think you may need to get some English help or try on a Spanish language forum though. We'll see how it goes but I do find your question difficult to understand, I only get a general drift of what you are saying but as demonstrated by my questions above I don't really get the specifics. -
JDBC ResultSet and direct D/B access are returning different no. of rows
I am testing a JDBC application, which is using a DataSource definition configured in Visual Admin under JDBC Connector node.
This program gets the JDBC Connection via lookup thro' JNDIContext.
What is interesting is I am getting different no. of rows from ResultSet compared to direct execution in the Query Analyser.
SELECT DISTINCT IC.ship_to_num, IC.policy_type, IC.exp_date, IC.insurance_cert_id
FROM site_user SU
INNER JOIN user_bill_to UB ON SU.user_id = UB.user_id
INNER JOIN insurance_cert IC ON UB.ship_to_num = IC.ship_to_num
WHERE (DATEDIFF(dd, GETDATE(), IC.exp_date) <= 14)
AND (DATEDIFF(dd, GETDATE(), IC.exp_date) > 5)
AND IC.breaking_14_day_alert_date IS NULL
AND (SU.customer_id = 'dealer') AND (SU.is_owner = '1')
(3 in Qu.Analyser Vs. 0 from JDBC)
Or
SELECT * FROM message_target
(405 in Qu.Analyser Vs. 380 from JDBC)
I compared the JDBC program code results Vs. "DB Initialisation" tab result in Visual Admin tool Vs. Direct 'Query Analyser' of SQL Server results.
The programmatic JDBC results are equal to "DB Initialisation" tab results !
What is wrong here ?
Any help is greately appreciated.
Thanks,
Prasad NutalapatiHi Prasad,
I have never experienced this problem, but after taking a quick look at the javadoc for some JDBC classes, I found something that may help.
Try looking into the <i>setMaxRows</i> method on the <i>Statement</i> class. The URL below will take you to the complete javadoc for this class, however, here is the part that I believe relates to your problem:
"...If the limit is exceeded, the excess rows are silently dropped."
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html
If you are not setting this limit explicitly in your code, the JDBC driver implementation may be using some default value.
Setting this value to zero means that there is no limit, so you may want to try that.
Kind regards,
Mike -
JDBC Resultset Problem with ORACLE 10.1.0.2
Hello
I have a problem with Petstore GenericCatalogDAO. java. The problem is the behaviour of the resultset object when retrieving data from the database.Below are two synareos one that
works (when) hard coded and one that does not work when parameter values passed into the the result set.
1. The code the WORKS.
statement = connection.prepareStatement("select name from employee where a.name ='SMITH' order by name"
,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
resultSet = statement.executeQuery();
resultSet.absolute(1);
String s = resultSet.getString(1);
The code that gives me a 'exhausted resultset' error which I think means no results
String[] parameterValues = new String[] { "SMITH" };
statement = connection.prepareStatement("select name from employee where a.name =? order by name ",
ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
for (int i = 0; i < parameterValues.length; i++) {
statement.setString(i + 1, parameterValues);
resultSet = statement.executeQuery();
resultSet.absolute(1);
String s = resultSet.getString(1);
There is obviously a problem using these named parametevalues with these preparedstatement resultset, Does anybody know anything about this and a fix for it????
Cheers. RogerRoger,
It's probably a mistake you made when posting your code, but your query string is incorrect it should be either:
select name from employee where name = 'SMITH' order by nameor
select a.name from employee a where a.name = 'SMITH' order by a.nameIn other words you have prefixed a column with a table alias but have not indicated a table alias in the query.
Also, shouldn't your code be:
for (int i = 0; i < parameterValues.length; i++) {
statement.setString(i + 1, parameterValues[ i ]);
}Or was the "[ i ]" part giving you trouble? (Since "[ i ]" -- without the spaces -- is treated as a text-formatting tag.)
While I didn't try your specific query, I have no problem using "PreparedStatment"s with parameters.
What is your environment? Mine is:
Oracle 10g (10.1.0.4) database on Linux (Red Hat)
JDK 1.4.2
ojdbc14.jar JDBC driver (latest version)
Good Luck,
Avi. -
Hi all
i'm gtting a problem with the action listener event of my "Next" and "Previous" Jbuttons. The code that i have written makes the program search only for the next record and not further...and sameproblem for previous button.
That is: If originally i'm on the 3rd record, when i press next it goes to 4th record and when i press next again nothing happens. The same applies to my previous event.
Can anyone give me a hint on how to solve this problem?
i post my code below:
next.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt)
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql:///Super","root","");
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
s.execute("SELECT * FROM tblcustomer");
ResultSet rs = s.getResultSet();
rs.next();
cus.setText(rs.getString(1));
fname.setText(rs.getString(2));
lname.setText(rs.getString(3));
txtadd.setText(rs.getString(4));
txtcity.setText(rs.getString(5));
txtcountry.setText(rs.getString(6));
catch (Exception e)
JOptionPane.showMessageDialog(null,"No further record available!");
});thanx for your help but i still can't access the second record
here is my code below, have a look at it:
Class.forName("com.mysql.jdbc.Driver").newInstance();
final Connection conn=DriverManager.getConnection("jdbc:mysql:///Super", "root","");
previous.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt)
try
final Statement s= conn.createStatement();
s.execute("SELECT * FROM tblcustomer");
ResultSet rs = s.getResultSet();
if (!rs.isFirst())
while ( rs.previous() ){
rs.relative(-1);
cus.setText(rs.getString("Customer_ID"));
fname.setText(rs.getString("First_Name"));
lname.setText(rs.getString("Last_Name"));
txtadd.setText(rs.getString("Address"));
txtcity.setText(rs.getString("City"));
txtcountry.setText(rs.getString("Country"));
catch (Exception e)
JOptionPane.showMessageDialog(null,"No further record available!");
);
Maybe you are looking for
-
How can I make saved changes to my mac.
After editing the dashboard, or system preferences, the changes are immediate, but when I restarted the computer, all the changes just disappeared back to the original settings I last set. Does anyone knows how to fix this?
-
Extension for dreamweaver cs5.5
I seek extensions for dreamweaver 5.5
-
I don't know if this is the place to be asking this question but here goes.... I have just purchased the upgrade from CR2008 to CR2011 and receive the following message during the installation "This application has requested the runtime to terminate
-
Complete code to send an attachment with a text message using java mailapi
complete code to send an attachment with a text message using java mailapi code should be free from error
-
How can I get my mac email account to work?
How can I get my mac email account to work?