My java programme is unable to connect to the database..
my code is this
[code=java]
import java.sql.*;
public class Stmt
{
public static void main(String args[])throws Exception
{
try{
Class.forName(" oracle.jdbc.dri ver.OracleDrive r");
Connection con=DriverManag er.getConnectio n("jdbc:oracle: thin@localhost: 1521:xe","scott ","tiger");
Statement stmt=con.create Statement();
String vsql="create table testtable(cone number,ctwo number)";
stmt.executeUpd ate(vsql);
System.out.prin tln("...Success ....");
con.close();
}
catch(ClassNotF oundException e)
{
System.out.prin tln(e);
System.out.prin tln("hello");
}
}
}
[/code]
My java programme is compiling but not running I am getting error as Exception in thread "main" java.sql.SQL exception,conne ction refused.
Please give answer to my question ,i am struck here and unable to go further
my code is this
[code=java]
import java.sql.*;
public class Stmt
{
public static void main(String args[])throws Exception
{
try{
Class.forName(" oracle.jdbc.dri ver.OracleDrive r");
Connection con=DriverManag er.getConnectio n("jdbc:oracle: thin@localhost: 1521:xe","scott ","tiger");
Statement stmt=con.create Statement();
String vsql="create table testtable(cone number,ctwo number)";
stmt.executeUpd ate(vsql);
System.out.prin tln("...Success ....");
con.close();
}
catch(ClassNotF oundException e)
{
System.out.prin tln(e);
System.out.prin tln("hello");
}
}
}
[/code]
My java programme is compiling but not running I am getting error as Exception in thread "main" java.sql.SQL exception,conne ction refused.
Please give answer to my question ,i am struck here and unable to go further
Comment