This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes java code to execute a query string in oracle? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "java code to execute a query string in oracle?" Watch "java code to execute a query string in oracle?" New topic
Author

java code to execute a query string in oracle?

Jyothsna Sri Y
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
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

Joined: May 30, 2002
Posts: 1400

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� ]

- Varun
Jyothsna Sri Y
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
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

Joined: May 30, 2002
Posts: 1400

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

Joined: Jul 09, 2001
Posts: 1879

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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: java code to execute a query string in oracle?
 
Similar Threads
how to execute complex queries
is there a limit on the number of records returned by queryForList method of SqlMapClientTemplate?
Problem is Parallel Processing of Jobs in Java
Update Table Nested Query (Using Function)
Creating Database Connection profile using connection url