GeekInterview.com
Series: Subject: Topic:
Question: 23 of 148

JDBC Type1 drivers

Can we use Type1 driver in web Application?

If possible give me a simple example for all driver types?
Asked by: jagadesh05 | Member Since Dec-2007 | Asked on: Dec 22nd, 2007

View all questions by jagadesh05

Showing Answers 1 - 9 of 9 Answers
sampra

Answered On : Feb 11th, 2008

View all answers by sampra

Yes we can use Type 1 driver for web application but here need to load lot of DB libaray

  
Login to rate this answer.
sampra

Answered On : Feb 11th, 2008

View all answers by sampra

if u want example then mail me  

  
Login to rate this answer.
gottiparthy

Answered On : Feb 13th, 2008

View all answers by gottiparthy

I want one Example with JDBC  Type1 drivers

  
Login to rate this answer.
sampra

Answered On : Feb 13th, 2008

View all answers by sampra

can u gv me ur mail id

  
Login to rate this answer.
sampra

Answered On : Feb 13th, 2008

View all answers by sampra

Java Test


/*create table student

(

sid number(5),

sname char(15),

email char(15),

phone number(12)

); */

import java.sql.*;

class Test

{

public static void main(String as[])

{

try{

int sid=Integer.parseInt(as[0]);

String sname=as[1];

String email=as[2];

long phone=Long.parseLong(as[3]);

//step 1-load the class

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

//step 2-establish the connection

Connection con=DriverManager.getConnection("jdbc:odbc:studentDSN","scott","tiger");

//step 3 create the statment

Statement st=con.createStatement();

//step 4 prepare sql queary and execute

String sql="insert into student values("+sid+",'"+sname+"','"+email+"',"+phone+")";

int x=st.executeUpdate(sql);

//step 5..process result

if(x==1)

{

System.out.println("Inserted...");

}

else

{


System.out.println("Not.Inserted");

}

//step 6-clean up

st.close();

con.close();

}catch(Exception e)

{

e.printStackTrace();

}


}

}

  
Login to rate this answer.
sampra

Answered On : Feb 13th, 2008

View all answers by sampra

i can not post whole code bcz geek person wont allow it better gv ur mail id

  
Login to rate this answer.
sampra

Answered On : Feb 13th, 2008

View all answers by sampra

samsampra at gmail my mail id

  
Login to rate this answer.

There are four types of JDBC drivers, Type1 driver is not purely java driver, here we can uploaded so many databse libraries ( these are the middleware softwares).So better to use type-4 driver (also called Oracle thin driver )

  
Login to rate this answer.

Yes , u can use JDBC type-1 driver for web application but here need to upload many Database libraries for middleware interaction purpose.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.