Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7571399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:39:59+00:00 2026-05-30T15:39:59+00:00

i am trying to execute a sql command from a java program..i dont have

  • 0

i am trying to execute a sql command from a java program..i dont have any errors regarding this code..but i am facing connection refusals from the database..

import java.sql.*;
public class DBCreateTable
{
    public static void main(String args[]) throws Exception
    {
        DriverManager.registerDriver (new Oracle.jdbc.driver.OracleDriver());
        Connection con=DriverManager.getConnection(
              "jdbc:oracle:thin:@localhost:1521:xe","lms","abc");
        Statement stmt=con.CreateStatement();
        stmt.executeUpdate("create table emp(eno number(5),name varchar2(20))");
    }
}

the errors encountered are:

Exception in thread "main" java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599488)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
        at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
       at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:468)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
        at java.sql.DriverManager.getConnection(DriverManager.java:579)
        at java.sql.DriverManager.getConnection(DriverManager.java:221)
        at DBCreateTable.main(DBCreateTable.java:7)

In my sql commands i have done the following..

    SQL> connect system/tiger;
    SQL> create user lms identified by abc;
    SQL> grant connect,resource to lms;

and plz tell me what is scott tiger..i am messing a lot there..what users are there..what to unlock and how?? plz thanks..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:40:01+00:00Added an answer on May 30, 2026 at 3:40 pm

    your code

    Connection con=DriverManager.getConnection(
              "jdbc:oracle:thin:@localhost:1521:xe","lms","abc");
    

    change it to

    Connection con=DriverManager.getConnection(
              "jdbc:oracle:thin:@//localhost:1521:xe","lms","abc");
    

    For more information you can see

    http://www.orafaq.com/wiki/JDBC
    

    Another change is needed

    stmt.executeUpdate("create table emp(eno number(5),name varchar2(20))");
    

    change to

    stmt.executeUpdate("create table emp(eno number(5),name varchar2(20));");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to execute a sql command from a java program..i dont have
I am trying to execute this SQL command: SELECT page.page_namespace, pagelinks.pl_namespace, COUNT(*) FROM page,
I'm trying to execute a SQL command, but I just can't find out why
I'm trying to execute this SQL command in the VS Query Builder: INSERT INTO
I am trying to execute this SQL query prior to restoring a .BAK file
this is my first question. I'm trying to execute a SQL query in django
I'm trying to programmatically add an Execute SQL task from within a script task
Hello I have a very large SQL script and while trying to execute it
I'm trying to debug\execute a SP from t-sql (sql server 2008) and when I
I am trying to execute a batch file from C# code using Process class.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.