Rob Lyon

Greenhorn
+ Follow
since Nov 29, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rob Lyon

Thanks Ali, it worked great.
23 years ago
Does oracle or SQL have any special functions for seperating data that are already in columns?
Example:
In my oracle database I have a column named AUTHOR which recieved values like 'JoeTheAuthor, 1998.' when I loaded everything in from a tab delimited file. I am in the process of normalizing all the tables and that calls for splitting up the data in that column into two seperate columns. How do I get the year out of the column to put it in another column and then delete the year, comma and period out of the AUTHOR column?
Thanks in advance.
23 years ago
You can also use the Net8 Assistant that comes with 8i. It provides a nice GUI interface into the information in those files.
23 years ago
You can also look in the 'tnsnames.ora' network configuration file found in the oracle/ora81/network/admin folder. That will list all the SID's and atributes associated with them.
23 years ago
Sorry I didn't realize you have to turn off smiles. Here's what the smiles messed up:
String url = jdbc:oracle:TYPE:@DATABASE_NAME;
****and****
url(or ip):port:SID
23 years ago
First of all find your drivers, mine were located in <DRIVE>:\Oracle\Ora81\jdbc\lib\classes12.zip, and add them to your classpath so you can reference them in the import statements
Next, register the driver using the statement using:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Then define the connection by using:
String url = jdbc racle:TYPE:@DATABASE_NAME;
/**Replace TYPE with either 'thin' or 'oci8' depending on the driver that you're wanting to use. They both have different pro's and con's depending on what you are using them for. You can find more info at oracle.com. Replace the database name with the name of the database in the TSNNAMES file that you need to access. If you need to access the database remotely, then replace it with url(or ip) :port:SID. Ex. 127.0.0.1:1521:MYDATABASE (1521 is the default port for Oracle) and next.....*/
String username = your_username;
String password = your_password;
/**that one's easy, they are just your username and password for that database, then finally....*/
Connection con = DriverManager.getConnection(url, username, password);
/**this creates the connection object and you are now connected to the database of your choice*/
After you have the connection you need to create your statement object:
Statement stmt = con.createStatement();
Then use these to execute the SQL statements:
stmt.executeUpdate(Your_Update_String);
or stmt.execute(Your_String);
or stmt.executeQuery(Your_Query_String);

JDBC commits the data automaticaly so if you need or want to commit transaction manually then you can set the auto commit to false before you create the statement using:
con.setAutoCommit(false)
and after your transaction is complete you can commit it by using con.commit() and if the SQL statement fails you can place a con.rollback() in your catch statement to roll back any partial changes to the data.
Hope that helps out.
Disabled smiles in this post
[This message has been edited by Desai Sandeep (edited November 30, 2001).]
23 years ago
This is quite late, but I just happened to stumble across your question. The reason why you're getting that error is when you defined your query you used '(' and ')' to surround your query. Oracle JDBC drivers don't like that, even though it may work in other direct queries to the database from SQL *Plus or other oracle clients.