|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Heeey guys!
it's the first time for me to post a thread here.. I have a big dilemma and I need your help.. I have a project at uni about making a JDBC ..here it is : Introduction JDBC (Java Database Connectivity) is a standard SQL database access interface, which provides uniform access to a wide range of relational databases. It also provides a common base on which higher-level tools and interfaces can be built. Basically, JDBC performs the following operations: • Establish a connection with a database or access any tabular data source. • Send SQL statements. • Process the results. JDBC defines a set of main interfaces to handle the previous three steps java.sql.Driver java.sql.Connection java.sql.Statement java.sql.Resultset The Driver interface handle requests for database connections, the Connection interface provide means for accessing the specified database and querying it using standard SQL queries. Each SQL query need to be passed to the connection through an object implements Statement interface, the return value of the query will be stored in an object implements ResultSet interface. The following code snippet for a simple JDBC program. // Step 1 : Establish the conenction // First, loading the driver Class drvClass = Class.forName(“oracle.jdbc.driver.OracleDriver”); DriverManager.registerDriver((Driver) drvClass.newInstance()); // Second, making the connection Connection m_con = DriverManager.getConnection(m_url, m_userName, m_password); // Step 2: Send SQL statement Statement stmt = m_con.createStatement(); ResultSet rs = stmt.executeUpdate("SELECT e_name, e_salary FROM employee"); // Step 3: Process the result while (rs.next()) { String s = rs.getString("e_name"); float n = rs.getFloat("e_salary"); System.out.println("Name: " + s + "\t Salary: " + n); } // Close connection and release resources stmt.close(); m_con.close(); Problem Statement It is required to implement and XML JDBC deriver that access and XML database and make some queries on it. First you will need to implement a simple Database Management System ,DBMS, that handles XML tables, it is let for you to specifies the structure of your XML tables. You will use SAX parser in parsing the tables data. Second, you will implement the JDBC four main interfaces; java.sql.Driver, java.sql.Connection, java.sql.Statement and java.sql.Resultset. You won't implement all methods of the previous interfaces, instead you will use adapter classes to handle the unneeded functions for our driver as the following. java.sql.Driver Will be implemented with all its methods. java.sql.Connection Implement the following methods; close(), commit(), createStatement(), isClosed(), isReadOnly(), setReadOnly(boolean readOnly). java.sql.Statement Implement the following methods; addBatch(String sql), clearBatch(), close(), executeBatch(), executeQuery(String sql), executeUpdate(String sql), getConnection(), getMaxRows(), getQueryTimeout(), getResultSet(), getUpdateCount(), setMaxRows(int max), setQueryTimeout(). java.sql.Resultset Implement the following methods; absolute(int row), afterLast(), beforeFirst(), cancelRowUpdates(), close(), deleteRow(), findColumn(String columnName), first(), getObject(int columnIndex), getObject(String columnName), getRow(), getStatement(), insertRow(), isAfterLast(), isBeforeFirst(), isFirst(), isLast(), last(), moveToCurrentRow(), moveToInsertRow(), next(), previous(), relative(int rows) , rowDeleted(), rowInserted(), rowUpdated(), updateObject(int columnIndex), updateObject(String columnName) The resultant JDBC of your implementation should be able to run code like given in the previous example and similar codes that execute SQL quires. Our proposed XML driver will support the following SQL statements: INSERT INTO table [ column [,column, …. ]] VALUES (value [,value, … )) UPDATE table SET column=value [ , column=value, .. ] [WHERE condition] DELETE table [WHERE condition] SELECT { * | column [,column, …. ] } FROM table WHERE condition Any syntax errors or invalid statements should be rejected. In your implementation you must have a general class for logging your different error, warnings and messages. It is recommended to use Log4J project for logging ------------------------------------------------------- now I need an example of an implementation of any of the functions coz I don't know where to start!!! please this is urgent thanks a lot Evronia |
| Sponsored Links |
|
|
|
|||
|
Hi thr!!
i have come across a link Develop Java applications for DB2 XML data i hope this can help you atleast to some extent, ![]() but i will tell you please read 1)Connect to Database 2)Insert XML data topics Sania:>Its alaways too soon to quit........ |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HELP!!! Networking & JDBC... | NikkiRae | Java Help | 0 | 10-06-2007 05:38 AM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| gaylo565 | ........ | 18.00000 |
| WingedPanther | ........ | 15.00000 |
| |pH| | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 65%