• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple DB access Exception

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :-)
 
reply
    Bookmark Topic Watch Topic
  • New Topic