tough to get me

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2008
Posts: 40
Reputation: cutedipti is an unknown quantity at this point 
Solved Threads: 0
cutedipti cutedipti is offline Offline
Light Poster

tough to get me

 
-1
  #1
Jun 27th, 2009
consider the following snippet:
import java.sql.*;
public class test
{
public static void main(String args[])
{
try
{
Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");
Connection cn;
cn=DriverManager.getConnection("jdbc:odbc","username","password");
Statement st=cn.createStatement();
st.executeQuery("select * from emp");
System.out.println("Succeed");
}
catch(Exception e)
{
System.out.println("Faild");
}
finall()
{
system.out.println("Always");
}
}
}
what will be the result
Thanks & Regards
Ms. Dipti
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,249
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 492
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: tough to get me

 
-1
  #2
Jun 27th, 2009
Error while compiling, as there is nothing like Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");, finall(); system.out.println("Always");
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 40
Reputation: cutedipti is an unknown quantity at this point 
Solved Threads: 0
cutedipti cutedipti is offline Offline
Light Poster

Re: tough to get me

 
0
  #3
Jun 27th, 2009
Originally Posted by peter_budo View Post
Error while compiling, as there is nothing like Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");, finall(); system.out.println("Always");



It's .........
Class.forName("sun.jdbc.odbc.JdbcOdbcDriverManager");

& other is......
finally
{
System.out.println("Always");
}
Originally Posted by cutedipti View Post
Actualy i am about :
JDBC-ODBC bridge driver
OR JDBC-Net pure java driver
Thanks & Regards
Ms. Dipti
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,721
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 500
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: tough to get me

 
0
  #4
Jun 27th, 2009
Wrap up source code with bb code tags.
>what will be the result
Have you compiled this code?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,249
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 492
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: tough to get me

 
-1
  #5
Jun 27th, 2009
Result can be anything Succeed and Always if there been no issue, it can be Faild if table doesn't exist, or it can be number of errors because of various reasons.
So you better post what errors you getting.

PS: Gravely mistake in your code, you never closed Connection after you finished with DB
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC