How to connect SqlServer 2000 In J2EE1.2
I am chiniese,I am sorry for my poor english!
I have set up the JDBC driver,and set up the J2EE sever.
But when we make a Enity EJB,and use the "Deployment Seting",and then "Generate SQL Now "
,it tells me that there is no "suitale driver",
I send the "default.properties" to you.
Please tell what wrong .
# JDBC Driver Examples:
# Oracle thin driver: oracle.jdbc.driver.OracleDriver
# Merant driver: intersolv.jdbc.sequelink.SequeLinkDriver
# Cloudscape driver: COM.cloudscape.core.RmiJdbcDriver
jdbc.drivers=COM.cloudscape.core.RmiJdbcDriver
jdbc.dirvers=com.microsoft.jdbc.sqlserver.SQLServerDriver
# JDBC URL Examples:
# Oracle thin driver:
# jdbc:oracle:thin:@<host>:<port>:<sid>
# Cloudscape RMI driver:
# jdbc:cloudscape:rmi:<database>;create=true
# Merant driver:
# jdbc:sequelink://<host>:<port>/[SQLServer];Database=<database>
jdbc.datasources=jdbc/sqlServer|jdbc:microsoft:sqlserver://(local):1433;Database=music
#jdbc.datasources=jdbc/sqlServer|jdbc:odbc:RegisterDataSource|jdbc/Cloudscape|jdbc:cloudscape:rmi:CloudscapeDB;create=true
passivation.threshold.memory=128000000
idle.resource.threshold=600
user.transaction.jndiname=java:comp/UserTransaction
log.directory=logs
log.output.file=output.log
log.error.file=error.log
log.event.file=event.log
distributed.transaction.recovery=false
transaction.timeout=0
sessionbean.timeout=0
# DataSource configuration for JDBC 2.0 XA drivers only
#jdbc20.datasources=jdbc/Merant|jdbc/XAMerant
#xadatasource.0.jndiname=jdbc/XAMerant
#xadatasource.0.classname=com.merant.sequelink.jdbcx.datasource.SequeLinkDataSource
#xadatasource.0.dbuser=<dba user>
#xadatasource.0.dbpassword=<dba password>
#xadatasource.0.prop.url=jdbc:sequelink://<host>:<port>/[Oracle]
# DataSource configuration for JDBC 2.0 XA drivers only
in windows 2003,i have set the envirenment
I use the jdk1.3
the j2eesdk1.2
I want to use JDBC 2.0 but I don't know how to config
The userconfig.bat is:
rem J2EE_CLASSPATH is appended to the classpath referenced by the EJB server.
rem J2EE_CLASSPATH must include the location of the JDBC driver classes
rem (except for the Cloudscape driver shipped with this release).
rem Each directory is delimited by a semicolon.
rem
set J2EE_CLASSPATH=C:\j2sdkee1.2\lib\msbase.jar;C:\j2sdkee1.2\lib\mssqlserver.jar;C:\j2sdkee1.2\lib\msutil.jar
rem
rem JAVA_HOME refers to the directory where the Java(tm) 2 SDKrem Standard Edition software is installed.rem
set JAVA_HOME=C:\jdk1.3
rem
# JDBC Driver Examples:
# Oracle thin driver: oracle.jdbc.driver.OracleDriver
# Merant driver: intersolv.jdbc.sequelink.SequeLinkDriver
# Cloudscape driver: COM.cloudscape.core.RmiJdbcDriver
jdbc.drivers=COM.cloudscape.core.RmiJdbcDriver
jdbc.dirvers=com.microsoft.jdbc.sqlserver.SQLServerDriver
# JDBC URL Examples:
# Oracle thin driver:
# jdbc:oracle:thin:@<host>:<port>:<sid>
# Cloudscape RMI driver:
# jdbc:cloudscape:rmi:<database>;create=true
# Merant driver:
# jdbc:sequelink://<host>:<port>/[SQLServer];Database=<database>
#jdbc.datasources=jdbc/sqlServer|jdbc:microsoft:sqlserver://(local):1433;Database=music
#jdbc.datasources=jdbc/sqlServer|jdbc:odbc:RegisterDataSource|jdbc/Cloudscape|jdbc:cloudscape:rmi:CloudscapeDB;create=true
passivation.threshold.memory=128000000
idle.resource.threshold=600
user.transaction.jndiname=java:comp/UserTransaction
log.directory=logs
log.output.file=output.log
log.error.file=error.log
log.event.file=event.log
distributed.transaction.recovery=false
transaction.timeout=0
sessionbean.timeout=0
# DataSource configuration for JDBC 2.0 XA drivers only
jdbc20.datasources=jdbc/sqlServer
xadatasource.0.jndiname=jdbc/sqlServer
xadatasource.0.classname=com.microsoft.jdbc.sqlserver.SQLServerDriver
xadatasource.0.dbuser=music
xadatasource.0.dbpassword=music
xadatasource.0.prop.url=jdbc:microsoft:sqlserver://(local):1433;DatabaseName=music
# DataSource configuration for JDBC 2.0 XA drivers only
Similar Messages
-
How to connect CFP-2000 with Measuremen​t Studio
Hi, I have already posted this question into Measurement Studio for VC++ group but probably the right one is this.
I haven't understood how to connect a CFT-2000 module with Measurement Studio and VC++.
Can any one help me to find documentation and sample related this task?
I'm interested into this topics:
- is it possible to manage a CFT-2000 ethernet device with MAX? In ordere to use that device can i use DAQmx?
- which kind of data I will receive over ethernet raw, scaled..
- is it possible to select one particular board of AI?
- is it possible to execute multiple application (LabView and measurement Studio) connected with the same CFTP-2000 controller into one PC?
Any help is appreciate
Thanks
RobertoRavens Fan wrote:
It's also possible that you messed up the experiment!
That's True.
But a good experiment shuold always be falsifiable.
FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman -
How to connect sqlserver use oracle sql developer?
I created a non-oracle location connection in owb and can load data from sqlserver to warehouse. Now, I want to use sqlplus or sqldeveloper to connect sqlserver directly, But I got this error message"ora-03135:connection lost contact".
How can I connect sqlserver in sqldeveloper or sqlplus?
ThanksHi Napo,
SQLDeveloper can migrate to oracle, browse sqlserver and run and display results from single statements.
I have not seen "ora-03135:connection lost contact" have you set up sqlserver for tcp/ip connection, checked the port is open (and not blocked by, for example, firewalls) and used the jtds driver to connect SQLDeveloper to sqlserver?
Note that "ora-03135:connection lost contact" is an oracle error and does not seem related to sqlserver.
Oracle also has heterogenous gateway products which may be useful
Oracle® Database Gateway for SQL Server User's Guide
http://download.oracle.com/docs/cd/B28359_01/gateways.111/b31049/toc.htm
-Turloch -
How to connect Sql Server 2000 using JDBC ODBC Driver
How to connect Sql Server 2000 using JDBC ODBC Driver ?
plz Send Syntax.
thanksIn SQL Server 2000 the driver class is com.microsoft.jdbc.sqlserver.SQLServerDriver
The connection URL for the default SQL Server 2000 database is jdbc:sqlserver://localhost:1433
Class.forName(
"com.microsoft.sqlserver.jdbc.
SQLServerDriver");
String url =
"jdbc:sqlserver://localhost:1433";
Connection conn = DriverManager.
getConnection(
url, "sa", "sqlserver"); -
Hang process mamping connect to sqlserver 2000
Help me
Problem this, before one weeks , process mapping connect to sqlserver still running
but, after this process mapping hang get data from sqlserver 2000
because i try 10, 100, 5000 record mapping still running, but 100000 record still hang, this is i try method row_bases.
and i try method set based, data still empty in target (4 hours)
this data from sqlserver +/- 1600000 record,
how to solve problem this.
owb client 11.1.0.6.0
owb repository 11.1.0.1.1
db ver 11.1.0.6
db sqlserver 2000
OS Window NT 2000
Txdo you mean the url?
it seems to be right.
the server is on THE_B
the instance is MIAINSTANCE
(when i've installed the DBMS i've specified "miaInstance" as instance name,but whe I access to it I see MIAINSTANCE as name.it can be a case sensitive problem?)
i've specified the following URL
...sqlserver://THE_B\MIAINSTANCE:1433;SelectMethod=....
i've also tryed
...sqlserver://THE_B\miaInstance:1433;SelectMethod=....
but it still doesen't work.
yes,the instance is running. -
Oracle to sqlserver 2000 connection
Hi
I recently made a connection from oracle9i (solrais 10) to sql server 2000(V 8.0).
I'm encountering following issue, if someone could help me that would really great.
SQL Error: ORA-28536: error in processing Heterogeneous Services initialization parameters
ORA-28508: invalid value TITANSTAGE for Heterogeneous Services initialization parameter HS_DB_NAME
ORA-02063: preceding 2 lines from TITANSTAGE
28536. 00000 - "error in processing Heterogeneous Services initialization parameters"
*Cause: An error described by a subsequent error message
prevented successful processing of Heterogeneous Services
initialization parameters from the ORACLE server data dictionary.
*Action: Check server data dictionary views HS_CLASS_INIT, HS_INST_INIT, and
HS_ALL_INITS. Look for conditions which could produce
the error identified in the error message immediately
following this one.
Below is the listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = shark)(PORT = 1521))
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = shark)(PORT = 1523))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = hsmsql)
(ORACLE_HOME = /z01/app/oracle/product/9.2.0.7)
(PROGRAM = hsodbc)
(SID_DESC =
(PROGRAM = hsodbc)
(ORACLE_HOME = /z01/app/oracle/product/9.2.0.7)
(SID_NAME = ititanstage)
Tnsnames.ora
hstitanstage=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = 135.63.14.54)
(PORT = 1521)
(CONNECT_DATA =
(SID =ititanstage)
(HS=)
Value from initititanstage.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
# HS init parameters
HS_FDS_CONNECT_INFO = titan
HS_DB_NAME = TITANSTAGE
#HS_DB_DOMAIN= 10.32.130.52
#HS_FDS_TRACE_LEVEL = 4
HS_FDS_SHAREABLE_NAME=/usr/openlink/lib/libiodbc.so
HS_FDS_TRACE_FILE_NAME = /tmp/HSODBC/iniths9i.trc
#HS_OPEN_CURSORS=2
# ODBC specific environment variables
set ODBCINSTINI=/usr/openlink/bin/odbcinst.ini
set ODBCINI=/usr/openlink/bin/odbc.ini
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
set OPENLINKINI=/usr/openlink/bin/openlink.ini
set FREETDSCONF=/usr/openlink/bin/freetds.conf
set OPL_LICENSE_DIR=/usr/openlink/bin
set LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/openlink/lib
set PATH=$PATH:/usr/openlink/bin
odbc.ini
[titan]
Driver = /usr/openlink/lib/sql_mt_lt.so
ServerType = SQLServer 2000
Username = reader
Password = reader
Database = titanstage
Options = -H 135.63.14.153 -P 1433 -V 8.0
FetchBufferSize = 99
ReadOnly = no
DeferLongFetch = no
JetFix = no
Description = Titanstage SQLServer 2000 Lite ConnectionIts good to you,
I am having a similar problem: I get ORA-28508 from oracle gateway. When I try to connect mssql server from sqlplus.
Everything goes fine when I connect on port 1433. So I think the root of my problem is that I specify the port number in the wrong way:
HS_FDS_CONNECT_INFO="address='hostname/instancename' port='1106'"
If your problem was similar or the same, then you could help me by by posting your solution.
Cheers,
Adam Balogh
DBA -
How to connect Java and Microsoft SQL Server 2000
hi,
could anyone please teach me how to connect Java and SQL Sever 2000?? if possible could you guys provide me with an example??? i could hardly find any relevant resources about it...
Thanks ~!thanks for the information...
by the way hv any working module on it?? i'm new to
both Java and Microsoft SQL Server... Thanks againFirst things first... you should read this:
http://java.sun.com/docs/books/tutorial/jdbc/
This is microsofts official JDBC Driver: http://www.microsoft.com/sql/downloads/jdbcregister.asp
Install it and the documentation has some usage examples -
How to connect to SQL server 2000 with Oracle Form
Hi,
I'm looking for the document of how to connect "SQL Server 2000" with Oracle Form 6i. Anyone knows that?Shay or other knowledgeable folks,
Is there a way to utilize the wizard for "Business Tier > ADF Business Components > Business Components from Tables" for SQL Server 2000, 2005 or 2008. I can successfully execute sql via java programmatically or import a table from SQL Server with "Business Tier > ADF Business Components > Entity Object" wizard, but the Business Components from Tables simply doesn't see any tables under any schema. Without the "Business Components from Tables", i don't get the referential constraints imported into the application and to code all those from scratch is just not as elegant. So far i have only utilized the sql server jdbc driver from Microsoft (versions, 1.1, 1.2 and 2.0). Is there an alternative client that i need to use to enable selecting tables from that "Business Components from Tables" wizard. Is this a limitation of SQL Server, the jdbc driver or the wizard itself? Did anybody else experience the same issues? I am using Jdeveloper 11.1.1.0.1 against SQL Server 2005 (currently)
Thanks,
Andy -
How to connect jbuilder and sql 2000
i faced a problem of connecting sql 2000 and jbuilder 6...........thanks for the help
What was wrong with the advice you got here?
http://forum.java.sun.com/thread.jsp?thread=479209&forum=48&message=2229465
You asked this question two weeks ago. Have you done nothing in all that time?
You don't need JBuilder to develop Java. A newbie would be better off just using a text editor and compiling and running on the command line. JBuilder is just one more thing you don't understand.
Have you ever done JDBC before? If not, read this tutorial:
http://java.sun.com/docs/books/tutorial/jdbc/
You deserve to flunk that course if all you can manage in two weeks is to ask the same lame question again. - MOD -
How to connect to a specific database in SQL server
Hi,
How can I connect to a specific database in SQL server? I used the following statement. But my table is inserted to the 'master' database in the SQL server. How can I insert my tables to the specific database tahta I have created before?
Connection con;
String sURL = "jdbc:microsoft:sqlserver://SERVER_NAME:1433";
con = DriverManager.getConnection ( sURL, sUsername, sPassword);Hi,
When I use the syntax:
String sURL = "jdbc:microsoft:sqlserver://SERVER_NAME:1433/DATABASE_NAME;selectMethod=cursor";
it gives an error as follows:
problems connecting to jdbc:microsoft:sqlserver://SERVER_NAME:1433/DATABASE_NAME;selectMethod=cursor:
[Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.
What is the way to connect to a specific database? -
JDBC 2.0 method not implemented error using bea jDriver for MS-SQLServer 2000
I'm trying to reconfigure WebLogic Portal 7.0 (Platform 7.0 SP2) to run on MS SQLServer
2000. According to the supported platform docs, the MS JDBC driver is not supported
by Portal, hence I'm using the BEA jDriver for SQLServer.
I'm now getting the following error when starting up Weblogic Portal which requires
a re-sync with the EBCC before the applications will work.
<28-Aug-03 09:28:30 BST> <Error> <Data Synchronization> <000000> <Application:
portalApp; Corrupted data encountered in the persistent store; PLEASE RE-SYNCHRONIZE
YOUR APPLICATION DATA WITH MODE "refresh-from-client" BEFORE CONTINUING! Failure
to do so may result in incomplete or otherwise corrupted server state.
Exception[com.bea.p13n.management.data.repository.PersistenceException: Failed
to refresh JDBC Persistence Manager.] - with embedded exception: [java.sql.SQLException:
java.sql.SQLException: This JDBC 2.0 method is not implemented] at com.bea.p13n.management.data.repository.persistence.JdbcDataSource.refresh(JdbcDataSource.java:506)
Has anyone else come across this problem and know how to resolve it. I have tried
using the MS JDBC Driver on the off chance that it would work, but this also produced
SQL Exceptions with the persistance store and would not work at all even after
syncing with the EBCCJim,
Thanks, I'm awaiting for my account to be enabled with customer contract support.
When this is done I will raise a case and send files as requested.
In the mean time it's worth noting that these settings have been made. Connection
to the DB is fine, the createDB, loadads, loaddocs and sync etc all worked fine.
The problem only exists when restarting the server and the portal persistance
store is trying to be refereshed. Once EBCC is re-synced all the DB access works
fine.
Steve
Jim Litton <reply@newsgroup> wrote:
Please open a support case and send in your set-environment.bat,
db_settings.properties, and config.xml from your domain directory after
trying the following.
Given that your operating system is Windows for performing all database
operations like create_db, loaddocs, sync. (because you should not
bother trying to run them on with UNIX).
Restore your set-environment.bat to it's original state. It does not
need to be touched.
Uncomment the MSSQL section in db_settings.properties.
database=MSSQL
db_version=2000
jdbcdriver=weblogic.jdbc.mssqlserver4.Driver
server=@MSSQL_SERVER@
port=@MSSQL_PORT@
dblogin=@MSSQL_USER@
dbpassword=@MSSQL_PASSWORD@
connection=jdbc:weblogic:mssqlserver4:@MSSQL_SERVER@:@MSSQL_PORT@
The dataSyncPool entry in config.xml should appear as:
<JDBCConnectionPool
Name="dataSyncPool"
DriverName="weblogic.jdbc.mssqlserver4.Driver"
URL="jdbc:weblogic:mssqlserver4:@MSSQL_SERVER@:@MSSQL_PORT@"
Properties="user=@MSSQL_USER@;password=@MSSQL_PASSWORD@"
Password="@MSSQL_PASSWORD@"
InitialCapacity="1"
MaxCapacity="5"
CapacityIncrement="1"
RefreshMinutes="99999"
ShrinkingEnabled="false"
Targets="sampleportalServer"
TestConnectionsOnReserve="false"
TestTableName="WEBLOGIC_IS_ALIVE"
/>
-- Jim -
[Microsoft][SQLServer 2000 Driver for JDBC] Broken pipe
Using 10.1.2.0.2
I have Web App in which I am connecting to MS SQLServer 2005. I have created a datasource on the server and used Microsoft's free JDBC drivers i.e. msutil.jar,mssqlserver.jar,msbase.jar. Now every now and then I am getting the following error when trying to connect to the SQLServer
[Microsoft][SQLServer 2000 Driver for JDBC]Broken pipe;nested exception is: java.sql.SQLException:[Microsoft][SQLServer 2000 Driver for JDBC]Broken pipeAny ideas what might be wrong and how to take care of this issue.
ThanksDataDirect driver is certified with Oracle Application Server accessing SQLServer, here is an example of a data source entry for SQLServer in OralceAS 10.1.2.x.
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="MerantDS"
location="jdbc/MerantCoreSSDS"
xa-location="jdbc/xa/MerantSSXADS"
ejb-location="jdbc/MerantSSDS"
connection-driver="com.oracle.ias.jdbc.sqlserver.SQLServerDriver"
username="test"
password="secret"
url="jdbc:oracle:sqlserver://hostname:port;User=test;Password=secret"
inactivity-timeout="30"
/>
Here shows a SQLServer managed data source example and a SQLServer native source example in OracleAS 10.1.3.x:
SQLServer Managed Data Source
<connection-pool name="ConnectionSqlserver"
max-connections="20"
min-connections="1">
<connection-factory
factory-class="com.oracle.ias.jdbcx.sqlserver.SQLServerDataSource"
user="msuser"
password="mspass"
url="jdbc:oracle:sqlserver://myserver\\myinstance;User=msuser;Password=mspass" >
<property name="serverName" value="myserver\\myinstance"/>
<xa-recovery-config>
<password-credential>
<username>msuser</username>
<password>mspass</password>
</password-credential>
</xa-recovery-config>
</connection-factory>
</connection-pool>
<managed-data-source connection-pool-name="ConnectionSqlserver"
jndi-name="jdbc/mysqlserver"
name="mysqlserver" /> -
Which jdbc driver should be used for sqlserver 2000 and where to put it.
hi all,
My odi is 11g. I met the error infor "Could not load JDBC driver class [com.microsoft.sqlserver.jdbc.SQLServerDriver]" when i tried to connect to a sqlserver2000 database.
The questions are:
1. which jdbc driver should be used for sqlserver 2000?
2. which folder to put it in?
3. how to set the physical topological "Microsoft Sql Server" to use this jdbc driver?
failed tries:
i downloaded the driver "SQL Server 2000 Driver for JDBC Service Pack 2" and put it in the following folders:
1. .../oracledi/drivers, and set this path to CLASSPATH.
2. .../oracledi/userlib didn't exist, i created it and put the driver in.
3. .../oracledi/agent/dirvers, in which a readme file exists and told me to put drivers in this folder.
All these works were not useful. when I start odi.sh and try to connect to sqlserver2000 database, the same error infor came up.
my environment is:
os: Linux 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
java: Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
ODI: 11g, installed in /users/oracle/odi/
please help me,thanks a lot.
jun
帖子经 Jun编辑过Hi,
You should check which JVM version is required by that version of the driver, I think the 2.x versions require a 1.6 JVM
What error are you getting? If it is the "com.sunopsis.sql.c: No suitable driver", it indicates it can't find the jar file (sqljdbc.jar) for the driver you specify.
Drivers folder in ODI 11g is under
C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi\agent\drivers.
if you are using the standolone version
On windwos :
C:\Documents and Settings\<userName>\Application Data\odi\oracledi\userlib
on linux
$HOME/.odi/oracledi/userlib
Have a read of :- http://download.oracle.com/docs/cd/E14571_01/core.1111/e16453/install.htm#CHDBIFAJ
Thanks,
Sutirtha -
Problem in Accession inner join with [Microsoft][SQLServer 2000 Driver
Hi
Can you tell me what can be cause my sql statement is correct gives result but
if i used below statement in my JSP ,cause error
1)
ps1=connection.prepareStatement("select RQM_IN_RQSTN_ID_PK,RQD_IN_ITM_ID_FKPK,RQD_VC_ITM_DSCRPTN,RQD_IN_STTS_ID_FK,C.SMT_VC_STTS_NM,a.RQM_DT_PRPSD_DLVRY_DT"+
"from PAS_RQM_RQSTN_MSTR a "+
"inner join PAS_RQD_RQSTN_DTLS b on a.RQM_IN_RQSTN_ID_PK = b.RQD_IN_RQSTN_ID_FKPK and RQD_IN_STTS_ID_FK = 4"+
"INNER JOIN PAS_SMT_STTS_MSTR C ON C.SMT_IN_STTS_ID_PK=B.RQD_IN_STTS_ID_FK" +
"where a.RQM_VC_DTRTMNT_INVLV='Technology' ");
2) Error Generate
java.sql.SQLException
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near 'a'.
What can be the cause
Thanksps1=connection.prepareStatement("select
RQM_IN_RQSTN_ID_PK,RQD_IN_ITM_ID_FKPK,RQD_VC_ITM_DSCRP
TN,RQD_IN_STTS_ID_FK,C.SMT_VC_STTS_NM,a.RQM_DT_PRPSD_D
LVRY_DT"+
"from PAS_RQM_RQSTN_MSTR a "+
"inner join PAS_RQD_RQSTN_DTLS b on
a.RQM_IN_RQSTN_ID_PK = b.RQD_IN_RQSTN_ID_FKPK and
RQD_IN_STTS_ID_FK = 4"+
"INNER JOIN PAS_SMT_STTS_MSTR C ON
C.SMT_IN_STTS_ID_PK=B.RQD_IN_STTS_ID_FK" +
"where a.RQM_VC_DTRTMNT_INVLV='Technology' ");This is a problem due to not providing spaces where they are needed. See the places where I have highlighted.
A better way is to generate the String first [use StringBuffer as a good practice for appending instead of String "+"] and print it out to check if it is correct.
***Annie*** -
Who can explain how EJB connect to Oracle9i DB with DataSource?
I have taken 4 days into this problem. I am developing EJB with J2EE1.3 and Oracle9i DB, I can connect to DB in code with DriverManager. But I want to use DataSource to connect to DB. I failed, I can not get new way to resolve it when I after try to connect with javax.sql.DataSource, oracle.jdbc.pool.OracleDataSource and oracle.jdbc.pool.OracleConnectionPoolDataSource.
I have got different Exceptions when I coding different ways:
one is:
Caught an exception.
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: U
nable to connect to database. com.sun.enterprise.resource.JdbcDataSource; nested
exception is:
javax.ejb.EJBException: Unable to connect to database. com.sun.enterpris
e.resource.JdbcDataSource
java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: Unable to
connect to database. com.sun.enterprise.resource.JdbcDataSource; nested excepti
on is:
javax.ejb.EJBException: Unable to connect to database. com.sun.enterpris
e.resource.JdbcDataSource
javax.ejb.EJBException: Unable to connect to database. com.sun.enterprise.resour
ce.JdbcDataSource
<<no stack trace available>>
the Other is:
Caught an exception.
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: U
nable to connect to database. makeConnection:Io Exception: Connection refused(DESCRIP
TION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)
))); nested exception is:
javax.ejb.EJBException: Unable to connect to database. makeConnection:Io
Exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_
STACK=(ERROR=(CODE=12505)(EMFI=4))))
java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: Unable to
connect to database. makeConnection:Io Exception: Connection refused(DESCRIPTION=(TM
P=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))); nes
ted exception is:
javax.ejb.EJBException: Unable to connect to database. makeConnection:Io
Exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_
STACK=(ERROR=(CODE=12505)(EMFI=4))))
javax.ejb.EJBException: Unable to connect to database. makeConnection:Io Exception: C
onnection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(E
RROR=(CODE=12505)(EMFI=4))))
<<no stack trace available>>
My codes related are:
private void makeConnection() throws NamingException, SQLException {
try{
InitialContext ic = new InitialContext();
OracleConnectionPoolDataSource ocpds = (OracleConnectionPoolDataSource) ic.lookup(dbName);
PooledConnection pc = ocpds.getPooledConnection();
con = pc.getConnection();
}catch(SQLException ex){
throw new SQLException("makeConnection:" + ex.getMessage());
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
con = DriverManager.getConnection(
"jdbc:oracle:thin:@172.28.200.43:1521:shcd",
"lijun", "xiaotian"); */
public void setEntityContext(EntityContext context) {
this.context = context;
try {
makeConnection();
} catch (Exception ex) {
throw new EJBException("Unable to connect to database. " +
ex.getMessage());
I believe I set JNDI and config EJB right, because I can run it with Cloudscape DB all right.
who can tell me where is my WRONG, or tell me how to connect to Oracle9i DB?Hi Jhlijun,
I am facing the same problem at the moment. However, I am not using a pooled connection. The following is my code. I am trying to connect a stateless session bean to an Oracle 9i database with result being fed back to a jsp page.
package Test;
import javax.naming.*;
import java.sql.*;
import java.util.*;
import javax.ejb.*;
import javax.sql.DataSource;
import javax.sql.*;
public class TestSessionEJBbean extends java.lang.Object implements javax.ejb.SessionBean
String q="Select NAMETITLE,NAMEFIRST,NAMELAST from People where PeopleRSN<100";
protected boolean create() throws java.lang.Exception
return true;
public TestSessionEJBbean()
{ // EJB constructors don't have a server context.
private void unhandledEvent( String listenerName, String methodName, java.lang.Object event )
// method for interface javax.ejb.SessionBean
public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
// To Do
// method for interface javax.ejb.SessionBean
public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
// To Do
// method for interface javax.ejb.SessionBean
public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
// To Do
// method for interface javax.ejb.SessionBean
public void setSessionContext( javax.ejb.SessionContext parm0 ) throws javax.ejb.EJBException, java.rmi.RemoteException
this._sessionContext = parm0; // generated helper code
// To Do
* Test Method
public String Test() throws javax.ejb.EJBException
return "Hi! I am the SessionEjbBean.";
* Session Context of this EJB.
* Set in 'setSessionContext()' before any 'ejbCreate()' is executed.
private javax.ejb.SessionContext _sessionContext;
* ejbCreate Method
public void ejbCreate() throws javax.ejb.EJBException, javax.ejb.CreateException
try {
create(); // This 'create()' is used for internal initialization.
catch( java.lang.Exception __e) {
System.err.println( __e.toString() + " " + __e.getMessage() );
// TODO: implement
* getDBConnection Method
public sun.jdbc.rowset.CachedRowSet getDBConnection() throws javax.ejb.EJBException
String testPrint = "Starting...";//Only to check output
Connection conn;
sun.jdbc.rowset.CachedRowSet crset=null;
try {
testPrint += "before new InitialContext()....";//Only to check output
InitialContext ic = new InitialContext();
DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/coquit");
testPrint += "before ds.getConnection()....";//Only to check output
conn = ds.getConnection("coquit","coquit");
testPrint += "before conn.createStatement()....";
Statement stmt=conn.createStatement();
testPrint += "before stmt.executeQuery(....)";
ResultSet rset = stmt.executeQuery(q);
testPrint += "before new sun.jdbc.rowset.CachedRowSet()";
crset = new sun.jdbc.rowset.CachedRowSet();
testPrint += "before crset.populate(rset)";
crset.populate(rset);
rset.close();
stmt.close();
conn.close();
} catch (NamingException ne) {
System.out.println("TestSessionEJBbean::getDBConnection Naming Exception " + ne);
}catch (Exception e){
System.out.println(testPrint+"...TestSessionEJBbean::getDBConnectionException" + e);
System.out.println("\n\n");
e.printStackTrace();
return crset;
Maybe you are looking for
-
How can I sync my iPad to a computer after syncing it to the iCloud? I have the option of setting it up new, or restoring to a sync from many months ago. I dont want to lose any apps but I would like to back up on computer. No auto sync like other de
-
How to open WMV files in a new window
I would like to open and play Windows Media Player files in a new window that is sized to the player window - not a full new page. I cannot seem to find an exension that would handle this. Anyone have a place I can look?
-
Development Request on Financials Report in VND Currency - Money Overflow
Dear all, In Vietnam, customer uses VND currency and encountered the issues when generating financial report with big amount. Generating T/B or G/L with long period or large amount would come with the error: "Error while running report due to money o
-
Can I use Apple TV with a Toshiba 32AV505D television?
Can I use Apple TV with a Toshiba 32AV505D television?
-
In Design 5 won't startup with Mac Os 10.8.2
I have tried repairing permissions, deleting preferences, reinstall after clean sweep and uninstall procedures, and a score of other suggestions from the forums postings. I am ready to trash 10.8 and go back to 10.6.