struct
Halil AKINCI <[email protected]> Mon, 11 Nov 2002 12:54:28 +0200
| Newsgroups | gmane.comp.java.sun.idl.user |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------=_NextPart_000_0010_01C28981.784A0AA0
Content-Type: text/plain;
charset="windows-1254"
Content-Transfer-Encoding: quoted-printable
Hi,
I'm studying CORBA and I want to develop a simple application. In this =
application I'm connecting an MS Access 2000 database, executing a query =
and obtaining a resultset. I want to set resultset's information to =
struct interface (EmployeeInfo) and send it to client. How can I do =
that? Can any one help me?
-------------------------------------------------------------------------=
------------
module EmployeeApp {
struct EmployeeInfo {
wstring name;
long number;
double salary;
};
exception SQLError {
wstring message;
};
interface Employee {
EmployeeInfo getEmployee(in long ID) raises (SQLError);
};
};
---------------------------------------------------------
part oh the employeServer.java
......
//getEmployee method queries database for employee info
public EmployeeInfo getEmployee(int ID) throws SQLError{ =20
try {
/*create a JDBC connection*/
Connection conn =3D =
DriverManager.getConnection("jdbc:odbc:Employee","","");
/*Create a SQL statement for the database query*/
PreparedStatement ps =3D conn.prepareStatement ("select number, =
name, salary from employee where number =3D '"+ID+"' ");
/*return the result in an EmployeeInfo structure */
?
?
?
------=_NextPart_000_0010_01C28981.784A0AA0
Content-Type: text/html;
charset="windows-1254"
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=3Dwindows-1254">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm studying CORBA and I want to =
develop a=20
simple application. In this application I'm connecting an MS =
Access=20
2000 database, executing a query and obtaining a resultset. I want to =
set=20
resultset's information to struct interface (EmployeeInfo) and send =
it to=20
client. How can I do that? Can any one help me?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>----------------------------------------------------------------=
---------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>module EmployeeApp {</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> struct EmployeeInfo=20
{<BR> wstring=20
name;<BR> long=20
number;<BR> double=20
salary;<BR> };</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> exception SQLError=20
{<BR> wstring message;<BR> =
};</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> interface Employee=20
{<BR> EmployeeInfo getEmployee(in long ID) =
raises=20
(SQLError);<BR> };<BR>};</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>---------------------------------------------------------</FONT>=
</DIV>
<DIV><FONT face=3DArial size=3D2>part oh the =
employeServer.java</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>......</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>//getEmployee method queries database =
for employee=20
info</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>public EmployeeInfo getEmployee(int ID) =
throws=20
SQLError{ </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> try=20
{<BR> /*create a JDBC=20
connection*/<BR> Connection =
conn =3D=20
DriverManager.getConnection("jdbc:odbc:Employee","","");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> /*Create=20
a SQL statement for the database=20
query*/<BR> PreparedStatement =
ps =3D=20
conn.prepareStatement ("select number, name, salary from employee where =
number =3D=20
'"+ID+"' ");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2> /*return=20
the result in an EmployeeInfo structure */<BR>?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>?</FONT></DIV></BODY></HTML>
------=_NextPart_000_0010_01C28981.784A0AA0--
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff IDL-USERS". For general help, send email to
[email protected] and include in the body of the message "help".