Results 1 to 2 of 2
  1. #1
    kiz106 is offline Member
    Join Date
    May 2010
    Rep Power

    Default Connecting to a database table

    I was successful writing down the java code that connects to my JavaDB.(Am using NetBeans IDE).I want to retrieve content from my table called workers(Under the APP' SCHEMA) but that isnt possible.When I run my code,the following happens.
    'Schema 'KMUGALAASI' doesnt exit'.

    Can anyone tell mi what that means and how can I solve that problem? So that I can retrieve contents FROM MY TABLE(Workers with columns-ID,First_Name,Last_Name and Job_Title).Have a look at my code.

    package database_console;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.ResultSet;

    public class DBConnect {

    public static void main(String[] args) {
    try {

    String host = "jdbc:derby://localhost:1527/Employees";
    String uName = "kmugalaasi";
    String uPass = "GETAFE";
    Connection con = DriverManager.getConnection(host,uName,uPass);
    Statement stmt = con.createStatement();
    String SQL = "SELECT * FROM Workers";
    ResultSet rs = stmt.executeQuery(SQL);

    while ( {

    int id_col = rs.getInt("ID");
    String first_name = rs.getString("First_Name");
    String last_name = rs.getString("Last_Name");
    String job = rs.getString("Job_Title");
    String p = id_col + " " + first_name + " " + last_name + " " + job;

    catch (SQLException err) {


  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Rep Power


    No java related error.close the connection object and statement object once done with db opertions.

    This is more related to derby database connectivity.Please go thru the below tutorial.
    Establishing a Connection (The Java™ Tutorials > JDBC(TM) Database Access > JDBC Basics)

Similar Threads

  1. connecting to a foxpro table
    By lduren in forum New To Java
    Replies: 1
    Last Post: 05-02-2010, 09:39 AM
  2. connecting to a database
    By mxb7642 in forum JDBC
    Replies: 5
    Last Post: 09-08-2009, 09:39 AM
  3. connecting to a database
    By kswiss in forum NetBeans
    Replies: 4
    Last Post: 06-25-2009, 07:22 PM
  4. Connecting JSP with database
    By ramachandran in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 05-13-2009, 07:15 AM
  5. Connecting to a database
    By peiceonly in forum New To Java
    Replies: 2
    Last Post: 04-06-2008, 03:28 PM

Posting Permissions

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