Newbie : Complete Connect java program to DB2
Dear all,
I am failry versed with java and jdbc. I did a lot of google and searched a lot of forums but no one gave me all the details. I have done a lot of oracle jdbc. I would appreciate if some one could give me all the details please. I dont even know which jar files should be in the classpath.
Oracle Comparision :
place ojdb14.jar in classpath
Class.forName("oracle.jdbc.driver.OracleDriver");
// Create a connection to the database
String serverName ="127.0.0.1";
String portNumber ="1521";
String sid ="oracle";
String url ="jdbc:oracle:thin:@" + serverName +":" + portNumber +":" + sid;
String username ="scott";
String password ="tiger";
connection = DriverManager.getConnection(url, username, password);
// Create a result set containing all data from my_table
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM sometable");
I am just about clueless on db2 .. (was able to scape through the install and the install is fine.).... to the limit that I hope my db2 is running on port 50000.
TIA
# 2
> Dear all,
>
> I am failry versed with java and jdbc. I did a lot
> of google and searched a lot of forums but no one
> gave me all the details. I have done a lot of oracle
> jdbc. I would appreciate if some one could give me
> all the details please. I dont even know which jar
> files should be in the classpath.
>
> Oracle Comparision :
> place ojdb14.jar in classpath
> >
> lass.forName("oracle.jdbc.driver.OracleDriver");
> // Create a connection to the database
> String serverName = "127.0.0.1";
> String portNumber = "1521";
> String sid = "oracle";
> String url = "jdbc:oracle:thin:@" +
> serverName + ":" + portNumber + ":" + sid;
>String username = "scott";
> String password = "tiger";
> connection = DriverManager.getConnection(url,
> username, password);
> // Create a result set containing all data
> from my_table
> Statement stmt =
> connection.createStatement();
> ResultSet rs = stmt.executeQuery("SELECT *
> FROM sometable");
>
> am just about clueless on db2 .. (was able to scape
> through the install and the install is fine.).... to
> the limit that I hope my db2 is running on port
> 50000.
>
> TIA
Hello Sarvanand,
You seem a champ in JDBC-ODBC programming...
I am fairly new in this .....
I am writing a basic code in java to connect to oracle 9iR2 database...
following are my questions
1) for oracle 9i ,is the jar file same ...i.e.. ojdb14.jar .
2)Do i need to create a driver first and then used it
i.e ...class.forName("oracle.jdbc.driver.OracleDriver");
here OracleDriver is your drivername existing on the server ? is'nt it ?
if yes could you provide me instructions to create this driver in WINXP ?
Please let me know .
ta
sunny