Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java code to execute a query string in oracle?

 
Jyothsna Sri Y
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,
Can someone tell me the syntax of the java statements to run a command for ORACLE database?
Also provide database connection code...
Eg: Given a few details, as below, to run a query on a database that exists on ip :"172.20.20.32" login :"myself" passwd :"newpass" dns :"newtest" DBNAME :"DB1".
The code should be independent of platform, able to run on any OS.
Please, also explain how to connect if the db is on the local system.
It's very urgent!!! Please get back asap.

Thanks
Jyothsna.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ensure you have your driver (classes12.jar) in your classpath. For more help you can also refer to this link.
[ November 19, 2003: Message edited by: V�r�n Kha�n� ]
 
Jyothsna Sri Y
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
Thanks a lot for the code.
Can u also tell me how to set up the oracle DB in linux and access a Db from another machine on the network?
I'm provided with these details: oraclesource=Joe1 oracleuser=joey oraclepassword=joe123.WHere am I supposed to use these values.
Thanks
Jyothsna.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm provided with these details: oraclesource=Joe1 oracleuser=joey oraclepassword=joe123.WHere am I supposed to use these values.
Thanks
Jyothsna.
You will need the info in the code :
Connection con = DriverManager.getConnection(url, myLogin, myPassword);
for you:
myLogin = joey
myPassword = joe123
for url .. check out this link.
Hey,
Can u also tell me how to set up the oracle DB in linux and access a Db from another machine on the network?

Could have answered if this site was www.oracleranch.com , anyways have u tried googling? like
this
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using the oracle site's documentation Oracle9i JDBC Developer's Guide and Reference. You have to register with Oracle, but the information is well worth it!
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic