I've never done anything with JDBC or much with Oracle, but I've connected to my jdbc this way:
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "xxx.xx.xx;
String portNumber = "1521";
String sid = "mysid";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber
+ ":" + sid;
String username = "PGSWLOG";
String password = "PGDEV";
connection = DriverManager.getConnection(url, username, password);
Now what classes do i need to use to insert tables into the database? Any help would be appreciates. TIA
When you wrote insert tables into the database, did you mean
1) Create a new table in DB, or
2) Add new row(s) into an existing DB table?
In either case, read the tutorials posted by @Marcelo Hernández Ris and then follow with the good examples for JDBC and Sql92 syntax on http://www.java2s.com/.
You need the PreparedStatement class: http://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html
And from the Java Tutorials: http://download.oracle.com/javase/tutorial/jdbc/basics/prepared.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With