Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 23rd, 2007, 6:11 PM   #1
evronia
Newbie
 
Join Date: Jun 2007
Posts: 1
Rep Power: 0 evronia is on a distinguished road
Exclamation Jdbc

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

Last edited by DaWei; Nov 23rd, 2007 at 9:29 PM. Reason: Added code tags. Read the rules.
evronia is offline   Reply With Quote
Old Nov 25th, 2007, 6:16 PM   #2
Grich
Hobbyist Programmer
 
Grich's Avatar
 
Join Date: Sep 2007
Location: Sydney - Australia
Posts: 150
Rep Power: 1 Grich is on a distinguished road
Re: Jdbc

Do your own <snip> homework pal.
__________________
SYNTAX ERROR ...

Last edited by Ancient Dragon; Nov 28th, 2007 at 8:16 AM. Reason: snipped cursing
Grich is offline   Reply With Quote
Old Nov 27th, 2007, 8:48 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,466
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: Jdbc

A verbatim copy-and-paste of your homework. Your lack of effort literally makes me sick.
If you can't come up with a simple set of code and post a specific question, then perhaps you should re-evaluate things.

Start here: google.com or your textbook.

I'm not doing your homework for you unless I can have your diploma/degree, since afterall, I am the one who will be earning it.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Nov 27th, 2007, 9:48 AM   #4
casesensitive
Newbie
 
Join Date: Oct 2007
Posts: 26
Rep Power: 0 casesensitive is on a distinguished road
Re: Jdbc

http://www.w3schools.com/sql/default.asp
Best place to start is by learning the basics http://www.kitebird.com/articles/jdbc.html
http://java.sun.com/docs/books/tutorial/
Sorry I like throwing links out there. BTW does it pay to do your homework? I would love to afford to go to college to "learn" this stuff also. Send me an e-mail to how much it pays and I'll tell you if it's worth anymore of my time.

Last edited by casesensitive; Nov 27th, 2007 at 10:01 AM.
casesensitive is offline   Reply With Quote
Old Nov 27th, 2007, 5:04 PM   #5
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Re: Jdbc

If you give clearer specifications, I could guide you in the right direction. What is your "database" going to look like? If you could give a sample, that would help. I have never used an "xml database".
Harakim is offline   Reply With Quote
Old Nov 28th, 2007, 4:28 AM   #6
casesensitive
Newbie
 
Join Date: Oct 2007
Posts: 26
Rep Power: 0 casesensitive is on a distinguished road
Re: Jdbc

Quote:
Originally Posted by Harakim View Post
If you give clearer specifications, I could guide you in the right direction. What is your "database" going to look like? If you could give a sample, that would help. I have never used an "xml database".
I think he already told us everything he knew. His class assignment word for word.
casesensitive is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
JDBC question metsfan Java 2 May 29th, 2007 11:58 AM
JDBC DB2 connection Konnor Java 6 Mar 10th, 2006 6:54 PM
Jdbc Dark Flare Knight Java 5 Nov 19th, 2005 6:25 PM
Jdbc Dark Flare Knight Java 1 Nov 6th, 2005 12:47 PM
problem with JDBC for talking to Microsoft Access database using a Java Applet captainK Java 4 Mar 20th, 2005 11:01 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:54 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC