Click here to Skip to main content
15,902,032 members
Home / Discussions / Database
   

Database

 
AnswerRe: What is merge join in sql server Pin
CHill6023-Mar-17 23:36
mveCHill6023-Mar-17 23:36 
GeneralRe: What is merge join in sql server Pin
Richard MacCutchan24-Mar-17 1:40
mveRichard MacCutchan24-Mar-17 1:40 
GeneralRe: What is merge join in sql server Pin
CHill6028-Mar-17 1:31
mveCHill6028-Mar-17 1:31 
GeneralRe: What is merge join in sql server Pin
Tridip Bhattacharjee27-Mar-17 22:33
professionalTridip Bhattacharjee27-Mar-17 22:33 
GeneralRe: What is merge join in sql server Pin
CHill6028-Mar-17 0:42
mveCHill6028-Mar-17 0:42 
GeneralRe: What is merge join in sql server Pin
Eddy Vluggen28-Mar-17 1:35
professionalEddy Vluggen28-Mar-17 1:35 
QuestionGet all Packages that are failed to execute Pin
indian14321-Mar-17 14:15
indian14321-Mar-17 14:15 
QuestionGETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
LOKENDRA YADAV10-Mar-17 21:13
LOKENDRA YADAV10-Mar-17 21:13 
-----------------------------------DATABASE-------------------------------------------------------------
CREATE TABLE ACCOUNTS(ACCNO INT PRIMARY KEY,BAL PRIMARY KEY);
insert into accounts values(77,10000);
insert into accounts values(88,10000);

---------------------------------HERE IS JDBC CODE----------------------------------------------------
import A.JDBCUtil; // ****JDBCUtil is the class having connection code
import java.sql.*;

public class Test12 {

public static void main(String[] args) {
Account acc=new Account();
acc.transfer(77,88,5000); //******LINE 8******

}

}
class InvalidAccountNumberException extends Exception{

int accno;
public InvalidAccountNumberException() {
}
public InvalidAccountNumberException(int accno){

this.accno=accno;
}
<a href="https://www.codeproject.com/Members/OverRide">@Override</a>
public String toString() {

return "Accno"+accno+"not found";
}
}
class InsufficientFundsException extends Exception{
public InsufficientFundsException() {
}
<a href="https://www.codeproject.com/Members/OverRide">@Override</a>
public String toString() {
return "sufficent funds are not available";
}

}

class Account{

int bal;
int sab,dab,danb,sanb;
public void transfer(int sa,int da,int amt){

Connection con=null;
PreparedStatement ps1=null;
PreparedStatement ps2=null;


try{
con=JDBCUtil.getOracleConnection();
con.setAutoCommit(false);
ps1=con.prepareStatement("select bal from accounts where accno='?'");
ps1.setInt(1,da); ******//LINE 12******
ResultSet rs1=ps1.executeQuery();
if(rs1.next())
dab=rs1.getInt(1);
else
throw new InvalidAccountNumberException(da);
danb=dab+amt;
//updating destination account balance
ps2=con.prepareStatement("update accounts set bal='?' where accno='?' ");
ps2.setInt(1,danb);
ps2.setInt(2,da);
ps2.executeUpdate();
System.out.println("**"+da+"*updated*");
//checking source account
ps1.setInt(1,sa);
rs1=ps1.executeQuery();
if(rs1.next()){
sanb=rs1.getInt(1);
}else{
throw new InvalidAccountNumberException();

}
if(sab>=amt){
sanb=sab-amt;
}else{

throw new InsufficientFundsException();
}

//updating Source account
ps2.setInt(1,sanb);
ps2.setInt(2,sa);
ps2.executeUpdate();
con.commit();
System.out.println("**"+sa+"updated");
System.out.println("funds transferred");
}catch(Exception e){
e.printStackTrace();
try{
con.rollback();
}catch(Exception e1){
}
}finally{
JDBCUtil.cleanup(ps1, con);
JDBCUtil.cleanup(ps2, con);
}

}//transfer
}//account
QuestionRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
Richard MacCutchan10-Mar-17 21:55
mveRichard MacCutchan10-Mar-17 21:55 
AnswerRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
LOKENDRA YADAV10-Mar-17 21:58
LOKENDRA YADAV10-Mar-17 21:58 
AnswerRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
LOKENDRA YADAV10-Mar-17 22:05
LOKENDRA YADAV10-Mar-17 22:05 
GeneralRe: GETTING EXCEPTION ON JDBC TRANSACTION MGMT --->java.sql.SQLException: Invalid column index:at LINE 8 & 12 Pin
Richard MacCutchan10-Mar-17 22:27
mveRichard MacCutchan10-Mar-17 22:27 
QuestionAccess Application VS .Net Application Access Behind - How to Decide Pin
Member 1304435510-Mar-17 15:52
Member 1304435510-Mar-17 15:52 
AnswerRe: Access Application VS .Net Application Access Behind - How to Decide Pin
Mycroft Holmes11-Mar-17 13:05
professionalMycroft Holmes11-Mar-17 13:05 
GeneralRe: Access Application VS .Net Application Access Behind - How to Decide Pin
Member 1304435511-Mar-17 14:54
Member 1304435511-Mar-17 14:54 
GeneralRe: Access Application VS .Net Application Access Behind - How to Decide Pin
Mycroft Holmes12-Mar-17 14:31
professionalMycroft Holmes12-Mar-17 14:31 
QuestionFailed Steps of all Jobs and Disabled steps of all Jobs Pin
indian14310-Mar-17 6:30
indian14310-Mar-17 6:30 
AnswerRe: Failed Steps of all Jobs and Disabled steps of all Jobs Pin
ZurdoDev10-Mar-17 7:13
professionalZurdoDev10-Mar-17 7:13 
GeneralRe: Failed Steps of all Jobs and Disabled steps of all Jobs Pin
indian14327-Mar-17 11:04
indian14327-Mar-17 11:04 
Questioncomplilation error on stored procedure using sql??????????????? Pin
Member 130474308-Mar-17 19:48
Member 130474308-Mar-17 19:48 
QuestionRe: complilation error on stored procedure using sql??????????????? Pin
Richard MacCutchan8-Mar-17 21:24
mveRichard MacCutchan8-Mar-17 21:24 
Rant[REPOST] complilation error on stored procedure using sql??????????????? Pin
Richard Deeming9-Mar-17 1:20
mveRichard Deeming9-Mar-17 1:20 
AnswerRe: complilation error on stored procedure using sql??????????????? Pin
ZurdoDev9-Mar-17 2:02
professionalZurdoDev9-Mar-17 2:02 
AnswerRe: complilation error on stored procedure using sql??????????????? Pin
ZurdoDev9-Mar-17 9:47
professionalZurdoDev9-Mar-17 9:47 
GeneralRe: complilation error on stored procedure using sql??????????????? Pin
LOKENDRA YADAV9-Mar-17 10:12
LOKENDRA YADAV9-Mar-17 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.