This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Converting a JDBC app from  MySQL to Oracle 9 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Converting a JDBC app from  MySQL to Oracle 9" Watch "Converting a JDBC app from  MySQL to Oracle 9" New topic
Author

Converting a JDBC app from MySQL to Oracle 9

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
I have an app I want to convert to Oracle 9. But I am not sure what settings I need, and what needs to go into my classpath.


Here is a simplified version...

import java.sql.*;
import com.mysql.jdbc.Driver;

public class DBTest{

public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
java.sql.Connection con;
con = DriverManager.getConnection("jdbc:mysql:///customer", "root", "");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("Select * from names");

while(rs.next()){
System.out.println(rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3));
}

rs.close();
st.close();
con.close();


} catch (SQLException se){
System.out.println("MYSQL: " + se);
} catch (Exception e) {
System.out.println("Excep : " + e);
}

}
}
Akshatha Nayak
Ranch Hand

Joined: Jul 15, 2004
Posts: 53
hi

if u have installed oracle properly & if u r using thin client .. then u need to put classes12.jar in ur claspath .. & run this program ... if it runs properly displaying all the metadata .. then everything is fn .. see how they have connecte to oracle u have to use change host & databasename & enter whatz in ur oracle ..


Only those who will risk going too far, Can possibly find out how far one can go! <br />happiness is journey and not destination<br /> <br />A Nayak<br />----------------------------------<br />SCJP 1.4<br />SCWCD 1.3<br />SCBCD 1.3
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
Thanks, but what does this mean?

static final String dbURI = "jdbc racle:thin:@host atabasename";
Akshatha Nayak
Ranch Hand

Joined: Jul 15, 2004
Posts: 53
that is the url you r using to connect to ur oracle database ..
it is jdbc racle:thin@<hostname>:<databasename>
checkout this site http://www.javaskyline.com/learnjdbc.html
Akshatha Nayak
Ranch Hand

Joined: Jul 15, 2004
Posts: 53
also check out this site

http://www.informit.com/articles/article.asp?p=26251&seqNum=3
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
It works, Akshatha. Thank you for your help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Akshatha Nayak,

JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

thanks,
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: Converting a JDBC app from MySQL to Oracle 9