Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How set the properties of the Oracle DataSource? Thank you very much!

11171Mar 22 2004 — edited Mar 24 2004
Hi, everyone:
I wrote a JDBC code as follows,

import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.*;
......
OracleDataSource ods = new OracleDataSource();
ods.setServerName(<myhost>);
ods.setDatabaseName(<DB SID>);
ods.setDriverType("oci");
ods.setNetworkProtocol("tcp");
ods.setPortNumber(1521);
ods.setUser("scott");
ods.setPassword("tiger");

Connection conn = ods.getConnection();
......

if I set the value of the setDriverType is "thin" then the code is no errors at run time, but now , run to the line

Connection conn = ...

it will display the exception message

Exception in thread "main" java.lang.NoSuchFieldError: envCharSetID
at oracle.jdbc.oci8.OCIEnv.get_env_handle(Native Method)
......

Sorry, I do not understand the error message and how correct the code.
Please teach me, Thank you very much!!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 21 2004
Added on Mar 22 2004
6 comments
12,126 views