Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple DB access Exception

 
varkala prabhakar
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
I request you to help me out to solve my problem,
I am trying to display the data from access and orace using ODBC , I get SQLException as:
------------------------
SQLEXCEPTION Occured: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax erro
r (missing operator) in query expression 'merchantname form merchant'.
--------------------------
mycode
~~~~~~~
import java.io.*;
import java.util.*;
import java.sql.*;
public class DBConv {
public static void main(String args[]){

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException ex)
{
System.out.println(" Class Not FOund Exception :\t"+ ex);
}
try{
Connection acon;
Connection ocon;
acon=DriverManager.getConnection("jdbc dbc:Merchant");
ocon=DriverManager.getConnection("jdbc dbc:OraDb","scott","tiger");

Statement astmt = acon.createStatement();
Statement ostmt = ocon.createStatement();


String aQuery;
String oQuery;
aQuery="select merchantname form merchant;";
oQuery="select login from merchant;";
System.out.println(" Access Query:\t "+aQuery+ "\n Oracle Query :\t"+oQuery);
ResultSet ars=astmt.executeQuery(aQuery);
System.out.println(" I am after first Resultset");
ResultSet ors=ostmt.executeQuery(oQuery);
while(ars.next()){
System.out.println("Access:\t"+ ars.getString(1));
//ars.next()
}
while(ors.next()){
System.out.println("Access:\t"+ ors.getString(1));
//ars.next()
}
}// End of try
catch(SQLException e){
System.out.println("SQLEXCEPTION Occured:\t"+e);
}// End of catch
}// End of Main()
}// End of class

thanx
prabhakar
 
sundari swamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by varkala prabhakar:
Hai,
I request you to help me out to solve my problem,
I am trying to display the data from access and orace using ODBC , I get SQLException as:

Are yous sure this is how you wrote
aQuery="select merchantname form merchant;";
because the word "FROM" is typed wrongly as "FORM"
check it out :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic