Tablas con asientos
Buen día,
Cuales son las tablas de SAP B1 donde se guardan los asientos?.
Saludos.
La tabla es la OJDT y todas las que sean JDT#
Similar Messages
-
(OT) Eliminar tabla y crear tabla con datos
Hola Forero
Tengo la siguiente consulta. Necesito crear con un solo
botón o código, la
cual me permita eliminar una tabla, luego que la crea pero
con varios
registros
Alguien sabe como hacerlo?
Gracias de ante mano
Anuack.com.This is a multi-part message in MIME format.
------=_NextPart_000_000E_01C8B837.BBCB3CF0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Mysql - PHP
La idea es crear un bot=F3n que elimine una tabla. Luego la
crea con =
varios registros
Alguna sugerencia?
"Daniel Naranjo" <[email protected]> escribi=F3
en el mensaje =
news:[email protected]...
Daniel, la tabla es SQL de datos o una table de HTML?
Daniel Naranjo
Lo Ultimo Group, C.A.=20
(+58) 414 7962406 / 416 2917532 / 295 6117632=20
www.loultimoenlaWEB.com
www.loultimoenHosting.com
www.loultimoenViajes.com
"Anuack Technology de Colombia"
<[email protected]> escribi=F3 =
en el mensaje news:[email protected]...
Hola Forero
Tengo la siguiente consulta. Necesito crear con un solo
bot=F3n o =
c=F3digo, la=20
cual me permita eliminar una tabla, luego que la crea pero
con =
varios=20
registros
Alguien sabe como hacerlo?
Gracias de ante mano
Anuack.com.
------=_NextPart_000_000E_01C8B837.BBCB3CF0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3132"
name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Mysql -
PHP</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>La idea es crear
un bot=F3n que elimine =
una tabla.=20
Luego la crea con varios registros</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Alguna
sugerencia?</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT:
5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Daniel Naranjo" <<A=20
=
href=3D"mailto:[email protected]">[email protected]</A>>=
=20
escribi=F3 en el mensaje <A=20
=
href=3D"news:[email protected]">news:g0mvsp$4r7$1@forums=
.macromedia.com</A>...</DIV>
<DIV><FONT face=3DVerdana size=3D2>Daniel, la
tabla es SQL de datos o =
una table de=20
HTML?</FONT></DIV>
<DIV>
<P></P>
<P><FONT face=3D"Arial, Helvetica, sans-serif"
size=3D2><STRONG>Daniel =
Naranjo</STRONG><BR>Lo Ultimo Group, C.A.
</FONT><BR><FONT=20
face=3D"Arial, Helvetica, sans-serif" size=3D1>(+58) 414
7962406 / 416 =
2917532 /=20
295 6117632 <BR><U><A=20
=
href=3D"
R><U><A=20
=
href=3D"
U><BR><U><A=20
=
href=3D"
<BR></FONT></P></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT:
5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Anuack Technology de Colombia" <<A=20
=
href=3D"mailto:[email protected]">[email protected]</A>>
=
escribi=F3=20
en el mensaje <A=20
=
href=3D"news:[email protected]">news:g0fiam$33k$1@forums=
.macromedia.com</A>...</DIV>Hola=20
Forero<BR><BR>Tengo la siguiente consulta.
Necesito crear con un =
solo bot=F3n=20
o c=F3digo, la <BR>cual me permita eliminar una tabla,
luego que la =
crea pero=20
con varios <BR>registros<BR><BR>Alguien
sabe como =
hacerlo?<BR><BR>Gracias de=20
ante =
mano<BR><BR>Anuack.com.<BR><BR><BR></BLOCKQUOTE></BLOCKQUOTE></BODY></HTM=
L>
------=_NextPart_000_000E_01C8B837.BBCB3CF0-- -
What is the use of table control in bdc is it same in module pool table con
Hi,
What is the use of table control in bdc is it same in module pool table control?
regards
eswarHi,
Table control means it contains as table and it will scroll in vertical and horizontal.
In module pool by using screen we can create new table control.
But BDC table control means here we can populate the data into the table control.
i.e.if you take VA01 for sales order creation in the belwo of VA01 screen there is table control for the filling of material details so here we will write the code to populate the data into the table control screen.
Thanks and regards,
shyla -
Amigos
Lamento molestar por algo tan sencillo, pero realmente no lo
he logrado.
Estoy intentando hacer una simple tabla HTML que tiene varias
columnas, pero
el efecto que deseo es que se visulicen solamente renglones,
pero no logo
omitir de la visualizaci�n las lineas divisorias de
cada columna.
Muchas gracias.
PabloThis is a multi-part message in MIME format.
------=_NextPart_000_000F_01C6A6AA.F58B8350
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Gracias Julio, lo voy a probar. Estimo que anda por ah=ED el
asunto.
Un abrazo nuevamente.
Pablo
"Julio B." <[email protected]> escribi=F3 en
el mensaje =
news:[email protected]...
No se si es esto lo que necesitas:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" =
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1" />
<title>Untitled Document</title>
<style type=3D"text/css">
<!--
.linea {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #000000;
-->
</style>
</head>
<body>
<table width=3D"200" border=3D"0" cellpadding=3D"0"
cellspacing=3D"0">
<tr>
<td class=3D"linea">A</td>
<td class=3D"linea">1</td>
<td class=3D"linea">6</td>
</tr>
<tr>
<td class=3D"linea">B</td>
<td class=3D"linea">2</td>
<td class=3D"linea">7</td>
</tr>
<tr>
<td class=3D"linea">C</td>
<td class=3D"linea">3</td>
<td class=3D"linea">8</td>
</tr>
<tr>
<td class=3D"linea">D</td>
<td class=3D"linea">4</td>
<td class=3D"linea">9</td>
</tr>
<tr>
<td class=3D"linea">E</td>
<td class=3D"linea">5</td>
<td class=3D"linea">10</td>
</tr>
</table>
</body>
</html>
Saludos,
Julio Barroso
"Pablo A." <[email protected]> escribi=F3 en el
mensaje =
news:[email protected]...
| Amigos
|=20
| Lamento molestar por algo tan sencillo, pero realmente no
lo he =
logrado.
| Estoy intentando hacer una simple tabla HTML que tiene
varias =
columnas, pero=20
| el efecto que deseo es que se visulicen solamente
renglones, pero no =
logo=20
| omitir de la visualizaci=F3n las lineas divisorias de cada
columna.
|=20
| Muchas gracias.
|=20
| Pablo=20
|=20
|
------=_NextPart_000_000F_01C6A6AA.F58B8350
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2912"
name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Gracias Julio,
lo voy a probar. Estimo =
que anda por=20
ah=ED el asunto.</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Un abrazo
nuevamente.</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2>Pablo</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT:
5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Julio B." <<A=20
=
href=3D"mailto:[email protected]">[email protected]</A>&g=
t;=20
escribi=F3 en el mensaje <A=20
=
href=3D"news:[email protected]">news:e95ikq$81r$1@forums=
.macromedia.com</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>No se si es
esto lo que =
necesitas:</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000080
size=3D2><!DOCTYPE html =
PUBLIC=20
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"</FONT><A=20
href=3D"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><FONT
=
face=3DArial color=3D#000080=20
=
size=3D2>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</FONT></=
A><FONT=20
face=3DArial color=3D#000080
size=3D2>"><BR><html =
xmlns=3D"</FONT><A=20
href=3D"
http://www.w3.org/1999/xhtml"><FONT
face=3DArial =
color=3D#000080=20
size=3D2>
http://www.w3.org/1999/xhtml</FONT></A><FONT
face=3DArial =
color=3D#000080=20
size=3D2>"><BR><head><BR><meta
http-equiv=3D"Content-Type" =
content=3D"text/html; charset=3Diso-8859-1" =
/><BR><title>Untitled=20
Document</title><BR><style =
type=3D"text/css"><BR><!--<BR>.linea=20
{<BR> border-bottom-width:
1px;<BR> border-bottom-style:=20
solid;<BR> border-bottom-color:=20
=
#000000;<BR>}<BR>--><BR></style><BR></head></FONT></DIV>
<DIV><FONT face=3DArial color=3D#000080
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000080 =
size=3D2><body><BR><table=20
width=3D"200" border=3D"0" cellpadding=3D"0" =
cellspacing=3D"0"><BR> =20
<tr><BR>
<td=20
class=3D"linea">A</td><BR>
<td=20
class=3D"linea">1</td><BR>
<td=20
class=3D"linea">6</td><BR>
</tr><BR> =20
<tr><BR>
<td=20
class=3D"linea">B</td><BR>
<td=20
class=3D"linea">2</td><BR>
<td=20
class=3D"linea">7</td><BR>
</tr><BR> =20
<tr><BR>
<td=20
class=3D"linea">C</td><BR>
<td=20
class=3D"linea">3</td><BR>
<td=20
class=3D"linea">8</td><BR>
</tr><BR> =20
<tr><BR>
<td=20
class=3D"linea">D</td><BR>
<td=20
class=3D"linea">4</td><BR>
<td=20
class=3D"linea">9</td><BR>
</tr><BR> =20
<tr><BR>
<td=20
class=3D"linea">E</td><BR>
<td=20
class=3D"linea">5</td><BR>
<td=20
class=3D"linea">10</td><BR> =20
=
</tr><BR></table><BR></body><BR></html></FONT></D=
IV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial
size=3D2>Saludos,</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Julio
Barroso</FONT></DIV>
<DIV><FONT face=3DArial
size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"Pablo A."
<</FONT><A=20
href=3D"mailto:[email protected]"><FONT
face=3DArial=20
size=3D2>[email protected]</FONT></A><FONT
face=3DArial =
size=3D2>>=20
escribi=F3 en el mensaje </FONT><A=20
href=3D"news:[email protected]"><FONT
face=3DArial=20
size=3D2>news:[email protected]</FONT></A><FONT
=
face=3DArial=20
size=3D2>...</FONT></DIV><FONT
face=3DArial size=3D2>| Amigos<BR>| =
<BR>| Lamento=20
molestar por algo tan sencillo, pero realmente no lo he
logrado.<BR>| =
Estoy=20
intentando hacer una simple tabla HTML que tiene varias
columnas, pero =
<BR>|=20
el efecto que deseo es que se visulicen solamente renglones,
pero no =
logo=20
<BR>| omitir de la visualizaci=F3n las lineas
divisorias de cada =
columna.<BR>|=20
<BR>| Muchas gracias.<BR>| <BR>| Pablo
<BR>| <BR>|</FONT>=20
</BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_000F_01C6A6AA.F58B8350-- -
Appletviewer cannot run Appl. with table conn.
Hello
In my design form I can create an Applet with a grid connected
to my DB Oracle 7.3.4. (connect through database, querydataset
objects, test is ok). I See the records of my table, But If I
Press F9 to compile and Launch the Applet Viewer then the Applet
viewer start and do nothing.
Any Idea ?
B. Polarski
nullmark tomlinson (guest) wrote:
: Bernard Polarski (guest) wrote:
: : Hello
: : In my design form I can create an Applet with a grid
connected
: : to my DB Oracle 7.3.4. (connect through database,
querydataset
: : objects, test is ok). I See the records of my table, But If
I
: : Press F9 to compile and Launch the Applet Viewer then the
: Applet
: : viewer start and do nothing.
: : Any Idea ?
: : B. Polarski
: Are you getting any exceptions in the system console when the
: applet launches?
I don't think. I have followed the tutorial database applet VERY
carefully (3x) and I always got this result. On the contrary, if
I create the grid into the applet itself, instead of using a new
panel ( that's the way of the tutorial) then it compile and run
fine. same for infobus : It work in the first Applet but not in
any sub Panel. Another certitude is that JS2 leave quite a lot
of memory leak (maybe the same known bug as the NCA : don't
close applets by clicking on the cross, but always use the menu
to quit). After a while, my 128meg ram NT4 SP3 I/350 warn me
that I am running low on memory (and it run alone). Just close
JS2 and back and then it is ok.
B. Polarski
null -
Tablas en SAP de Libros Mayor y Diario
Estimados
Estoy en plena auditoria de SUNAT (Superintendencia de Adm Tributaria)
y me estan solicitando las bases de datos de los Libros Mayor y Diario
Hasta donde se las tablas son:
Libro Mayor: BSIS y BSAS
Libro Diario: BKPF y BSEG
queria que me confirmaran esta informacion o en su defecto indicarme que tablas o reporte podria bajar de SAP para atender este requerimiento de SUNAT
Muchas Gracias de antemano
Slds
AlfredoHola alfredo
Te cuento,
Nose a esas bases que mencionas se puede acceder, creo que no es posible
Lo que podrias hacer es una query con las tablas OJDT (asiento) JDT1 (asiento filas) y OACT (plan de cuentas) ahora si quieres añadir mas, puedes integrar mas tablas, aqui te dejo un ejemplo.
SELECT
T1.TransId 'Diario',
T0.FormatCode 'Cuenta',
T0.AcctName,
T1.Debit 'Debe',
T1.Credit 'Haber',
(T1.Debit - T1.Credit) 'Saldo',
T4.Memo 'Comentario Sistema',
T1.RefDate 'Fecha Contable',
T2.CreateDate 'Fecha Creacion',
T1.ShortName 'S/N',
T3.U_NAME 'Usuario'
FROM OACT T0
INNER JOIN JDT1 T1 ON T1.Account = T0.AcctCode
INNER JOIN OJDT T2 ON T1.Transid = T2.Transid
INNER JOIN OUSR T3 ON T1.UserSign = T3.UserID
INNER JOIN OJDT T4 ON T1.Transid = T4.Transid
WHERE T1.RefDate BETWEEN AND
Observacion, las variables %0 y %1 encierralas en corchetes
Bueno, espero te sirva
saludos -
Need help in creating a page that populates 3 related tables
Hi All,
I am pretty new to Oracle and have been trying to use the wizards in HTML_DB to create one page that will populate three tables. I have thus far have NOT been able to find my solutions. I do not know enough experience in SQL/PL_SQL to create the code on my own.
Here is my dilemma. I have three tables:
con (for contacts) - with regular contact info = l_name, f_name, phone...
pro (for different programs) - with different program info = pro_name, priority..
procon (Contact/program) - that joins the two together with initial, follow-up and close date fields.
I created a composite primary key in the procon table that consists of the two pk's of the other two tables (using fk relationships).
I want to be able to use one page in HTML_DB to enter in the data which will populate all three tables. Is there a way to do this in PL/SQL?
* Also: Is there a book out there that you can recommend that really teaches SQL/PL_SQL?
I would really, really, REALLY appreciate the help!!!!!
Thanks,
d.This isn't as bad as you think. I would create one procedure in a package and pass the parameters to the package via htmldb
procedure insval(in_a in number, in_b in number, in_c in number)
begin
insert into tablea(cola)
values(in_a);
insert into tableb(colb)
values(in_b);
insert into tablec(colc)
values(in_c);
end;and then you call it from htmldb using a process
schema.package.insval(:p1_a,:p1_b,:p1_c);That's ultra-simplified, but will get the job done.
-Scott -
Getting the table names in an MS Access database
Hi,
I am new to JDBC and making a client/server application that updates a MS Access database through jdbc:odbc.
I need to get a list of existing user tables in the db. I have found a great document on the net which has the code, however the code doesn't work. I have tried different ways and looked every where with no success. (link to the doco: http://www-128.ibm.com/developerworks/opensource/library/j-jdbc-objects/)
Here is my dbManager class that handles all db related services in my application. I would appreciate any help I can get as I have exhusted all my avenues.
Thanks
Sep,
* dbManager.java
* Created on 31 October 2005, 10:20
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
import java.io.*;
import java.sql.*;
import java.util.regex.*;
* @author AUMahdavSe
public class dbManager {
/** Constant Declaration */
public static final String Driver = "sun.jdbc.odbc.JdbcOdbcDriver";
public static final
String sqlCreateTable = "create table TABLENAME (" +
"name varchar (100)," +
"surname varchar(100)," +
"computerType integer," +
"computerNAL varchar(20)," +
"haveMonitor integer," +
"monitorNAL varchar (20)," +
"auditDate varchar(10) );";
public static final String sqlUpdateTable = "insert into TABLENAME values" +
" (NAMEHOLDER, SURNAMEHOLDER, COMPTYPE, COMPNAL, HAVEMON, MONNAL);";
/** Attributes */
private String dbURL = "jdbc:odbc:";
private String Username = "admin"; // user input
private String Password = "purina123"; // user input
private String ODBCDataSource; // config file
private String dbPath; // set through config file or defaults to current folder
private String configFile = "config.txt"; // set either at commandline or defaults to current folder
private Connection con = null;
private Statement stmt = null;
private ResultSet tables;
private DatabaseMetaData dma;
private ResultSetMetaData rsmd;
private String CurrentAuditTable = "TestTable2";
int numCols, i;
/** Set Methodes */
public void setUsername( String usr ) {
this.Username = usr;
public void setPassword( String pswd ) {
this.Password = pswd;
public void setDbPath( String path ) {
this.dbPath = path;
public void setODBCDataSource( String ds ) {
this.ODBCDataSource = ds;
public void setDbURL( String dsname ) {
this.dbURL = this.dbURL + dsname;
/** Get Methodes */
public String getDriver() {
return this.Driver;
// can be run only after a connection obj is setup
public void getMDA() {
try {
this.dma = this.con.getMetaData();
catch (SQLException ex) {
System.err.println("database connection: " + ex.getMessage());
public void getDBTables() {
//now dump out the names of the tables in the database
String[] types = new String[1];
types[0] = "TABLES"; //set table type mask
//note the %-sign is a wild card (not '*')
try {
this.tables = this.dma.getTables(null, null, "%", types);
dumpResults("--Tables--");
this.tables.close();
//this.listTables();
catch (SQLException ex) {
System.err.println("database connection: " + ex.getMessage());
// listing tables
/*int count = 0;
int numCols = 0;
//ResultSetMetaData rsmd;
try {
System.out.println("Listing db tables ...");
//this.tables.beforeFirst();
rsmd = this.tables.getMetaData();
numCols = rsmd.getColumnCount();
System.out.println("number of cols: " + numCols);
boolean more = this.tables.first();
System.out.println("this is why: " + more);
while ( more ) {
count++;
for (int i = 1; i <= numCols; i++)
System.out.print( "Table-" + count + " -> " + this.tables.getString(count)+" " );
System.out.println();
more = this.tables.next();
catch ( SQLException ex ) {
System.out.println( "problem listing db tables: " + ex.getMessage() );
/** Other Methodes */
// Initialize the db parameters, like driver, username, passwd, etc.
public void dbInitialize() {
// load configuration from config.txt (dbPath and ODBC Data Source name)
this.loadDbConfig();
// loadDriver
this.loadDriver();
// get username and password for the ODBC from user
this.getDSSecurity();
// populate dbURL, username and password
this.setDbURL( this.ODBCDataSource );
// connect to db
this.dbConnect();
// get db metadata
this.getMDA();
// get a list of tables in db
this.getDBTables();
// load JDBC driver
public void loadDriver() {
try {
Class.forName( getDriver() );
} catch (Exception e) {
System.out.println("Failed to load JDBC/ODBC driver.");
return;
// connects to db and create a Connection obj and a Statement obj
public void dbConnect() {
try {
this.con = DriverManager.getConnection (
this.dbURL,
this.Username,
this.Password);
this.stmt = con.createStatement();
} catch (Exception e) {
System.err.println("problems connecting to "+this.dbURL);
// creates table tblname in db
public void CreateTable( String tblname ) {
try {
String sqlcommand = mergeTblName(sqlCreateTable, tblname);
this.stmt.execute( sqlcommand );
catch (SQLException ex) {
System.err.println("problems with SQL statement sent to "+this.dbURL+
": "+ex.getMessage());
System.out.println("SQL Command: " + mergeTblName(sqlCreateTable, tblname) );
// updates db with new record(s) by executing the SQL query sqlstmt
// and closes db connection
public void dbUpdate( String sqlstmt ) {
try {
// execute SQL commands to create table, insert data
this.stmt.execute( sqlstmt );
this.con.close();
} catch (Exception e) {
System.err.println("problems with SQL sent to "+this.dbURL+
": "+e.getMessage());
// list all user tables in the db
public void listTables() {
//now dump out the names of the tables in the database
int count = 0;
try {
System.out.println("Listing db tables ...");
//this.tables.beforeFirst();
while ( this.tables.next() ) {
count++;
System.out.print( "Table-" + count + " -> " + this.tables.getString(1) );
System.out.println();
catch ( SQLException ex ) {
System.out.println( "problem listing db tables: " + ex.getMessage() );
// checks whether tbname exist in db as a table
// this function has to be called after dbConnect
public boolean tableExists( String tbname ) {
boolean tbexists = false;
//get the database metadata
try {
dma = con.getMetaData();
catch (SQLException ex) {
System.err.println("database connection: " + ex.getMessage());
//now dump out the names of the tables in the database
String[] types = new String[1];
types[0] = "TABLES"; //set table type mask
//note the %-sign is a wild card (not '*')
try {
tables = dma.getTables(null, null, "%", types);
catch (SQLException ex) {
System.err.println("database connection: " + ex.getMessage());
try {
while ( tables.next() ) {
if ( tbname.equalsIgnoreCase( tables.getString(1) ) ) {
tbexists = true;
catch ( SQLException ex ) {
System.err.println("database connection: " + ex.getMessage());
return tbexists;
// merge tablename using REGEX
public String mergeTblName( String sqlcommand, String tbname ) {
String REGEX = "TABLENAME";
String INPUT = sqlcommand;
String REPLACE = tbname;
Pattern p = Pattern.compile(REGEX);
Matcher m = p.matcher(INPUT); // get a matcher object
INPUT = m.replaceAll(REPLACE);
//System.out.println(INPUT);
return INPUT;
// merge feildnames specific terms using REGEX
public String mergeFldName( Message msg ) {
String sqlcommand;
sqlcommand = "insert into TABLENAME values" +
" ('" + msg.getName() + "', '" + msg.getSurname() + "', " +
msg.getComputerType() + ", '" + msg.getComputerNAL() + "', " +
msg.getHaveMonitor() + ", '" + msg.getMonitorNAL() + "', '" +
msg.getDateOfMsg() + "');";
sqlcommand = mergeTblName( sqlcommand, CurrentAuditTable );
return sqlcommand;
// get users input char
/**public char getChar() {
int i = System.in.read();
while (i != -1) {
// here's your character
char c = (char) i;
i = System.in.read();
return (char) i;
// load the config parameters from config.txt
public void loadDbConfig() {
// make a file obj pointing to the config file config.txt
File configFile = new File( this.configFile );
//...checks on configFile are elided
StringBuffer contents = new StringBuffer();
//declared here only to make visible to finally clause
BufferedReader input = null;
try {
//use buffering
//this implementation reads one line at a time
input = new BufferedReader( new FileReader(configFile) );
String line = null; //not declared within while loop
int count = 0;
while (( line = input.readLine()) != null){
//first line in config file is dbPath
if(count == 0) this.setDbPath( line.trim() );
//second line in config file is ODBCDataSource
if(count == 1) this.setODBCDataSource( line.trim() );
count++;
//contents.append(line);
//contents.append(System.getProperty("line.separator"));
catch (FileNotFoundException ex) {
System.err.println("the file congif.txt cannot be found ...");
System.err.print("Enter the path to db file (e.g. c:\\temp): ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// read the db path from the command-line; need to use try/catch with the
// readLine() method
try {
this.setDbPath( br.readLine() );
catch (IOException ioe) {
System.out.println("IO error trying to read user input.");
System.exit(1);
System.err.print("Enter the name of the ODBC Data Source: ");
// read the ODBC Data Source name from the command-line; need to use try/catch with the
// readLine() method
try {
this.setODBCDataSource( br.readLine() );
catch (IOException ioe) {
System.out.println("IO error trying to read user input.");
System.exit(1);
ex.printStackTrace();
catch (IOException ex){
//ex.printStackTrace();
finally {
try {
if (input!= null) {
//flush and close both "input" and its underlying FileReader
input.close();
catch (IOException ex) {
//ex.printStackTrace();
//return contents.toString();
// get datasource security details i.e. username and password
public void getDSSecurity() {
// get username
System.out.print("Enter username for the ODBC DataSource: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// read the username from the command-line; need to use try/catch with the
// readLine() method
try {
this.setUsername( br.readLine() );
catch (IOException ioe) {
System.out.println("IO error trying to read username.");
System.exit(1);
// get password
System.out.print("Enter password: ");
// read the username from the command-line; need to use try/catch with the
// readLine() method
try {
this.setPassword( br.readLine() );
catch (IOException ioe) {
System.out.println("IO error trying to read password.");
System.exit(1);
private void dumpResults(String head)
//this is a general routine to print out
//column headers and the contents of each column
System.out.println(head);
try
//get the number of columns from the metadata
this.rsmd = this.tables.getMetaData();
numCols = this.rsmd.getColumnCount();
//print out the column names
for (i = 1; i<= numCols; i++)
System.out.print(rsmd.getColumnName(i)+" ");
System.out.println();
//print out the column contents
boolean more = this.tables.next();
while (more)
for (i = 1; i <= numCols; i++)
System.out.print(this.tables.getString(i)+" ");
System.out.println();
more = this.tables.next();
catch(Exception e)
{System.out.println(e.getMessage());}
/** Creates a new instance of dbManager */
public dbManager() {
this.dbInitialize();
}here is the result when I make a new dbManager obj from my server class which is a multithreaded one.
H:\java>java EchoServer
Enter username for the ODBC DataSource: admin
Enter password: purina123
Tables
TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
Listening for clients on 12111...
here is the code of my server class called EchoServer:
import java.net.*;
import java.io.*;
public class EchoServer
ServerSocket m_ServerSocket;
dbManager haDB;
public EchoServer()
// db methods to setup a jdbc connection to the database
haDB = new dbManager();
// list tables
//haDB.listTables();
//haDB.getDBTables();
// create table
//haDB.CreateTable("TestTable2");
// update table
// server code
try
// Create the server socket.
m_ServerSocket = new ServerSocket(12111);
catch(IOException ioe)
System.out.println("Could not create server socket at 12111. Quitting.");
System.exit(-1);
System.out.println("Listening for clients on 12111...");
// Successfully created Server Socket. Now wait for connections.
int id = 0;
while(true)
try
// Accept incoming connections.
Socket clientSocket = m_ServerSocket.accept();
// accept() will block until a client connects to the server.
// If execution reaches this point, then it means that a client
// socket has been accepted.
// For each client, we will start a service thread to
// service the client requests. This is to demonstrate a
// multithreaded server, although not required for such a
// trivial application. Starting a thread also lets our
// EchoServer accept multiple connections simultaneously.
// Start a service thread
ClientServiceThread cliThread = new ClientServiceThread(clientSocket, id++, haDB);
cliThread.start();
catch(IOException ioe)
System.out.println("Exception encountered on accept. Ignoring. Stack Trace :");
ioe.printStackTrace();
public static void main (String[] args)
new EchoServer();
class ClientServiceThread extends Thread
Socket m_clientSocket;
int m_clientID = -1;
dbManager m_db;
boolean m_bRunThread = true;
ClientServiceThread(Socket s, int clientID, dbManager db)
m_clientSocket = s;
m_clientID = clientID;
m_db = db;
public void run()
// Obtain the input stream and the output stream for the socket
// A good practice is to encapsulate them with a BufferedReader
// and a PrintWriter as shown below.
BufferedReader in = null;
PrintWriter out = null;
Message msg = new Message();
// Print out details of this connection
System.out.println("Accepted Client : ID - " + m_clientID + " : Address - " +
m_clientSocket.getInetAddress().getHostName());
try
in = new BufferedReader(new InputStreamReader(m_clientSocket.getInputStream()));
out = new PrintWriter(new OutputStreamWriter(m_clientSocket.getOutputStream()));
// At this point, we can read for input and reply with appropriate output.
// Run in a loop until m_bRunThread is set to false
while(m_bRunThread)
// read incoming stream
String clientCommand = in.readLine();
if ( clientCommand.indexOf(",") != -1 ) {
msg.deserialize( clientCommand );
System.out.println("SQL command: " + m_db.mergeFldName(msg) );
m_db.dbUpdate( m_db.mergeFldName(msg) );
//System.out.println("Name :" + msg.getName() );
//System.out.println("Surname :" + msg.getSurname() );
//System.out.println("ComputerType :" + msg.getComputerType() );
//System.out.println("ComputerNAL :" + msg.getComputerNAL() );
//System.out.println("HaveMonitor :" + msg.getHaveMonitor() );
//System.out.println("Monitor NAL :" + msg.getMonitorNAL() );
//System.out.println("AuditDate :" + msg.getDateOfMsg() );
System.out.println("Client Says :" + clientCommand);
if(clientCommand.equalsIgnoreCase("quit"))
// Special command. Quit this thread
m_bRunThread = false;
System.out.print("Stopping client thread for client : " + m_clientID);
else
// Echo it back to the client.
out.println(clientCommand);
out.flush();
catch(Exception e)
e.printStackTrace();
finally
// Clean up
try
in.close();
out.close();
m_clientSocket.close();
System.out.println("...Stopped");
catch(IOException ioe)
ioe.printStackTrace();
}I find that taking any problem and reducing it to the simplest thing is the best way to approach it.
Why you had to post all that bloody code (especially since you didn't write it) is beyond me.
This will list all the tables in an Access database (or any other, for that matter):
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.jdom.Element;
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
public class TableLister
public static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
public static final String DATABASE = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
public static final String USERNAME = "admin";
public static final String PASSWORD = "";
public static void main(String [] args)
try
String driver = ((args.length > 0) ? args[0] : DRIVER);
String url = ((args.length > 1) ? args[1] : DATABASE);
String username = ((args.length > 2) ? args[2] : USERNAME);
String password = ((args.length > 3) ? args[3] : PASSWORD);
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, username, password);
DatabaseMetaData meta = conn.getMetaData();
// Bring back ALL tables and views, including SYSTEM tables.
ResultSet tables = meta.getTables(null, null, null, null);
ResultSetMetaData rsmd = tables.getMetaData();
int numColumns = rsmd.getColumnCount();
List columnNames = new ArrayList();
for (int j = 0; j < numColumns; ++j)
columnNames.add(rsmd.getColumnName(j+1));
Element root = new Element("tables");
int tableCount = 0;
while (tables.next())
Element table = new Element("table");
table.setAttribute("id", Integer.toString(++tableCount));
for (int j = 0; j < numColumns; ++j)
Element column = new Element((String)columnNames.get(j));
column.setText(tables.getString((String)columnNames.get(j)));
table.addContent(column);
root.addContent(table);
conn.close();
Document doc = new Document(root);
XMLOutputter outputter = new XMLOutputter(" ", true);
System.out.println(outputter.outputString(doc));
catch (ClassNotFoundException e)
System.err.println("Couldn't load JDBC driver class");
e.printStackTrace();
catch (SQLException e)
System.err.println("SQL state: " + e.getSQLState());
System.err.println("SQL error: " + e.getErrorCode());
e.printStackTrace();
catch (Exception e)
e.printStackTrace();
}Run it and see if it works for you. If it does, put the essence of the code into your stuff.
% -
How do i update a db table using one JSP page
I created a JSP Form page and I want to update a db table when the user hit submit. Please help my job depends on it Send me small code example below is what I have (very new to JSP)
<%@ page language="java" import="java.sql.*" import="java.io.*" %>
<html>
<head><title>accessing database</title></head>
<body bgcolor="white">
<% Connection con =null;
try {
// Load Driver Class File
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Make a connection to Data table
con = DriverManager.getConnection("jdbc:odbc:SportsbookTables", "developer", "developer");
Statement statement =con.createStatement();
String SQL = new String("INSERT INTO tblLines (gameID,leagueType) VALUES (5,'gam')");
statement.executeUpdate(SQL);
statement.executeUpdate("INSERT INTO tblLines (gameID,leagueType) VALUES (6,'lea')");
%>
<table border=1 cellspacing=1 cellpadding=1>
<form method="POST">
<p><font color="#800000" size="5">Enter your name:</font><input name="leagueType" size="4"></p>
<p><input type="submit" value="Submit"></p>
</form>
<%
catch (IOException ioe)
out.println("IO Exception:");
out.println(ioe.getMessage());
catch (SQLException sqle)
out.println("SQL Exception:");
out.println(sqle.getMessage());
catch (ClassNotFoundException cnfe)
out.println("Class Not Found Exception:");
out.println(cnfe.getMessage());
catch (Exception e)
out.println("General Exception:");
out.println(e.getMessage());
finally {
try
if (con!=null) {
con.close();
catch(SQLException sqle)
out.println(sqle.getMessage());
%>
</table>
</Body>
</HTML>First I would remove all the JDBC code you have in the JSP and place it in a servlet (or other Java) class, and have your form action call the servlet on submission. Then use the servlet API to extract the form data from the request and pass it to the JDBC in the servlet to update the DB. Once complete have it branch to another JSP/HTML to let the user know if they were successful or not.
Take a look at some of the online tutorials as they will be helpful with regards to code examples.
Depending on the size of your project, and deadlines naturally, you may also want to have a look at an MVC architecture and custom tags like Struts from Apache. These can make your job a lot eaiser. -
Internal table with and with out work area.
Hi all,
in performance terms which one is better 1) internal table with header line or 2) itab w/o header line and explicit work area for that itab.
which one is better and how?
Thanks in advance.
SAIHai Sai Ram
Internal Table with header Line Improves the Performence
1)
TABLES CUSTOMERS.
Defining an internal table with header line
DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
WITH HEADER LINE.
Reading all entries of the database table into the internal table
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.
2)
Check the following code for the Difference
REPORT ZWRITEDOC LINE-SIZE 124 NO STANDARD PAGE HEADING.
TABLES: DD03L, "
DD04T, "R/3-DD: Textos de los elementos de datos
DD02T. "R/3-DD: Textos de tablas SAP
Tabla temporal con las lineas de cada tabla
DATA: BEGIN OF I_LINEAS OCCURS 100,
LINEA(80),
END OF I_LINEAS.
Tabla con las caracteristicas de la tabla
DATA: BEGIN OF I_TABLA OCCURS 100,
CAMPO(12),
TIPO(4),
LONG(5) TYPE I,
REF(20),
DESCR(40),
END OF I_TABLA.
DATA: D_NOMBRE(80),
D_DESCRIPCION(80).
DATA : BEGIN OF SOURCE OCCURS 1000,
LINE(72),
END OF SOURCE.
PARAMETERS: PROGRAM LIKE SY-REPID DEFAULT SY-REPID.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'GRAB'.
PERFORM GRABAR.
ENDCASE.
START-OF-SELECTION.
SET PF-STATUS 'ZSTATUS1'.
READ REPORT PROGRAM INTO SOURCE.
DATA L_GRAB.
CLEAR L_GRAB.
LOOP AT SOURCE.
translate source to upper case.
IF L_GRAB IS INITIAL.
D_DESCRIPCION = I_LINEAS-LINEA.
ENDIF.
I_LINEAS = SOURCE.
SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
IF SY-SUBRC = 0.
SEARCH I_LINEAS-LINEA FOR 'DATA'.
IF SY-SUBRC = 0.
L_GRAB = 'X'.
FREE I_LINEAS.
ENDIF.
ENDIF.
IF L_GRAB = 'X'.
I_LINEAS = SOURCE.
APPEND I_LINEAS.
SEARCH I_LINEAS-LINEA FOR 'END OF'.
IF SY-SUBRC = 0.
CLEAR L_GRAB.
PERFORM PROCESAR_FICHERO.
PERFORM IMPRIMIR.
FREE I_LINEAS.
CLEAR D_DESCRIPCION.
ENDIF.
ENDIF.
SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
IF SY-SUBRC = 0.
APPEND I_LINEAS.
PERFORM PROCESAR_FICHERO.
PERFORM IMPRIMIR.
ENDIF.
ENDLOOP.
*& Form GRABAR
Graba el fichero en c:\temp\p.rtf y lo abre con word.
FORM GRABAR.
CALL FUNCTION 'LIST_DOWNLOAD'
EXPORTING
LIST_INDEX = SLIST_INDEX_DEFAULT
METHOD = 'RTF'
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'EXECUTE_WINWORD'
EXPORTING
I_FILE = 'C:\TEMP\P.RTF'
EXCEPTIONS
OTHERS = 1.
ENDFORM. " GRABAR
*& Form PROCESAR_FICHERO
FORM PROCESAR_FICHERO.
DATA: L_AUX1(80),
L_AUX2(80).
FREE I_TABLA.
LOOP AT I_LINEAS.
CLEAR I_TABLA.
translate i_lineas-linea to upper case.
SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
IF SY-SUBRC = 0.
SPLIT I_LINEAS-LINEA AT 'BEGIN OF' INTO L_AUX1 D_NOMBRE.
SPLIT D_NOMBRE AT 'OCCURS' INTO D_NOMBRE L_AUX1.
ENDIF.
SEARCH I_LINEAS-LINEA FOR '('.
IF SY-SUBRC = 0.
SPLIT I_LINEAS-LINEA AT '(' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX1.
I_TABLA-CAMPO = L_AUX1.
SPLIT L_AUX2 AT ')' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX1.
IF L_AUX1 CO '0123456789 '.
I_TABLA-LONG = L_AUX1.
ENDIF.
I_TABLA-TIPO = 'CHAR'.
ENDIF.
SEARCH I_LINEAS-LINEA FOR 'LIKE'.
IF SY-SUBRC = 0.
SPLIT I_LINEAS-LINEA AT 'LIKE' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX1.
I_TABLA-CAMPO = L_AUX1.
SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX1.
I_TABLA-REF = L_AUX1.
ENDIF.
SEARCH I_LINEAS-LINEA FOR 'TYPE'.
IF SY-SUBRC = 0.
SPLIT I_LINEAS-LINEA AT 'TYPE' INTO L_AUX1 L_AUX2.
IF I_TABLA-CAMPO IS INITIAL.
CONDENSE L_AUX1.
I_TABLA-CAMPO = L_AUX1.
ENDIF.
SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX1.
CASE L_AUX1.
WHEN 'I'.
I_TABLA-TIPO = 'INT'.
I_TABLA-LONG = 4.
WHEN 'C'.
I_TABLA-TIPO = 'CHAR'.
WHEN 'N'.
I_TABLA-TIPO = 'NUMC'.
WHEN 'T'.
I_TABLA-TIPO = 'TIME'.
I_TABLA-LONG = 8.
WHEN OTHERS.
I_TABLA-TIPO = L_AUX1.
ENDCASE.
ENDIF.
SEARCH I_LINEAS-LINEA FOR '"'.
IF SY-SUBRC = 0.
SPLIT I_LINEAS-LINEA AT '"' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX2.
I_TABLA-DESCR = L_AUX2.
ENDIF.
SEARCH I_LINEAS-LINEA FOR 'INCLUDE STRUCTURE'.
IF SY-SUBRC = 0.
SPLIT I_LINEAS-LINEA AT 'INCLUDE STRUCTURE' INTO L_AUX1 L_AUX2.
SPLIT L_AUX2 AT '.' INTO L_AUX1 L_AUX2.
CONDENSE L_AUX1.
I_TABLA-CAMPO = 'INCLUDE STR'.
I_TABLA-REF = L_AUX1.
ENDIF.
SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
IF SY-SUBRC = 0.
IF NOT I_LINEAS-LINEA CA '"'.
SPLIT I_LINEAS-LINEA AT 'OCCURS' INTO L_AUX1 L_AUX2.
IF SY-SUBRC = 0.
SPLIT L_AUX1 AT 'LIKE' INTO L_AUX1 L_AUX2.
IF SY-SUBRC = 0.
CONDENSE L_AUX2.
IF NOT L_AUX2 IS INITIAL.
I_TABLA-CAMPO = '...'.
I_TABLA-TIPO = 'TABI'.
I_TABLA-REF = L_AUX2.
SELECT SINGLE * FROM DD02T
WHERE TABNAME = L_AUX2
AND DDLANGUAGE = SY-LANGU.
IF SY-SUBRC = 0.
I_TABLA-TIPO = 'TABE'.
I_TABLA-DESCR = DD02T-DDTEXT.
ENDIF.
IF L_AUX1 CA ':'.
SPLIT L_AUX1 AT 'DATA:' INTO L_AUX1 L_AUX2.
ELSE.
SPLIT L_AUX1 AT 'DATA' INTO L_AUX1 L_AUX2.
ENDIF.
D_NOMBRE = L_AUX2.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
IF NOT I_TABLA-CAMPO IS INITIAL.
APPEND I_TABLA.
ENDIF.
ENDLOOP.
LOOP AT I_TABLA WHERE NOT REF IS INITIAL.
SPLIT I_TABLA-REF AT '-' INTO L_AUX1 L_AUX2.
SELECT SINGLE * FROM DD03L
WHERE TABNAME = L_AUX1
AND FIELDNAME = L_AUX2.
IF SY-SUBRC = 0.
I_TABLA-TIPO = DD03L-DATATYPE.
I_TABLA-LONG = DD03L-INTLEN.
IF I_TABLA-DESCR IS INITIAL.
SELECT SINGLE * FROM DD04T
WHERE ROLLNAME = DD03L-ROLLNAME
AND DDLANGUAGE = SY-LANGU.
IF SY-SUBRC = 0.
I_TABLA-DESCR = DD04T-DDTEXT.
ENDIF.
ENDIF.
MODIFY I_TABLA.
ENDIF.
ENDLOOP.
ENDFORM. " PROCESAR_FICHERO
*& Form IMPRIMIR
FORM IMPRIMIR.
DATA L_AUX(80).
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ULINE AT 1(80).
WRITE: / SY-VLINE,
(76) D_NOMBRE CENTERED,
SY-VLINE.
SPLIT D_DESCRIPCION AT '*' INTO L_AUX D_DESCRIPCION.
WRITE: / SY-VLINE,
(76) D_DESCRIPCION CENTERED,
SY-VLINE.
NEW-LINE.
ULINE AT 1(80).
DETAIL.
FORMAT COLOR OFF.
WRITE: /
SY-VLINE,
(10) 'CAMPO',
SY-VLINE,
(4) 'TIPO',
SY-VLINE,
(4) 'LONG',
SY-VLINE,
(16) 'REFERENCIA',
SY-VLINE,
(30) 'DESCRIPCION',
SY-VLINE.
NEW-LINE.
ULINE AT 1(80).
DETAIL.
LOOP AT I_TABLA.
WRITE: /
SY-VLINE,
(10) I_TABLA-CAMPO,
SY-VLINE,
I_TABLA-TIPO,
SY-VLINE,
(4) I_TABLA-LONG,
SY-VLINE,
(16) I_TABLA-REF,
SY-VLINE,
(30) I_TABLA-DESCR,
SY-VLINE.
ENDLOOP.
NEW-LINE.
ULINE AT 1(80).
SKIP 2.
ENDFORM. " IMPRIMIR
Thanks & regards
Sreeni -
Inserting into table..!
Hi,
I got a database table with a Cloumn,and i have created sequence on that column.
I would like to insert into that table through my JSP program.
Do i need to lock my table exclusively?
What happens if two different users try to insert into the same table at the same time through my JSP program?(Iam already using
setAutocommit(off/on) in my JSP program before/after the Insert statement).
Or does the webserver/Oracle has got any automatic lockiing system.
Do i need to add any more statements in my JSP program,other than normal statements used to insert into a table(Conn,rs,stmt)?
Thanks in advance
Regards
Rao.Three scenarios
(1) Using a before-insert trigger to populate the PK with sequence.nextval. Insert statement would populate non PK fields only.
(2) Using sequence.nextval within the insert statement.
(3) Retrieving and storing sequence.nextval for displaying to user. Later using that with the insert statement naming all the fields
Oracle would take care of concurrency in the first two scenarios. In the third case, if the retrieval and actual insert are in different methods then together they define the atomic transaction and you have to set up the descriptor like that.
Hope it helps! -
Doubts regarding registering a table using AD_DD Package
Dear Members,
Please give me some information on the following points:
1/ Parameter 'P_Nullable' in AD_DD.REGISTER_COLUMN
I have defined a custom table and in this table there are some primary columns and nullable columns.
Here my understanding is if the column is primary or not null then we should pass value 'N' to the parameter 'P_Nullable'.If it is a nullable column then we should pass value 'Y' to the parameter 'P_Nullable'.
Can any one please tell me is this right or wrong?
2/ Parameter 'P_Col_Width' in AD_DD.REGISTER_COLUMN
In my custom table I have some date columns defined.In some of the date columns iam storing the date as DD/MM/YYYY and in some of the columns iam storing the date format as DD/MM/YYYY HI:MM:SS.
For these date columns what width i should mention for the parameter P_Col_Width.
Your inputs will be of great help to me.
Thanks in advance.
Best Regards,
Arun Reddy.Hi, here's a script that queries the rdbms data dictionary to use that information to register the table in oracle apps data dictionary. Regarding your concerns, it takes the adequate value for nullable parameter according to column definition, and for date columns, it doesn't matter the format used, the information is stored internally the same. For the lenght of this column data type what I use is 9 as this is used for seeded information on this type of columns.
Regarding the script, change the name of the table to the one to register or add more than one in the tablas_tab table variable. For the schema owner of the table, change XXAMX for the custom schema you defined.
A more "readeable" version is available on http://oracle.am0x.com/2008/02/script-para-registro-de-tablas-en-la.html , a blog I have on oracle applications development topics but is spanish.
prompt -- ======================================================================
prompt -- Registrando tablas en el diccionario de datos de la aplicación
prompt -- ======================================================================
declare
type tablas_t is table of varchar2(30) index by binary_integer ;
tablas_tab tablas_t ;
cursor columnas_cur(
b_table_name in varchar2 ) is
select atc.column_name col_name
, atc.column_id col_seq
, atc.data_type col_type
, decode( atc.data_type
, 'NUMBER', 38
, 'DATE', 9, atc.data_length ) col_width
, atc.nullable nullable
, 'N' translate
, data_scale scale
, data_precision precision
from all_tab_columns atc
where table_name = b_table_name ;
begin
-- Llenar la tabla con las tablas a registrar
tablas_tab(1) := 'XXAMX_TABLA_PERSONALIZADA' ;
for tabs in 1..tablas_tab.count() loop
ad_dd.register_table(
p_appl_short_name => 'XXAMX'
, p_tab_name => tablas_tab( tabs )
, p_tab_type => 'T' ) ;
for cols in columnas_cur(
b_table_name => tablas_tab( tabs )) loop
ad_dd.register_column(
p_appl_short_name => 'XXAMX'
, p_tab_name => tablas_tab( tabs )
, p_col_name => cols.col_name
, p_col_seq => cols.col_seq
, p_col_type => cols.col_type
, p_col_width => cols.col_width
, p_nullable => cols.nullable
, p_translate => cols.translate
, p_scale => cols.scale
, p_precision => cols.precision ) ;
end loop ;
end loop ;
end ;
Message was edited by:
user651494 -
How to check if the table exists in teh database
Hi,
I am using MS Acess and how do i check using the query if the table already exist in the db?
What is the exact query. Can any one help me.
Thanks
DeeptiThis will do it for you and print out the results using JDOM. - %
package database;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class TableLister
public static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
public static final String DATABASE = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\\Documents and Settings\\Michael\\My Documents\\Projects\\Java\\Forum\\data\\DataConnection.mdb";
public static final String USERNAME = "admin";
public static final String PASSWORD = "";
public static void main(String[] args)
Connection conn = null;
ResultSet tables = null;
String driver = "";
try
driver = ((args.length > 0) ? args[0] : DRIVER);
String url = ((args.length > 1) ? args[1] : DATABASE);
String username = ((args.length > 2) ? args[2] : USERNAME);
String password = ((args.length > 3) ? args[3] : PASSWORD);
Class.forName(driver);
conn = DriverManager.getConnection(url, username, password);
DatabaseMetaData meta = conn.getMetaData();
// Bring back ALL tables and views, including SYSTEM tables.
tables = meta.getTables(null, null, null, null);
ResultSetMetaData rsmd = tables.getMetaData();
int numColumns = rsmd.getColumnCount();
List columnNames = new ArrayList();
for (int j = 0; j < numColumns; ++j)
columnNames.add(rsmd.getColumnName(j + 1));
Element root = new Element("tables");
int tableCount = 0;
while (tables.next())
Element table = new Element("table");
table.setAttribute("id", Integer.toString(++tableCount));
for (int j = 0; j < numColumns; ++j)
Element column = new Element((String) columnNames.get(j));
column.setText(tables.getString((String) columnNames.get(j)));
table.addContent(column);
root.addContent(table);
conn.close();
Document doc = new Document(root);
XMLOutputter outputter = new XMLOutputter(" ", true);
System.out.println(outputter.outputString(doc));
catch (ClassNotFoundException e)
System.err.println("Couldn't load JDBC driver class " + driver);
e.printStackTrace();
catch (SQLException e)
System.err.println("SQL state: " + e.getSQLState());
System.err.println("SQL error: " + e.getErrorCode());
e.printStackTrace();
catch (Exception e)
e.printStackTrace();
finally
close(tables);
close(conn);
public static void close(Connection c)
try
if (c != null)
c.close();
catch (SQLException e)
e.printStackTrace();
public static void close(Statement stmt)
try
if (stmt != null)
stmt.close();
catch (SQLException e)
e.printStackTrace();
public static void close(ResultSet result)
try
if (result != null)
result.close();
catch (SQLException e)
e.printStackTrace();
} -
Cisco ACE - "show conn" command queries
Hi all,
i have some queries regarding the "show conn" command in Cisco ACE.
Working Scenario:
VIP : 10.10.10.1
Server 1 : 10.10.20.1
Server 2 : 10.10.20.2
Client: 30.30.30.1
When a client 30.30.30.1 initiates a connection to the VIP on 10.10.10.1, the ACE load balances it to Server 1, 10.10.20.1. Looking at the "show conn" table, it shows that Server 1 is replying back to the Client 30.30.30.1 through the ACE.
Now, my question is when the ACE returns the traffic to the Client, should the Client be seeing the source IP coming from the VIP or Server 1? My understanding is that the Client should be seeing traffic returning from the VIP. But the show conn table does not seem to suggest so.
show conn table
conn-id np dir proto vlan source destination state
----------+--+---+-----+----+---------------------+---------------------+------+
1768 1 in TCP 10 30.30.30.1:9221 10.10.10.1:80 ESTAB
41 1 out TCP 52 10.10.20.1:80 30.30.30.1:9221 CLOSEDDaniel,
The client is expecting a response from the VIP otherwise there would be an asymmetrical routing problem and conns will never complete.
The fact that you're seeing 30.30.30.1 as the destination address is just that the server is able to see client's IP address on the request, when your backend servers sends the reply back to the client this response is forced to go through the ACE, when the ACE looks at the packet it matches with a previously conn created on the flow table so it "NATs" the reply so now the source of the packet is the VIP and destination is 30.30.30.1.
This is a expected behavior as you're not using S-NAT on your network.
HTH.
Pablo -
Getting GCPROV.SecurityException as response from GTC conn
OIM Version: 9.1.0
JBOSS: 4.2.3 GA
DB App Table conn: 9.1.0.5
I've created App Table GTC connector with all mappings. But when we try to provision user to this RO, create user is getting rejected with response as GCPROV.SecurityException.
error in the log..
[*XELLERATE.GC.FRAMEWORKPROVISIONING] getting form fields*
*2010-10-12 17:29:06,781 DEBUG [XELLERATE.ACCOUNTMANAGEMENT] Class/Method: UsernamePasswordLoginModule/initialize - Data: dburl - Value: {2}*
*2010-10-12 17:29:06,781 DEBUG [XELLERATE.ACCOUNTMANAGEMENT] Class/Method: UsernamePasswordLoginModule/initialize - Data: dbuser - Value: {2}*
*2010-10-12 17:29:06,781 INFO [XELLERATE.ACCOUNTMANAGEMENT] UsernamePasswordLoginModule/initialize : Un-authenticated Identity: Unknown*
*2010-10-12 17:29:06,781 INFO [XELLERATE.ACCOUNTMANAGEMENT] Class/Method: UsernamePasswordLoginModule/login No username and password, authenticating as un-authenticated Identity: Unknown*
*2010-10-12 17:29:06,781 DEBUG [XELLERATE.ACCOUNTMANAGEMENT] Class/Method: UsernamePasswordLoginModule/getUsername entered.*
*2010-10-12 17:29:06,781 DEBUG [XELLERATE.ACCOUNTMANAGEMENT] Class/Method: UsernamePasswordLoginModule/getUsername left.*
*2010-10-12 17:29:06,781 ERROR [XELLERATE.GC.FRAMEWORKPROVISIONING] SecurityException*
*2010-10-12 17:29:06,781 DEBUG [XELLERATE.ADAPTERS] Class/Method: tcAdpEvent/setAdpRetVal entered.*
I checked the link SecurityException and applied the patch 8273427.
But after applying the patch also I am getting the same exception.
Please help me resolving this.
Thanksthats real strange. but try this:
byte[] data = new byte[10000];
int counter = 0, ch = 0;
while ((ch = inputStream.read()) != 1)
byte[counter++] = (byte)ch;
}when this ends, you have the size in counter and the data in data. If this works you can arrayCopy the bytes to a new array or do whatever you want to do.
hth
Kay
Maybe you are looking for
-
TS4268 no audio available on incoming text, vibrate only.
no audio available on incoming text, vibrate only?
-
Mac vs PC: bus bottleneck in Mac?
I am a long time Mac user considering an upgrade to a Mac Pro for photography and soon for video and gaming. A photographer friend familiar with both Macs and PCs told me that I should consider the PC option for resource intensive applications as Mac
-
Price Change indicator in Service Purchase order
Dear Friends I am making one service purchase order, at service item level one price change indicator appears if its selected then at the time of service entry sheet it is possible to change value But in my case,this indicator is not appearing at the
-
AIrport extreme is setup. Airport express reset to factory settings. Light continues to blink amber. Utility will not recognize express to setup
-
What are the steps to create an idoc in the system?
Hi all, Could you give me the steps for the idoc creation..Please give step by step procedure only and if possible point me to related files or threads. Thanks, Charles.