dcsimg
jdbc connectivity
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dimple_prajapati
Posted On:   Wednesday, January 25, 2006 05:04 AM

how can fetch data from oracle database in html form in jsp using jdbc driver in java format Please use html tags to format code blocks. import java.io.*; import java.sql.*; class dbAccess { public static void main (String args[]) throws SQLException { DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); /*Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@hostname:1526:orcl", "scott", "tiger"); try this connection*/ Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@10.127.240.206:1521:orcl", "scott", "tiger"); // @machineName:   More>>

how can fetch data from oracle database in html form in jsp using jdbc driver in java format


Please use html tags to format code blocks.
import java.io.*;
import java.sql.*;
class dbAccess {
public static void main (String args[]) throws SQLException
{
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

/*Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@hostname:1526:orcl", "scott", "tiger");
try this connection*/
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@10.127.240.206:1521:orcl", "scott", "tiger"); // @machineName:port:SID, userid, password

Statement stmt = conn.createStatement();
// int f=Integer.parseInt(args[0]);
System.out.println(args[0]);
String s=args[0];
ResultSet rset = stmt.executeQuery("select srno from emp where ename=s ");
while (rset.next())
{
System.out.println(rset.getString(1));
//System.out.print(rset.getstring(6)); // Print col 1
}
stmt.close();
}
}

   <<Less

Re: jdbc connectivity

Posted By:   WarnerJan_Veldhuis  
Posted On:   Wednesday, January 25, 2006 05:21 AM

What's the problem? Does your code run? Does your code compile? Does it give the wrong results?? Tip: String values should be quoted n a query: "select srno from emp where ename='s'".
About | Sitemap | Contact