Java Database Interfacing
Hi all,
Im relatively new to java programming and have come from a PHP base of programming with mySQL, and was wondering what is the best way for me to get into database interfacing with java. Anybody know any good tutorials for me to try, also what is the best kind of database to use with java and why? Just doing a little research before i start to go all out learning one particular way. I would like to program java to interface with mySQL in the same way that PHP does, if anyone can enlighten me I would appreciate that..
-Tom
Ok i have done that now, I got postgresql and it now
appears in the runtime databases section, how do i
create a database with it because it seems to want
the database URL in the following format:
jdbc:postgresql://<HOST>:<PORT>/<DB> . All i want to
know now is how to create a database to use That will be desribed in the docs provided by the vendor.
and how
what i would write in this field?Replace <HOST> with the name or IP address of the host where the DB is. Most likely localhost
<PORT> can probably be skipped, sinc you'll probably be using the default port.
<DB> is whatever you name the database you create.
Similar Messages
-
Problems with Java AQ interface migrating 9i to 10g
Hi!
I've got problems with Java AQ Interface migrating from 9i DB, JDBC, AQ to 10g rel.2 DB, JDBC, AQ
First, i started to occasionally receive NullPointerException in Oracle JDBC 9.2.0.8
java.lang.NullPointerException
at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:6439)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6203)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1543)
at gpnic.messaging.LDAPMessenger.messageFromRS(Unknown Source)
We were using 9.2.0.8 JDBC and 9i and 10g databases.
We decided to go up for 10g r2 JDBC Drivers, and 10.2 AQ but started to get the following errors:
oracle.AQ.AQOracleSQLException: ORA-25216: invalid recipient, either NAME or ADDRESS must be specified
ORA-06512: на "SYS.DBMS_AQIN", line 454
ORA-06512: на line 1
at oracle.AQ.AQOracleQueue.enqueue(AQOracleQueue.java:1267)
at gpnic.comm.messaging.transport.AQTransportAdapter$AQDestanation.send(AQTransportAdapter.java:607)
at gpnic.comm.messaging.transport.OutboundThread.run(OutboundThread.java:83)
I'm specifying address of an agent, but oracle says I am not.
I tried both native AQ and JMS interfaces, bot got the same error. I specify recipient the following way:
'consumer' var contains name of AQ agent and is not null
native AQ interface:
aqSess = AQDriverManager.createAQSession(db_conn);
AQQueue destQ = aqSess.getQueue(schema, queue);
dequeueOptionsOut = new AQDequeueOption();
dequeueOptionsOut.setWaitTime(AQDequeueOption.WAIT_NONE);
dequeueOptionsOut.setConsumerName(consumer);
dequeueOptionsOut.setDequeueMode(AQDequeueOption.DEQUEUE_REMOVE);
dequeueOptionsOut.setNavigationMode(AQDequeueOption.NAVIGATION_FIRST_MESSAGE);
AQMessageProperty mpOut = new AQMessageProperty();
Vector vRecpt = new Vector();
vRecpt.add(new AQAgent(consumer, null, 0));
mpOut.setRecipientList(vRecpt);
AQMessage aqMsg = null;
AQEnqueueOption eOpt = null;
//prepare message
aqMsg = destQ.createMessage();
CLOB chMsg = CLOB.createTemporary(db_conn, true, CLOB.DURATION_SESSION);
chMsg.open(CLOB.MODE_READWRITE);
chMsg.putString(1,msg);
//creating oracle type message
gpnic.db.SDSTypes.SdsMsgT oraMsg = new gpnic.db.SDSTypes.SdsMsgT(chMsg);
AQObjectPayload payload = aqMsg.getObjectPayload();
payload.setPayloadData(oraMsg);
//setting properties
aqMsg.setMessageProperty(mpOut);
//do enqueueOut
eOpt = new AQEnqueueOption();
destQ.enqueue(eOpt, aqMsg); //<- here AQOracleSQLException is thrown
JMS interface to Oracle AQ:
TopicSession session;
TopicConnection connection;
TopicPublisher publisher;
AQjmsAgent[] recipientList;
connection = AQjmsTopicConnectionFactory.createTopicConnection(db_conn);
session = connection.createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);
connection.start();
Topic topic = ((AQjmsSession) session).getTopic(schema, queue);
publisher = session.createPublisher(topic);
recipientList = new AQjmsAgent[1];
recipientList[0] = new AQjmsAgent(consumer, null);
CLOB chMsg = CLOB.createTemporary(db_conn, true, CLOB.DURATION_SESSION);
chMsg.open(CLOB.MODE_READWRITE);
chMsg.putString(1,msg);
//creating oracle type message
gpnic.db.SDSTypes.SdsMsgT oraMsg = new gpnic.db.SDSTypes.SdsMsgT(chMsg);
AdtMessage adtMessage = ((AQjmsSession)session).createAdtMessage();
adtMessage.setAdtPayload(oraMsg);
((AQjmsTopicPublisher) publisher).publish(adtMessage, recipientList); <- here Exception is thrown
We tried the following combinations
9i DB, 9i jdbc, 9i aq - enqueue ok
10g DB, 9i jdbc, 9i aq - enqueue ok
10g DB, 10g jdbc, 10g aq - exception is thrown
Can anyone help?Duplicate post, please check Upgrade 9i to 10g
-
Help Error in RSQL module of database interface
I have my RFC using OO.
I can excute it in the ECC System, but when i using java to call the function , the error 'Error in RSQL module of database interface' return.
I don't know why? If any help, that will be great.
in SM21 , there is it:
BV5 Conversion error during INS database access for table ZCDPWF_LQ_
AB0 Run-time error "DBIF_RSQL_INVALID_RSQL" occurred
AB1 > Short dump "090429 095636 csrt05 CDPMORPHEUS " generated
Edited by: ross.wang on Apr 29, 2009 4:33 AMI just found that in RFC, the data element should not be the domain. but must be the data element, or called data type.
Change field data element, it will be ok
Hope it is helpful. -
Login codes using java database (validates with Microsoft Access File)
hi all pro-programmer, can you show me the code to login with the username and password using java database. When the user enters the username and password in the login page then it will go to the requested page. may i know how to do it?
no one will give you complete code.
i'll lay out the pieces for you, though:
(1) start with a User object. give it username and password attributes.
(2) write a UserDAO interface with CRUD operations for a User object.
(3) write a UserDAOImpl for your Microsoft Access database
(4) write an AuthenticationService interface
(5) write an implementation of the AuthenicationService that works with the UserDAO to authorize a User.
Use a servlet to accept request from your login page and pass it off to the service. Voila.
PS - Here's skeleton to start with. UI, servlet, and controller are your responsibility:
package model;
public class User implements Serializable
private String username;
private String password;
public User(String u, String p)
this.username = u;
this.password = p;
public String getUsername() { return username; }
public String getPassword() { return password; }
public interface UserDAO
public User findByUsername(String username);
public void saveOrUpdate(User user);
public void delete(User user);
public class UserDAOImpl implements UserDAO
private Connection connection;
public UserDAOImpl(Connection connection)
this.connection = connection;
public User findByUsername(String username)
String password = "";
// logic for querying the database for a User
return new User(username, password);
public void saveOrUpdate(User user)
// save or update a User
public void delete(User user)
// delete a User
public interface AuthenticationService
public boolean isAuthorized(String username);
public class AuthenticationServiceImpl implements AuthenticationService
private UserDAO userDAO;
public AuthenticationServiceImpl()
// Create a database connection here and the UserDAO, too.
public boolean isAuthorized(String username)
boolean isAuthorized = false;
// Add logic to do the database query and decide if the username is authorized
return isAuthorized;
} -
Error in module RSQL of the database interface.
Hi Expert,
I get this error "Error in module RSQL of the database interface." when the below ABAP statement executed, do you know the root cuase? Thanks.
ABAP Code:
data lt_fact type TABLE OF /BIC/FZRT_C002.
data ls_Fact type /BIC/FZRT_C002.
*SELECT * INTO table lt_fact FROM /BIC/FZRT_C002 WHERE KEY_ZRT_C0021 in lt_RSDIMID and KEY_ZRT_C0022 in lt_caRSDIMID*.
Information in ST22.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLZZ_FG" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
in
procedure "ZCA_GET_CUBE_STOCK" "(FUNCTION)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The SQL statement generated from the SAP Open SQL statement violates a
restriction imposed by the underlying database system of the ABAP
system.
Possible error causes:
o The maximum size of an SQL statement was exceeded.
o The statement contains too many input variables.
o The input data requires more space than is available.
o ...
You can generally find details in the system log (SM21) and in the
developer trace of the relevant work process (ST11).
In the case of an error, current restrictions are frequently displayed
in the developer trace.
Best Regards,
Andrewi have the same error but my first select is
SELECT QMNUM QMTXT QMDAT AUFNR OBJNR QMNAM QMART BTPLN IWERK BEBER INGRP EQUNR SERIALNR MATNR
INTO TABLE GT_VIQMEL
FROM VIQMEL
WHERE QMNUM IN S_QMNUM .
please tell me how to solve this error when i run 24000 raw this select dump.
ASAP
thanks
Eman elgammal. -
Reg: Error in RSQL module of database interface
Dear All,
I am getting this error.
Error in RSQL module of database interface. While i am giving the excise invoice date(j_1exchdr-exdat) more than 120 days i am getting this error.
SELECT VBRK~VBELN VBRK~FKART VBRK~WAERK VBRK~KNUMV VBRK~FKDAT
VBRK~KURRF VBRK~KUNAG VBRK~FKSTO
VBRP~POSNR VBRP~FKIMG VBRP~NETWR VBRP~VGBEL VBRP~MATNR
VBRP~ARKTX VBRP~MATKL VBRP~WERKS VBRP~LGORT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM VBRK
INNER JOIN VBRP
ON VBRK~VBELN = VBRP~VBELN
WHERE VBRK~VBELN IN VBELN
AND VBRK~FKART IN FKART
AND VBRK~FKDAT IN FKDAT
AND VBRK~FKSTO NE 'X'
AND VBRP~MATKL IN MATKL
AND VBRP~WERKS IN WERKS
AND VBRP~LGORT IN LGORT.
what should i have to do? can i change this select query into selct for all entries what should i have to do?
Thanks,
Sankar MRuntime Errors DBIF_RSQL_INVALID_RSQL
Exceptn CX_SY_OPEN_SQL_DB
Date and Time 21.11.2008 15:24:50
ShrtText
Error in RSQL module of database interface.
What happened?
Error in ABAP application program.
The current ABAP program "Z_EXCISE_DET11H1" had to be terminated because one of
the
statements could not be executed.
This is probably due to an error in the ABAP program.
Error analysis
An exception occurred. This exception will be dealt with in more detail
below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
caught, which
led to a runtime error. The reason for this exception is:
The SQL statement generated from the SAP Open SQL Statement violates a
restriction imposed by the database system used in R/3.
Possible errors:
o The maximum size of an SQL statement has been exceeded.
o The statement contains too many input variables.
o The space needed for the input data exceeds the available memory.
o ...
You can usually find details in the system log (SM21) and in the
developer trace of the work process (ST11).
If an error occurs the developer trace often informs you about the
current restrictions.
Missing Handling of System Exception
Program Z_EXCISE_DET11H1
Trigger Location of Exception
Program Z_EXCISE_DET11H1
Include Z_EXCISE_DET11H1
Row 112
Module Name START-OF-SELECTION
Source Code Extract
Line SourceCde
82 FKART FOR VBRK-FKART,
83 FKDAT FOR VBRK-FKDAT,
84 VBELN FOR VBRK-VBELN, " OBLIGATORY DEFAULT '90002130',
85 MATKL FOR VBRP-MATKL OBLIGATORY," OBLIGATORY DEFAULT '01' NO INTERVALS NO-EX
86 LGORT FOR VBRP-LGORT NO INTERVALS NO-EXTENSION. "OBLIGATORY DEFAULT '1110'
87
88 SELECT J_1IEXCHDR~RDOC
89 FROM J_1IEXCHDR
90 INTO CORRESPONDING FIELDS OF TABLE EXCISEDOCNO
91 WHERE
92 J_1IEXCHDR~TRNTYP = 'DLFC' AND
93 J_1IEXCHDR~SRGRP IN SRGRP AND
94 J_1IEXCHDR~EXDAT IN EXDAT AND
95 J_1IEXCHDR~EXNUM IN EXNUM.
96
97 LOOP AT EXCISEDOCNO.
98 VBELN-SIGN ='I'.
99 VBELN-OPTION = 'EQ'.
100 VBELN-LOW = EXCISEDOCNO-RDOC.
101 APPEND VBELN.
102 ENDLOOP.
103
104 LOOP AT EXCISEDOCNO.
105 IF J_1IEXCHDR-TRNTYP = 'CEIV' .
106 DELETE EXCISEDOCNO.
107 MODIFY EXCISEDOCNO.
108 ENDIF.
109 ENDLOOP.
110 *ENDLOOP.
111
>>>>> SELECT VBRKVBELN VBRKFKART VBRKWAERK VBRKKNUMV VBRK~FKDAT
113 VBRKKURRF VBRKKUNAG VBRK~FKSTO
114 VBRPPOSNR VBRPFKIMG VBRPNETWR VBRPVGBEL VBRP~MATNR
115 VBRPARKTX VBRPMATKL VBRPWERKS VBRPLGORT
116 INTO CORRESPONDING FIELDS OF TABLE ITAB
117 FROM VBRK
118
119 INNER JOIN VBRP
120 ON VBRPVBELN = VBRKVBELN
121 WHERE VBRK~VBELN IN VBELN
122 AND VBRK~FKART IN FKART
123 AND VBRK~FKDAT IN FKDAT
124 AND VBRK~FKSTO NE 'X'
125 AND VBRP~MATKL IN MATKL
126 AND VBRP~WERKS IN WERKS
127 AND VBRP~LGORT IN LGORT.
128
129
130
131 -
RFC_ERROR_SYSTEM_FAILURE: Error in module RSQL of the database interface
HI All,
I am trying to execute an RFC through JCO connection and getting the error "RFC_ERROR_SYSTEM_FAILURE: Error in module RSQL of the database interface".
While debugging I have found that the actual cause of dump is a SQL command written in this RFC. The SQL command is
SELECT DISTINCT *
INTO CORRESPONDING FIELDS OF TABLE lt_calcrule_hol
FROM itc_calcrule_hol
FOR ALL ENTRIES IN calc_rule
WHERE rule_id = calc_rule-rule_id
AND start_date <= sy-datum
AND end_date >= sy-datum
AND (lv_ident)
AND ( (lv_orgs)
OR location_type = '' ).
Here the value of lv_ident is ======>> ident IN ('US','B2'.........................)
and value of lv_orgs is =========>> location_type IN ('S1','S2',..............................)
location_type and ident are columns in table itc_calcrule_hol .
I have analysed that if I pass around 700 enteries in the lv_ident and lv_ogs then it is working fine.
But if I have more than 900 enteries in these variables then it dumps.
Can anybody let me know what is the issue with the query here.And what could be the solution.
Thanks and Regards,
ReenaI'd recommend talking to an experienced basis admin or ABAP developer. First of all it would help to look at the short dump in SAP, to see if that gives any useful information. In case of a generic error like DBIF_RSQL_INVALID_RSQL, the developer trace of the work process (dev_w<n>) should contain further information (to get the number of the work process that handled your RFC call check the system log, which contains the reference along with a comment about the dump). So I'd check those first to see what actually caused the problem.
Information on maximum SQL statement length can either be retrieved from the database vendor's documentation or alternatively by searching SAP [OSS notes|https://service.sap.com/notes]. For the latter you need a valid user ID for the SAP service market place. -
Java DataBase in NetBeans!!
Hi there,
can you help guy,
I have the NetBeans IDE 4.1,
Oracle 9,
j2sdk1.4.0,
and win xp (on standalone machine)
I remember the old version of NetBeans, you can use Mounting FileSystem for jdbc\oracle\driver
to use the OracleDriver
but I get message error at compiler says that package jdbc.oracle.driver does not exist
please I need help in who to do Mounting FileSystem or other way
here is my code of java
// Database application using Oracle and Java programming Language
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import jdbc.sql.*
import java.awt.*;
public class OracleJavaCustomerWindow extends JFrame
private JLabel labelCId,labelCName,labelCCity,labelCPhone;
private JTextField textCId,textCName,textCCity,textCPhone;
private JPanel labelPanel,buttonPanel,textAreaPanel,labelTextAreaPanel;
private JTextArea outputArea;
private JScrollPane scrollPane;
private JButton buttonDisplay,buttonAdd,buttonModifyRecord,buttonUpdate,buttonDelete;
private JButton buttonClear;
private JTextField field1,field2,field3,field4;
private JLabel label1,label2,label3,label4;
private JPanel mixedPanel,mixedPanel2,fieldPanel1,fieldPanel2,fieldPanel3,fieldPanel4;
static Connection sqlconn = null;
// set up GUI with constrictor(IT IS A METHOD. EACHO CLASS AT LEST HAVE ONE)
public OracleJavaCustomerWindow ()
super("Display Oracle Data for Customers");
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
sqlconn= DriverManager.getConnection ("jdbc:oracle:oci:@Kawasaki", "scott", "tiger");
catch(SQLException ex)
System.out.println("SQLException:" + ex.getMessage() + "<BR>");
// add GUI components to container
Container container = getContentPane();
container.setLayout(new FlowLayout(FlowLayout.CENTER));
// Build labelPanel
labelCId = new JLabel(" Customer ID");
labelCName = new JLabel("Customer Name");
labelCCity = new JLabel("Customer City");
labelCPhone = new JLabel("Customer Phone");
labelPanel = new JPanel();
labelPanel.setLayout(new FlowLayout(FlowLayout.CENTER,3,5));
labelPanel.add(labelCId);
labelPanel.add(labelCName);
labelPanel.add(labelCCity);
labelPanel.add(labelCPhone);
// Build textAreaPanel
outputArea = new JTextArea(10,30);
outputArea.setEditable(false);
scrollPane = new JScrollPane(outputArea);
textAreaPanel = new JPanel();
textAreaPanel.setLayout(new FlowLayout(FlowLayout.CENTER,3,5));
textAreaPanel.add(scrollPane);
// Build labelTextAreaPanel which contains labelPanel and textAreaPanel
// to be ready for adding to container
labelTextAreaPanel= new JPanel();
labelTextAreaPanel.setLayout(new BorderLayout());
labelTextAreaPanel.add(labelPanel,BorderLayout.NORTH);
labelTextAreaPanel.add(textAreaPanel,BorderLayout.SOUTH);
// Buld buttonPanel
buttonDisplay = new JButton ("Display Table");
buttonClear = new JButton ("Clear");
buttonAdd = new JButton("Add New Record");
buttonUpdate= new JButton("Display Record");
buttonModifyRecord = new JButton("Modify Record");
buttonDelete = new JButton("Delete Record");
buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(6,1,10,5));
buttonPanel.add(buttonAdd);
buttonPanel.add(buttonUpdate);
buttonPanel.add(buttonModifyRecord);
buttonPanel.add(buttonDisplay);
buttonPanel.add(buttonDelete);
buttonPanel.add(buttonClear);
// build fieldPanel1
label1 = new JLabel("Customer Number");
field1 = new JTextField(10);
fieldPanel1 = new JPanel();
fieldPanel1.setLayout(new FlowLayout(FlowLayout.CENTER,3,5));
fieldPanel1.add(label1);
fieldPanel1.add(field1);
// build fieldPanel2
fieldPanel2 = new JPanel();
label2 = new JLabel("Customer Name");
field2 = new JTextField(10);
fieldPanel2.setLayout(new FlowLayout(FlowLayout.CENTER,3,5));
fieldPanel2.add(label2);
fieldPanel2.add(field2);
// build fieldPanel3
fieldPanel3 = new JPanel();
label3 = new JLabel("Customer City");
field3 = new JTextField(10);
fieldPanel3.setLayout(new FlowLayout(FlowLayout.CENTER,3,5));
fieldPanel3.add(label3);
fieldPanel3.add(field3);
// build fieldPanel4
fieldPanel4 = new JPanel();
label4 = new JLabel("Customer Phone");
field4 = new JTextField(10);
fieldPanel4.setLayout(new FlowLayout(FlowLayout.CENTER,3,5));
fieldPanel4.add(label4);
fieldPanel4.add(field4);
// Build mixedPanel which contains fieldPanel1, fieldPanel2,fieldPanel3
// to be ready for adding to container
mixedPanel = new JPanel();
mixedPanel.setLayout(new BorderLayout());
mixedPanel.add(fieldPanel1,BorderLayout.NORTH);
mixedPanel.add(fieldPanel2,BorderLayout.CENTER);
mixedPanel.add(fieldPanel3,BorderLayout.SOUTH);
mixedPanel2 = new JPanel();
mixedPanel2.add(fieldPanel4,BorderLayout.SOUTH);
// add all panels to the container
container.add(mixedPanel);
container.add(mixedPanel2);
container.setBackground(Color.DARK_GRAY);
container.add(labelTextAreaPanel);
container.add(buttonPanel);
//--------- Messages to communicate with different objects
//----------- method to clear the outputarea
buttonClear.addActionListener(
// anonymous inner class
new ActionListener()
public void actionPerformed(ActionEvent event)
outputArea.setText("");
}// actionPerformed
}// anonymous inner class
//--------- method to use button event--------------------
buttonDisplay.addActionListener(
//anonymous class
new ActionListener()
public void actionPerformed(ActionEvent event)
//Connection sqlca = null;
Statement sqlStatement = null;
ResultSet rset = null;
try{
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//sqlca= DriverManager.getConnection ("jdbc:oracle:thin:@dbserver:1521:infs", "manzur", "manzur");
sqlStatement = sqlconn.createStatement ();
rset = sqlStatement.executeQuery ("select * from customers");
while (rset.next ()){
String CUSTOMERID=rset.getObject(1).toString();
String CUSTOMERNAME =rset.getObject(2).toString();
String CUSTOMERCITY =rset.getObject(3).toString();
String CUSTOMERPHONE =rset.getObject(4).toString();
//String map=rset.getObject(4).toString();
//String region=rset.getObject(5).toString();
//System.out.println (id + "\t" + name + "\t" + loc );
outputArea.append(CUSTOMERID + "\t" + CUSTOMERNAME + "\t" + CUSTOMERCITY + "\t" + CUSTOMERPHONE + "\n" );
} // end while
}// end try
catch (SQLException ex)
System.out.println("SQLException:" + ex.getMessage() + "<BR>");
}// catch
}// action performed
} // anonymous inner class
);// end addActionListener
// ------ method to add Customers to the database
buttonAdd.addActionListener(
// anonymous inner class
new ActionListener()
public void actionPerformed(ActionEvent event)
try{
Statement sqlStatement = null;
ResultSet rtbookset = null;
// create statement
sqlStatement = sqlconn.createStatement();
int CUSTOMERID = Integer.parseInt(field1.getText());
String CUSTOMERNAME = field2.getText();
String CUSTOMERCITY = field3.getText();
int CUSTOMERPHONE = Integer.parseInt(field4.getText());
// create query
String insertquery = "INSERT INTO CUSTOMERS VALUES("
+ CUSTOMERID + "," + "'" + CUSTOMERNAME + "'," + "'" + CUSTOMERCITY + "'," + CUSTOMERPHONE + ")";
// execute the query
sqlStatement.executeQuery(insertquery);
// clear the textfields
field1.setText("");
field2.setText("");
field3.setText("");
field4.setText("");
JOptionPane.showMessageDialog(null,"Record added");
}// try
catch(SQLException ex)
System.out.println("Record exists :" + ex.getMessage() + "<BR>");
}// catch
}// actionPerformed
}// anonymous inner class
//--------- method to use buttonUpdate event--------------------
buttonUpdate.addActionListener(
//anonymous class
new ActionListener()
public void actionPerformed(ActionEvent event)
//Connection sqlconn = null;
Statement sqlStatement = null;
ResultSet rset = null;
int CUSTOMER_ID = Integer.parseInt(field1.getText());
try{
//int CUSTOMER_ID = Integer.parseInt(field1.getText());
//String d_name = field2.getText();
//String d_loc = field3.getText();
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//sqlca= DriverManager.getConnection ("jdbc:oracle:thin:@dbserver:1521:infs", "manzur", "manzur");
sqlStatement = sqlconn.createStatement ();
rset = sqlStatement.executeQuery ("select * from CUSTOMERS where CUSTOMER_ID =" + CUSTOMER_ID);
rset.next ();
//int id=rset.getInt("DEPTNO");
String CUSTOMERID = rset.getObject(1).toString();
String CUSTOMERNAME=rset.getString("CUSTOMER_NAME");
String CUSTOMERCITY=rset.getString("CUSTOMER_CITY");
String CUSTOMERPHONE=rset.getString("CUSTOMER_PHONE");
field1.setText(CUSTOMERID);
field2.setText(CUSTOMERNAME);
field3.setText(CUSTOMERCITY);
field4.setText(CUSTOMERPHONE);
//buttonUpdate.setEnabled(false);
//buttonModifyRecord.setEnabled(true);
//rset.close();
}// end try
catch (SQLException ex)
JOptionPane.showMessageDialog(null,"No Record found with CUSTOMER ID :" + CUSTOMER_ID );
//System.out.println("SQLException:No record found" + ex.getMessage() + "<BR>");
}// catch
}// action performed
} // anonymous inner class
);// end addActionListener
//---------Method to modify record------------------------------------
buttonModifyRecord.addActionListener(
//anonymous class
new ActionListener()
public void actionPerformed(ActionEvent event)
//Connection sqlconn = null;
Statement sqlStatement = null;
ResultSet rset = null;
try{
//int dept_no = Integer.parseInt(field1.getText());
//String d_name = field2.getText();
//String d_loc = field3.getText();
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//sqlca= DriverManager.getConnection ("jdbc:oracle:thin:@dbserver:1521:infs", "manzur", "manzur");
sqlStatement = sqlconn.createStatement ();
int CUSTOMERID = Integer.parseInt(field1.getText());
String CUSTOMERNAME = field2.getText();
String CUSTOMERCITY = field3.getText();
int CUSTOMERPHONE = Integer.parseInt(field4.getText());
String updatequery = "UPDATE CUSTOMERS SET CUSTOMER_NAME = " + "'" + CUSTOMERNAME + "',"
+ " CUSTOMER_CITY = " + "'" + CUSTOMERCITY + "'," + " CUSTOMER_PHONE = " + CUSTOMERPHONE
+ " Where CUSTOMER_ID = " + CUSTOMERID;
// execute the query
sqlStatement.executeQuery(updatequery);
// clear the textfields
field1.setText("");
field2.setText("");
field3.setText("");
field4.setText("");
JOptionPane.showMessageDialog(null,"Record modified");
//buttonUpdate.setEnabled(true);
//buttonModifyRecord.setEnabled(false);
}// end try
catch (SQLException ex)
System.out.println("SQLException:" + ex.getMessage() + "<BR>");
}// catch
}// action performed
} // anonymous inner class
);// end addActionListener
//---------Method to modify record------------------------------------
buttonDelete.addActionListener(
//anonymous class
new ActionListener()
public void actionPerformed(ActionEvent event)
//Connection sqlca = null;
Statement sqlStatement = null;
ResultSet rset = null;
try{
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//sqlca= DriverManager.getConnection ("jdbc:oracle:thin:@dbserver:1521:infs", "manzur", "manzur");
sqlStatement = sqlconn.createStatement ();
int CUSTOMERID = Integer.parseInt(field1.getText());
//String d_name = field2.getText();
//String d_loc = field3.getText();
String deletequery = "DELETE from CUSTOMERS "
+ " Where CUSTOMER_ID = " + CUSTOMERID;
// execute the query
sqlStatement.executeQuery(deletequery);
// clear the textfields
field1.setText("");
field2.setText("");
field3.setText("");
field4.setText("");
JOptionPane.showMessageDialog(null,"Record Deleted");
//buttonUpdate.setEnabled(true);
//buttonModifyRecord.setEnabled(false);
}// end try
catch (SQLException ex)
System.out.println("SQLException:" + ex.getMessage() + "<BR>");
}// catch
}// action performed
} // anonymous inner class
);// end addActionListener
// specify the size of the window
setSize(800,500);
show();
}// constructor
public static void main(String args[]) throws IOException{
OracleJavaCustomerWindow application = new OracleJavaCustomerWindow();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}// main
} // class OracleJavaWindow
// exceptions classes
// inserFailedException is a general exception for
// SQL insert problems
/*class insertFailedException extends SQLException
public insertFailedException(String reason)
super(reason);
public insertFailedException(String reason)
super();
}*/Sorry guys here is the correction of details i have provided
the Error message tells me that
package oracle.jdbc.driver does not exist
and the folder I used to do Mounting SystemFile for was
C:\Oracle\jdbc\lib\classes12 -
Internal error in the database interface (Oracle)
I have recently an Oracle runtime error just by entering the SAP system (SAP ECC 6.0).
DBIF_RSQL_INVALID_REQUEST
The current ABAP/4 program terminated due to
an internal error in the database interface.
Error analysis
An invalid request was made to the SAP database interface in a statement
in which the table "DOKTL " was accessed.
Trigger Location of Runtime Error
Program SAPLSDOC
Include LSDOCU09
Row 249
Module type (FUNCTION)
Module Name DOCU_GET
I appreciate any helpful information.
Thank you very much indeed
Thomhi Thom,
most error relating to table DOKTL are caused by misconfigured network card.
if this is a "home" system, install a loopback adapter from Microsoft and use IP address 127.0.0.1 and also check "hosts" file for inconsistency. do not use the IP adddress provided by your ISP as it may change. -
What the Enviroment required for java databases programs?
Hi guys
What the enviroment required for java databases programs?
If I have oracle of version 9i and java 1.4.1 platform
do I need Jdeveloper platform ?What the enviroment required for java databases programs?What do you mean by "environment"?
f I have oracle of version 9i and java 1.4.1 platformYou just need to download Oracle's 9i JDBC driver (ojdbc14.jar) and put that in your CLASSPATH. Then write JDBC code to connect to Oracle and issue SQL commands.
do I need Jdeveloper platform ?No, JDeveloper is an IDE. Not required.
Why Java 1.4.1? We're up to Java 6 now. You're two major versions of the JDK behind.
% -
Hello,
I'll like some advice on the topic mentioned above. I'm a beginner of java programming and have elementry knowledge about java. I'll like to know how is it possible to input the list of data in Excel format into Java Database Connectivity and how am I able to extract out the info. that I'll need. Like say the columns/field on designation and name. How am I able to extract the data and change it like to delete or edit the info.??
Pls. explain it step-by-step your patience is really appreciated. Thanks and God Bless.You should search Javaworld for "Excel" - they've had a few articles about using JDBC to access Excel. As far as I recall, though, you can't alter data in Excel through JDBC, only read it.
http://www.javaworld.com
There are other ways of getting at Excel data through Java but they're not very good either (unless you want to use a Java-COM bridge). -
Error in the module RSQL accessing the database interface
I have written the following query.
SELECT a~no
a~hist_no
a~chk_stat
a~chk_date
a~user as chk_user
b~name as chk_by
into corresponding fields of table hist
from zhist as a INNER JOIN zuser as b on
auser = bbname
where pspnr = v_pspnr
and chk_no = v_chk_no.
I am getting the dump "Error in the module RSQL accessing the database interface".
Please provide me the solution.
Thanx,
Selva.Hi,
As i have analysed your query in that you are putting the data in the internal table 'hist' which is also a standard structure and if you check in SE11 'hist' is the standard structure for 'Tablespace History' and might be because of that it is causing the problem.
Kindly check by changing the name of the internal table to tt_hist and then try.
I think that will solve the problem.
Regards,
Harsh Goel -
Error in module RSQL of the database interface! Please Help.
I am getting the error "Error in module RSQL of the database interface" in my program. Below is the code snippet in which the above error is:
=================================
FORM UPLOAD_PA_PB USING NB_LINE ID.
DATA: TOT_LINES TYPE I.
IF ID <> 'PA' and ID <> 'PB'. "UPG060507 - RY
only PA and PB tables
CHECK ID CP 'PA*'
OR ID CP 'PB*'.
DO NB_LINE TIMES.
READ DATASET DSN INTO IPREL_DB.
IF IPREL_DB+0(3) = P_FROM.
IPREL_DB+0(3) = P_TO.
ENDIF.
RP-CHECK-VALID-PAPB IPREL_DB S_BEGDA-LOW S_BEGDA-HIGH.
IF FLAG = 0. CONTINUE. ENDIF.
APPEND IPREL_DB.
ENDDO.
Begin of change - UPG060507 - RY
DELETE ADJACENT DUPLICATES FROM IPREL_DB.
End of change - UPG060507 - RY
IF TEST = SPACE.
IF ID = 'PA2010' or ID = 'PA0014' or ID = 'PA0015'.
PERFORM CLEAR_COST_ASSIGNMENT. "PUNM0002
ENDIF.
delete previous values
DELETE FROM (ID) WHERE PERNR IN PERS
AND BEGDA <= S_BEGDA-HIGH
AND ENDDA => S_BEGDA-LOW.
WRITE: / SY-DBCNT LEFT-JUSTIFIED, 'entrie(s) deleted from', ID.
insert the new ones
INSERT (ID) FROM TABLE IPREL_DB.
WRITE: / SY-DBCNT LEFT-JUSTIFIED, 'entrie(s) imported in', ID.
CALL FUNCTION 'DB_COMMIT'.
SKIP.
ELSE.
DESCRIBE TABLE IPREL_DB LINES TOT_LINES.
WRITE:/ TOT_LINES LEFT-JUSTIFIED, 'Entries Will Be Imported in',ID.
ENDIF.
REFRESH IPREL_DB.
ENDIF. "UPG060507 - RY
ENDFORM.
===============
Your help will be greatly appreciated and all the answers will be rewarded.
Thanks.
MithunHi Mithun,
Can you please tell at which line the error is shown.
Regards,
Atish -
Java Application interface with MS Excel through DDE
We have a financial application written in JAVA and have requests from users that want to interface with the application. Meaning, They would like the Java application interface with Excel. For example, if you had a C++ application, you could create a DDE link in Excel that points to the C++ application and receive the data.
How could I do this with a Java Applictaion ? I was told that there was an application written that lets Java interface with Excel.
Any ideas or does anyone know ?JNI
-
FLEX+CAIRNGORM+BLAZEDS+JAVA+DATABASE
A very simple example for FLEX+CAIRNGORM+BLAZEDS+JAVA+DATABASE.
http://vijaaay.limewebs.com/forum/viewthread.php?tid=26&extra=page%3D1
or
visit www . flexindia . tk >> Flex Examples
The attachment zip contains the source files[ FLEX and JAVA ] and Readme.txt which helps you to setup this example.
Regards,
VijayYeah i registered, but i couldn't find zip file. Could you please tell me where is that example
Thanks,
ApacheFlex.
Maybe you are looking for
-
Apple TV remote affecting other devices
Hi, I've got an Apple TV 2 and a MBP in the same room. I've managed to pair the Apple TV's remote with the AppleTV (by holding menu and right for 5 seconds) so that the MBP's white remote now does not work with the AppleTV. I just cannot get the Appl
-
How can I move my photos from Mac to iCloud?
I want use my iCloud account but I don't know how can I leave my files in iCloud. I use a MacBook pro and I need leave some pictures just in iCloud...and take off from my Mac.
-
End User Documents for AA & AP
Hi Gurus, i need to give End User Training next Week on AA & AP, can anybody send me Documentation Manauls relating to End User Training on AA & AP. Please help me, i will reward points for the helpful solutions, its urgent for me. my mail id: [email
-
Trying to monitor db connections in Tomcat
All, Not sure if I am posting in the right place, as this problem of mine seems to cover a couple of different forum topics, but I figured since its database connections I'm trying to monitor, I'd post here. My desire is this... I'd like to monitor a
-
Performance Issue - Index is not used when a zero padded string is queried
Hi All, I have a table T1 which has many columns. One such column say C1 is a varchar2(20). T1 has 10 million rows and there is an index called I1 on C1. Stats are current for both tables and indexes. These are the scenarios: Scenario 1 select * fr