hello all i have oracle 8 installed in my system which i want to connect with my JDK1.3 here i passing the following string in DriverManager.getConnection "jdbc dbc:thin:@(here i have to pass host string what is this?):1521 rcl8" can any one tell me what is this host string whether it is machine name or some thing else here is the following code: import java.sql.*; import oracle.jdbc.driver.*; class tryjdbc { public static void main(String args[]) thorws Exception { try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url="jdbc racle:thin:@(host string?):1521 rcl"; Connection con=DriverManager.getConnection(url,"scott","tiger"); Statement stmt=con.createStatement(); stmt.executeUpdate("CREATE TABLE BOOKS"+"(BOOK_NAME VARCHAR(32), SUP_ID INTEGER,PRICE FLOAT," +"SALES INTEGER,TOTAL INTEGER)"); stmt.executeUpdate("INSERT INTO BOOKS"+"VALUES('JAVA',101,450.00,0,0)"); } catch(Exception e) { System.out.println(e); } } }
Smita Tyagi
Greenhorn
Joined: May 09, 2001
Posts: 21
posted
0
Hello Dhiraj, You must put a database name after the @ sign in the connection URL.You can use either the fully specified SQL*net syntax or a short cut syntax as <host>:<port>:<sid>. Smita
dhirajsrivastava
Greenhorn
Joined: May 12, 2001
Posts: 9
posted
0
hello smita can u please tell me what is the concept of host string may i write localhost as host string and one thing more for connection b/w java and ms-accsess this driver is valid. Thanks dhiraj
Ambrose Tati
Ranch Hand
Joined: Oct 03, 2000
Posts: 55
posted
0
I use the following: String URL = "jdbc racle:thin:@host:1521:SID"; host: is what your machine is known as SID: is the SID of the Oracle you want to connect to Note that 1521 is the default Port number. If your system has been set up so that Oracle lisnens for connections on a specific port number change it to that port number, otherwise stick to the default one. Hope it works Cheers Ambrose Tati
Originally posted by dhirajsrivastava: hello smita can u please tell me what is the concept of host string may i write localhost as host string and one thing more for connection b/w java and ms-accsess this driver is valid. Thanks dhiraj
[This message has been edited by Ambrose Tati (edited May 14, 2001).]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.