Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2001
    Location
    london
    Posts
    3

    Unanswered: jav quizze engine

    hello i am wirting a java/ quizz engine that retrieves data from a database. i got some piece of code from devx.com but unfortunately that has been written to retrieve from xml file. i am witing one to retrieve questions from oracle please help. do you have any idea where i can get source code from?

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Are you just wanting to pull records from a database using jdbc ?

  3. #3
    Join Date
    Aug 2001
    Location
    london
    Posts
    3
    yes and also to store in a session

  4. #4
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    So you just need help connecting to the database and getting a recordset back? It's quite easy;
    Code:
    try
    {
    	//Create a connection to Oracle
    	Connection connection = DriverManager.getConnection("jdbc:oracle:kprb:");
    
    	//Create the statement, can scroll anyway and is updatable
    	Statement sel = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    
    	//Execute a query and get a resultset.
    	resultSet = read.executeQuery("SELECT to_char(MIN("+cba_time+"), 'DD/MM/YYYY HH24:MI:SS') as x FROM " + final_table);
    
    	//loop while there's still records.
    	while (resultSet.next())
    	{
    		System.out.println(resultSet.getString(1));
    	}
    }
    catch (SQLException e)
    {
    	//It all went wrong
    	System.out.println("Error! - "  + e);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •