hi
i am trying to update a table selecting a value from another table and ve written the following codes for it..
import java.sql.*;
import java.io.*;
import java.util.*;
public class AF_updateAllele Tmp
{
Connection m_alleleCon;
public void con() throws SQLException, java.lang.Class NotFoundExcepti on
{
Class.forName(" oracle.jdbc.dri ver.OracleDrive r"); // oracle driver
m_alleleCon = (Connection)Dri verManager.getC onnection("jdbc :oracle:thin:@1 92.168.2.222:15 21:SNPDB","g2p" ,"g2p");
}
public void updateAlleleTem p() throws Exception
{
Statement my_updateStmt=m _alleleCon.crea teStatement(); //:1<int>,:2<char[32]>,:3<double>,:4 <char[128]>)
PreparedStateme nt my_SelMTStmt=m_ alleleCon.prepa reStatement("se lect distinct(AutoMa rkerID) from marker_temp where marker_temp.dbS NPrsID=?");
System.out.prin tln("after 1");
PreparedStateme nt my_updateATPStm t=m_alleleCon.p repareStatement ("update allele_temp set allele_temp.Aut oMarkerID =? where dbsnprsid=? and automarkerid is null");
System.out.prin tln("after 2");
ResultSet AT_amid=my_upda teStmt.executeQ uery("select * from missingautomark erid");
System.out.prin tln("after 3");
while (AT_amid.next() )
{
System.out.prin tln("inside while");
String dbsnpStr=AT_ami d.getString("db snprsid");
System.out.prin tln("got dbsnprsid\t"+db snpStr);
my_SelMTStmt.se tString(1,dbsnp Str);
System.out.prin tln("sel stmt");
//ResultSet rs=my_SelMTStmt .executeQuery() ;
System.out.prin tln("result set...");
while (rs.next())
{
System.out.prin tln("inside 2 while");
int MT_amid=rs.getI nt("automarkeri d");
System.out.prin tln("got automarkerid");
my_updateATPStm t.setInt(1,MT_a mid);
System.out.prin tln("set 1 done");
my_updateATPStm t.setString(2,d bsnpStr);
System.out.prin tln("set 2 done");
my_updateATPStm t.executeQuery( );
System.out.prin tln("update done");
}
System.out.prin tln("one update done !!!!");
my_updateATPStm t.executeQuery( "commit");
}
my_updateATPStm t.executeQuery( "commit");
my_updateStmt.c lose();
System.out.prin tln("Update Allele temp done");
}
public static void main(String[] args)
{
try
{
AF_updateAllele Tmp up =new AF_updateAllele Tmp();
up.con();
up.updateAllele Temp();
System.out.prin tln("Hello World!");
}
catch (Exception e)
{
e.printStackTra ce();
}
}
}
after one update the i get the following error
java.sql.SQLExc eption: ORA-01006: bind variable does not exist
can anyone plitz suggest something...
thanx
i am trying to update a table selecting a value from another table and ve written the following codes for it..
import java.sql.*;
import java.io.*;
import java.util.*;
public class AF_updateAllele Tmp
{
Connection m_alleleCon;
public void con() throws SQLException, java.lang.Class NotFoundExcepti on
{
Class.forName(" oracle.jdbc.dri ver.OracleDrive r"); // oracle driver
m_alleleCon = (Connection)Dri verManager.getC onnection("jdbc :oracle:thin:@1 92.168.2.222:15 21:SNPDB","g2p" ,"g2p");
}
public void updateAlleleTem p() throws Exception
{
Statement my_updateStmt=m _alleleCon.crea teStatement(); //:1<int>,:2<char[32]>,:3<double>,:4 <char[128]>)
PreparedStateme nt my_SelMTStmt=m_ alleleCon.prepa reStatement("se lect distinct(AutoMa rkerID) from marker_temp where marker_temp.dbS NPrsID=?");
System.out.prin tln("after 1");
PreparedStateme nt my_updateATPStm t=m_alleleCon.p repareStatement ("update allele_temp set allele_temp.Aut oMarkerID =? where dbsnprsid=? and automarkerid is null");
System.out.prin tln("after 2");
ResultSet AT_amid=my_upda teStmt.executeQ uery("select * from missingautomark erid");
System.out.prin tln("after 3");
while (AT_amid.next() )
{
System.out.prin tln("inside while");
String dbsnpStr=AT_ami d.getString("db snprsid");
System.out.prin tln("got dbsnprsid\t"+db snpStr);
my_SelMTStmt.se tString(1,dbsnp Str);
System.out.prin tln("sel stmt");
//ResultSet rs=my_SelMTStmt .executeQuery() ;
System.out.prin tln("result set...");
while (rs.next())
{
System.out.prin tln("inside 2 while");
int MT_amid=rs.getI nt("automarkeri d");
System.out.prin tln("got automarkerid");
my_updateATPStm t.setInt(1,MT_a mid);
System.out.prin tln("set 1 done");
my_updateATPStm t.setString(2,d bsnpStr);
System.out.prin tln("set 2 done");
my_updateATPStm t.executeQuery( );
System.out.prin tln("update done");
}
System.out.prin tln("one update done !!!!");
my_updateATPStm t.executeQuery( "commit");
}
my_updateATPStm t.executeQuery( "commit");
my_updateStmt.c lose();
System.out.prin tln("Update Allele temp done");
}
public static void main(String[] args)
{
try
{
AF_updateAllele Tmp up =new AF_updateAllele Tmp();
up.con();
up.updateAllele Temp();
System.out.prin tln("Hello World!");
}
catch (Exception e)
{
e.printStackTra ce();
}
}
}
after one update the i get the following error
java.sql.SQLExc eption: ORA-01006: bind variable does not exist
can anyone plitz suggest something...
thanx
Comment