[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

how to insert data in oracle 10g using java code

how to insert data in oracle 10g using java code??
I tried this link but no output shows when I run the code!!
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/namedparam/usingoraclenamedparameterapis.html#use

I want simple tutorial or code to show that
0
fm134
Asked:
fm134
  • 2
  • 2
1 Solution
 
mrcoffee365Commented:
The  link you provided  is to a simple tutorial and code.

Did you follow all of the instructions?  You created a table, inserted records (and it was committed, right?)?

Then compile your code, make sure that your database connection string goes to the database you just created the table and data in?

If you think you did all of that, post the code you wrote, and the output you got (e.g., if you ran it from a command line, then the command line.  If from an IDE, then the console log).
0
 
fm134Author Commented:
>>Did you follow all of the instructions?  You created a table, inserted records (and it was committed, right?)?
yes
>>Then compile your code, make sure that your database connection string goes to the database you just created the table and data in?
How can I make sure that it goes to my database.I only change the connection string.
// Set database URL details.
String url = "jdbc:oracle:thin:@localhost:1521:orcl";

// Get the database connection.
conn = DriverManager.getConnection(url,"system","pass");

I tried the exapmle code in the link and no out put coms!!

the run::
C:\>java oracle.otnsamples.jdbc.UsingOracleNamedParameters

C:\>
0
 
fm134Author Commented:
gusses what
I have to insert
sql>commit;
after I insert my data in the database?? why??
0
 
mrcoffee365Commented:
Is this the first time you have used a database?  Or maybe the first time you've used Oracle?

See this short documentation on committing transactions to Oracle:
http://www.adp-gmbh.ch/ora/concepts/transaction.html

If it worked for you, then that's great.  And now you know more about the basics of using Oracle, too.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now