Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

edited tags
Link
user330315
user330315

I'm trying to execute a query in java but it throws an exception

this.conn =try DriverManager.getConnection(this.DatabaseURL+this.DatabaseName,{
 conn = DriverManager.getConnection(DatabaseURL + DatabaseName, this.UserName,this.Password);
 System.out.println("1");
 this.Message = "data retrieved successfully ...";
 //Statement st = this.conn.createStatement();// Membuat Statement
 System.out.println("2");
 pr = this.pr=connconn.prepareStatement("SELECT `الكلمة` FROM `name1` WHERE `الموضوع` LIKE 'أداة الطحن' ;");
 System.out.println("3");
 res = res=prpr.executeQuery();
 System.out.println("4");
} catch (Exception e) {
 System.out.println("5");
 this.Message = "connection failed \r\n " + e.getMessage();
 return null;
}

it prints 1 2 3 5 so there is a problem in executing the query so that it does not print 4 I tried to run it on sql and it works what's the problem here???

I'm trying to execute a query in java but it throws an exception

this.conn = DriverManager.getConnection(this.DatabaseURL+this.DatabaseName,
 this.UserName,this.Password);
 System.out.println("1");
 this.Message = "data retrieved successfully ...";
 //Statement st = this.conn.createStatement();// Membuat Statement
 System.out.println("2");
 this.pr=conn.prepareStatement("SELECT `الكلمة` FROM `name1` WHERE `الموضوع` LIKE 'أداة الطحن' ;");
 System.out.println("3");
 res=pr.executeQuery();
 System.out.println("4");
catch (Exception e) {
 System.out.println("5");
 this.Message = "connection failed \r\n " + e.getMessage();
 return null;
}

it prints 1 2 3 5 so there is a problem in executing the query so that it does not print 4 I tried to run it on sql and it works what's the problem here???

I'm trying to execute a query in java but it throws an exception

try {
 conn = DriverManager.getConnection(DatabaseURL + DatabaseName, UserName,Password);
 System.out.println("1");
 Message = "data retrieved successfully ...";
 //Statement st = this.conn.createStatement();// Membuat Statement
 System.out.println("2");
 pr = conn.prepareStatement("SELECT `الكلمة` FROM `name1` WHERE `الموضوع` LIKE 'أداة الطحن' ;");
 System.out.println("3");
 res = pr.executeQuery();
 System.out.println("4");
} catch (Exception e) {
 System.out.println("5");
 Message = "connection failed \r\n " + e.getMessage();
 return null;
}

it prints 1 2 3 5 so there is a problem in executing the query so that it does not print 4 I tried to run it on sql and it works what's the problem here???

Source Link

executing sql does not work

I'm trying to execute a query in java but it throws an exception

this.conn = DriverManager.getConnection(this.DatabaseURL+this.DatabaseName,
 this.UserName,this.Password);
 System.out.println("1");
 this.Message = "data retrieved successfully ...";
 //Statement st = this.conn.createStatement();// Membuat Statement
 System.out.println("2");
 this.pr=conn.prepareStatement("SELECT `الكلمة` FROM `name1` WHERE `الموضوع` LIKE 'أداة الطحن' ;");
 System.out.println("3");
 res=pr.executeQuery();
 System.out.println("4"); 
catch (Exception e )
 {
 System.out.println("5");
 this.Message = "connection failed \r\n " + e.getMessage();
 return null;
 }

it prints 1 2 3 5 so there is a problem in executing the query so that it does not print 4 I tried to run it on sql and it works what's the problem here???

default

AltStyle によって変換されたページ (->オリジナル) /