JDBC MS-SQL Server at Oracle
Hi,
I'm developing Java procedures in Oracle 8.1.7. I've already loaded the
Sybase JDBC driver successfully with loadjava and the Oracle procedures that
access Sybase are working correctly.
I've tried doing the same with Microsoft SQL Server 2000 JDBC, but it's not
working. The jar files were placed on the classpath and the problem remains.
Has anyone loaded the files msbase.jar, msutil.jar and mssqlserver.jar
successfully in Oracle 8.1.7 with the loadjava command? Any ideas will be
appreciated.
Thanks in advance.
Regards,
Vanderlei Fonseca
The only way this will work is if the vendor driver is a type-4 (100% java, no native methods). There is no external 'classpath' that the server uses for Java procedures. Everything has to be loaded with loadjava. I do not know if the SQL Server JDBC drivers are type-1, 2, 3 or 4. You need to check that with MS.
Similar Messages
-
Migrating a table with BLOB field from SQL-Server to Oracle.
Hi All,
I'm trying to create a Class to migrate data from SQL-Server to Oracle, this table has a BLOB field.
The Code:
package br.com.infox;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class Migrador {
public static void main(String[] args){
try {
// Conex�o com o SQL Server
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conSQL = DriverManager.getConnection ("jdbc:jtds:sqlserver://10.10.2.9/protocolo","prot","suinf2002");
// Conex�o com o Oracle
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conORA = DriverManager.getConnection ("jdbc:oracle:thin:@10.10.2.2:1521:des","protocolo","protocolo");
Statement stSQL = conSQL.createStatement();
String querySQL = "SELECT * FROM DOC_INCORPORADO";
ResultSet rsSQL = stSQL.executeQuery(querySQL);
String queryORA = "INSERT INTO PROT_VITALICIAMENTO (NU_PROCESSO, ANO_PROCESSO, CD_USUARIO, DT_ENVIO," +
"DE_COMPLEMENTO, NM_ARQUIVO, ARQUIVO, NU_SEQ, CD_TIPO_ARQUIVO, MES, ANO) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement psORA = conORA.prepareStatement(queryORA);
while (rsSQL.next()){
System.out.println("Linha: " + rsSQL.getRow());
psORA.setInt(1, rsSQL.getInt("nu_processo"));
psORA.setInt(2, rsSQL.getInt("ano_processo"));
psORA.setInt(3, rsSQL.getInt("cd_usuario"));
psORA.setDate(4, rsSQL.getDate("dt_incorporacao"));
psORA.setString(5, rsSQL.getString("complemento"));
psORA.setString(6, rsSQL.getString("nm_arquivo"));
psORA.setBinaryStream(7, rsSQL.getBinaryStream("arquivo"), (int)rsSQL.getBlob("arquivo").length());
psORA.setInt(8, rsSQL.getInt("num_seq"));
psORA.setInt(9, rsSQL.getInt("cd_tipo_arquivo"));
psORA.setInt(10, rsSQL.getInt("mes"));
psORA.setInt(11, rsSQL.getInt("ano"));
psORA.executeUpdate();
stSQL.close();
psORA.close();
conORA.close();
conSQL.close();
} catch (Exception e){
e.printStackTrace();
The ERROR:
java.sql.SQLException: Exce��o de E/S: Connection reset
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3668)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2191)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2064)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2989)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
at br.com.infox.Migrador.main(Migrador.java:41)
What's the problem of these Class?
Thank's.Depending on the version of the database you have, you could use transportable tablespaces.
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#9370 -
DSNless connection to SQL Server and Oracle
hi,
how can i connect to SQl Server and Oracle without specifying the DSN.
zulfgiMy favorite reply again:
Someone wrote in a newsgroup about configuring some kind of "temporary DSN".
His example was for Excel, but it will maybe work the same way for other drivers:
db = DriverManager.getConnection(
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=c:/temp/test2.xls;DriverID=22;READONLY=false","","");
Also someone else suggested for SQLServer:
db = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=MyServerName;Database=MyDataBase","","");
Find out the right driver clause for Oracle; look at the names the control panel ODBC manager shows.
Regards,
Hartmut -
Hi,
I am trying to connect to a SQL server database by giving table name in (SPVC) database as spvc.dbo.tablename.. If i want to access another database (SPVC_D), how can i do it without changing my java code?? Can i be able to add the database name to the connection string and i can remove the hard coding (spvc.dbo.) from my java code?? How shall i be able to do that..
Please let me know.. I am very new with JDBC with SQL server..
Thanks
Praveen PadalaIn the MS SQL Server that I use, the following syntax
spvc.dbo.tablename
Breaks done as follows...
<database>.<user>.<tablename>
However connections are always to a database. Thus when one uses the above syntax it basically runs 'in' the one database and accesses another.
Depending on various attributes of the tables, if and only if, a table called 'tablename' exists in a database called 'spvc_d' then if you connect to 'spvc_d' then you can access 'tablename' just by using 'tablename'.
So if that is what you are doing you will not have a problem. -
SQL Server to Oracle migration with SQL Server DTS
I migrate database from SQL Server to Oracle with SQL Server DTS. the process is success. I can select table_name from user_tables or user_objects. I also can see the table from DBA Studio. But When I use desc to list the structure of table in SQLPLUS. it tell me object don't exist.
What is wrong?
Thanksuse sp_help <tablename>
-
Problem in Creating a JDBC System - SQL Server
Hi All
I failed in creating a JDBC System(SQL Server). I am using SAP EP 7.0 SP 9. I tried to create the JDBC system with the following properties:
I am listing them Category wise:
Connection Properties:
1. Connection Timeout: 300
2. Connection URL: jdbc:sap.sqlserver://<server name> : <port name>; DatabaseName=master
3. Driver Class Name: com.sap.portals.jdbc.sqlserver.SQLServerDriver
4. Validate Connection: Yes
UserManagement Properties:
5. User Mapping Type: admin;user
Please help me out in making this work. And let me know if any changes to incorporated.
Regards,
Vijay.Hi vijay,
I have tried this thing sometime back. But when i create a JDBC system, I never give the <b>Connection Timeout</b> and change the<b> Validate Connection</b> from No to Yes. I just give the <b>Connection URL</b> and the <b>Driver Class Name</b> in the Connection Properties dropdown.
Try making these changes and check whether the user mapping is done correctly. Also check whether the Connection URL and the Driver Class Name are correct or not. Have a look at the following link:
<a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/VC/JDBC%2bConnection%2bSetup">https://www.sdn.sap.com/irj/sdn/wiki?path=/display/VC/JDBC%2bConnection%2bSetup</a>
Let me know if this works.
Bye
Ankur
Reward points if it helps!! -
Hello,
I use Entity Framework code first approach.
My project is working fine with SQL Server. But, I want to access Oracle too. I want to switch SQL Server and Oracle in run time.
I am able to access Oracle using "Oracle.ManagedDataAccess.EntityFramework.dl" in a new project.
But, Is this possible to access SQL Server and Oracle in the same project.
Thanks,
MuruganThis should be possible with a Code-First workflow. In Code-First the database mapping layer is generated at runtime.
David
David http://blogs.msdn.com/b/dbrowne/ -
How to connect to a Sql server from Oracle using db link
Hi All,
Does anybody have any idea about how to connect to a sql server from oracle database using db link to syncronize the data? I need to pull the data from Sql server table to Oracle tables and relay messages back to the sql server.
Thank you,
Praveen.we have 2 products - DG4MSQL and DG4ODBC.
DG4ODBC is for free and requires a 3rd party ODBC driver and it can connect to any 3rd party database as long as you use a suitable ODBC driver
DG4MSQL is more powerfull as it is designed for MS SQL Server databases and it supports many functions it can directly map to SQL Server equivalents - it can also call remote procedures or participtae in distributed transactions. Please be aware DG4MSQL requires a license - it is not for free.
Check out Metalink and you'll find notes how to configure both products.
For a generic overview:
Note.233876.1 Options for Connecting to Foreign Data Stores and Non-Oracle Databases
And the setup notes:
DG4ODBC
Note.561033.1 How to Setup DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX) :
Note.466225.1 How to Setup DG4ODBC (Oracle Database Gateway for ODBC) on Windows 32bit RDBMS.HS-3-2 :
Note.109730.1 How to setup generic connectivity (HSODBC) for 32 bit Windows (Windows NT, Windows 2000, Windows XP, Windows 2003) V817:
Note.466228.1 How to Setup DG4ODBC on Linux x86 32bit
DG4MSQL
Note.466267.1 How to Setup DG4MSQL (Database Gateway for MS SQL Server) on Windows 32bit
Note.562509.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX)
Note.437374.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) Release 11 on Linux -
Related to migration of db from sql server to oracle 11 g
We're trying to migrate a Sql server managment studio database to Oracle 11g using SQL Developer 4.0. We can successfully connect to both Sql server managment studion 8.0 and Oracle 11g using the tool, as well as click through the Migration Wizard and start the migration.
This opens the Database Migration dialog box, which indicates the capture process starts normally. we get the following error:
ora :01440 : can not insert null into migrlog (id column) ,
\and then after some time , i get an error that migration failed
i am not getting the reason,I thing it may be due to reason that , I have table's column in my source db with more than 30 character.
If i am migrating one by one table . then it is not giving any error, and identifier name is getting shrink in 30 character. but i am not getting the view , stored procedure , indexes , and others
then what is the solution for that, somebody pls suggest any help?????????????Pl do not post duplicates - related to migration of db from sql server to oracle 11 g
Continue the discussion in your original thread
The error message is explicitly clear
ora :01440 : can not insert null into migrlog (id column)
Your process is trying to insert a NULL value into the ID column, which presumably cannot be NULL -
Different output of same query in SQL Server and Oracle
I have two tables table1 and table2
--table1 has two columns c1 int and c2 varchar. there are not constraints added in it. it has data as given below
c1 c2
6 d
5 j
102 g
4 g
103 f
3 h
501 j
1 g
601 n
2 m
--table2 has only one column c1 int. there are not constraints added in it. it has data as given below
c1
6
1
4
3
2
now when i run below given query in sql server and oracle it gives me different result
select *
from table1
inner join (SELECT ROW_NUMBER() OVER (order by c1 ASC) AS c1 from table2) table2 on table2.c1=table1.c1
sql server output
c1 c2 c1
1 g 1
2 m 2
3 h 3
4 g 4
5 j 5
oracle output
C1 C2 C1
5 j 5
4 g 4
3 h 3
1 g 1
2 m 2
If you notice the first column in both output. It is sorted in sql server and not in oracle.
Why it is behaving differently in oracle? Is there any way I can solve this in oracle?
Thanks,
JigsIt is NOT behaving "differently" in Oracle; you just haven't specified an order that you expect your results to be in, so you're going to get output in whatever order the database fancies displaying it (ie. no guarenteed order). This is an artifact of how the database chooses to put together the data, and different databases (or even datasets within the same database) can and most likely will behave differently.
Even SQL Server won't guarentee to always get your data in an ordered fashion if you exclude the order by clause, even if you think it has always output the data in an ordered fashion.
Your solution is to add an order by clause, in BOTH databases, to force the order of the output data. -
CONVERT function in SQL Server to oracle
All,
How to convert CONVERT function in SQL Server to oracle, below mentioned format is in SQL Server:
variable1 = convert(numeric(20), SUBSTRING( parameter1,parameter2,parameter3)
parameter1 datatype nvarchar2(100)
parameter2 datatype bigint
parameter3 datatype bigint
I did bit R&D, but was not successful..but still getting on..
If any help that would be great...
Regards,
~ORAYou cannot specify the precision/scale or length of input paramters to a stored procedure in Oracle, or at least the pl/sql engine does not respect the sizing. Assuming that you want to do something with variable1 in the procedure, and not just return it, the Oracle equivalent would be something along the lines of:
SQL> CREATE FUNCTION f (p_param1 IN VARCHAR2,
2 p_param2 IN NUMBER,
3 p_param3 IN NUMBER) RETURN NUMBER IS
4 l_var1 NUMBER(20) := SUBSTR(p_param1, p_param2, p_param3);
5 BEGIN
6 RETURN l_var1 * 10;
7 END;
8 /
Function created.
SQL> SELECT f('ABC10DEF', 4, 2) FROM dual;
F('ABC10DEF',4,2)
100You may need to adjust the return type to match what you are actually returning.
You can also use this iin a direct assignment in pl/sql without doig a select, something like:
SQL> DECLARE
2 l_num NUMBER(20);
3 BEGIN
4 l_num := f('ABC10DEF', 4, 2);
5 DBMS_OUTPUT.Put_Line('The number is: '||l_num);
6 END;
7 /
The number is: 100John -
How to replicate data from MS SQL Server to Oracle
Hi,
Can someone please help me on how to replicate data from MS SQL Server to Oracle 8i database.Dear,
I'm a student.
I do simple replication on Oracle 8.0.5 successfully. (one master site and one snapshot site). I only use the SQL*Plus and Schema Manager to do.
But when I do advance replication (multimaster replication) I meet many problem. So I don't get the result.
Do you show me the technology to do that ?
Thanks ! -
Access Oracle from SQL Server using Oracle Provider for OLE DB
Using
- SQL Server 2000 SP4
- Oracle 10g
- Oracle10g Provider for OLE DB Version 10.1.0.4.0
- Oracle 10g client
Able to create linked server in SQL server to Oracle 10g and display list of tables in Oracle. However, when execute query, it gives
Server: Msg 7320, Level 16, State 2, Line 1
Could not execute query against OLE DB provider 'OraOLEDB.Oracle'.
OLE DB error trace [OLE/DB Provider 'OraOLEDB.Oracle' ICommandText::Execute returned 0x80040155].
Any idea what is the problem ?I'm having the same error message...But I'm connecting to a Oracle 8i DB......
I think this has to do with SP4 for SQL....I will test this tonight.... -
Regarding the tns-12541 error in connecting to sql server from oracle
i need to create a database link from oracle on windows box to sql server.I configured everything but when i am trying to tnsping the sqlserver
it throws me an TNS12541 no listener error.
The listner status is up and the listener workslittle confusion here, are you trying to tnsping sql server? tnsping is an Oracle utulity.
To acces sql server from Oracle you may use Transparent Gateway for Microsoft SQL - http://download.oracle.com/docs/cd/B19306_01/gateways.102/b14270/ch3.htm#sthref66 and Heterogeneous Connectivity - http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/intro.htm#sthref33
Best regards. -
Migration from SQL server to Oracle
Hi,
Has anybody done migration from the SQL server to Oracle? If so, what manual method do you recommend? I'm a new college grad and I would like to get your expertise, if you have done this in the past.
Thanks in advance!
ShoIt is some time back, so I do not remember the specifics. Oracle gives Oracle Migration Workbench for free. You can use it to convert all SQL tables and procedures etc to oracle. It is not that difficult. If there are no stored procedures etc, you can just extract the DDL and create the tables with minor changes to the script. You might need bcp-sqlloader/trasparent gateway etc copy the data.
Giby
Maybe you are looking for
-
Hi, I ahve a macbook Pro. Sometimes it tells me there are software updates but some of them i can't download because it wants me to enter an apple ID and its only giving me the choice to use my old ID with an old email address that no longer exists.
-
Xy Graph property node:apply to all plots
I have an xy graph with multiple plots and am using property nodes to give each plot a different color. My problem is that i would like to set the "point style" for every plot to be the same, in other words: create a default point style that differs
-
Reading all function code of a pf-status
Hi, I need to read all the function code of a pf-status. Any idea if there's any table or function module to do that?
-
Adding new hard drive for Flash recovery area
i am adding new hard drive for flash recovery area. How i can make single directory on that flash recovery area & how i can test that i am accessing that rightly , to that directory & flash back recovery area disk?
-
Receiving Video RTP Stream (JMF) in JME ( MMAPI ) - URGENT !!!
Hi Folks... I�m trying to develop an application that sends the images from a web cam connected to the computer, to the PDA that the images can be viewed by the user... My code for the JMF RTP Video Stream is as follows. Processor proc = null;