Login to Your Account

Results 1 to 4 of 4

Thread: Data base Connectivity

  1. #1

    Heart 32 Data base Connectivity

    can anyone help us in connecting javascript to connect database

  2. #2

    Re: help me

    hie friend cant connect javascript with database but we can connect java with database dude

  3. #3

    Re: help me

    can u tell me how to connect to ms access

  4. #4

    Re: help me

    here is the sample JDBC code in java with ms-access database 1.Create a database in ms access and add a table 2.Add columns to the table.(Acc to requirement if SELECT command is used in code add data in table if not keep it blank for the runtime insertion in it) 3.Go to control panel->Administrative Tools->JDBC-> System DSN 4.In System DSN tab click on add ,choose Microsoft access driver ,then you will get a dialog box opened ODBC Microsoft access setup mention the data source name in it and in databases click on select button and choose your .mdb file that is created in step1. NOTE:close all the releated windows behind 5.Register the driver using Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 6.Connect to the database Connection con = DriverManager.getConnection(URL,userid,password); userid and password are empty in case of MS access. If it oracle default userid is "scott" password is "tiger". Ex: Connection con = DriverManager.getConnection ("Jdbc:OdbcSName","",""); ----------------------------------------------------------- import java.sql.*; import*; import java.lang.*; class JdbcDemo1 { Connection con; Statement stmt; ResultSet rs; JdbcDemo1() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection( "Jdbc:Odbctd", "",""); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM student"); while ( { String x = rs.getString("sname"); int s = rs.getInt("sid"); System.out.println("x:"+x + "s:"+s); } } catch(SQLException e) { System.out.println("Hello World!"+e); } catch(ClassNotFoundException e) { System.out.println("no coloumn found"+e); } } public static void main(String args[]) { new JdbcDemo1(); } }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Share anywhere and get download.