• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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 :-)
 
What are you doing in my house? Get 'em tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic