Copy the data from Sql Server to edirectory using java
Hi ,
I am new to e directory.I don't know how it works.Can some one assist
me on this ,I have to extract data from SQL Server and update these
data in edirectory.This is needs to be done using java.
If any one can provide me the sample code or please suggest how to
proceed .
Thanks in advance
dukewarm
dukewarm's Profile: http://forums.novell.com/member.php?userid=53430
View this thread: http://forums.novell.com/showthread.php?t=373051
dukewarm;1792481 Wrote:
> Hi ,
>
> I am new to e directory.I don't know how it works.Can some one assist
> me on this ,I have to extract data from SQL Server and update these
> data in edirectory.This is needs to be done using java.
>
> If any one can provide me the sample code or please suggest how to
> proceed .
>
> Thanks in advance
Read the values from SQL server and use LDAP to update the data in
eDirectory.
Thomas
thsundel
thsundel's Profile: http://forums.novell.com/member.php?userid=128
View this thread: http://forums.novell.com/showthread.php?t=373051
Similar Messages
-
How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
I tried using DROP Tables, Truncate Database, Delete and many more but it is not working. I want to delete all tables using Query Analyzer, i.e. through SQL Query.
Please help me out in this concern.
Nishith ShahInformative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
declare @TTName Table
(TableSchemaTableName
varchar
(500),
[status] int
default 0);
with AvailableTables
(TableSchemaTableName)
as
(select
QUOTENAME(TABLE_SCHEMA)
+
+
QUOTENAME(TABLE_NAME)
from
INFORMATION_SCHEMA.TABLES)
insert into @TTName
(TableSchemaTableName)
select *
from AvailableTables
declare @TableSchemaTableName varchar
(500)
declare @sqlstatement nvarchar
(1000)
while 1=1
begin
set @sqlstatement
=
'DROP TABLE '
+ @TableSchemaTableName
exec
sp_executeSQL
@sqlstatement
print
'Dropped Table : '
+ @TableSchemaTableName
update @TTName
set [status]
= 1
where TableSchemaTableName
= @TableSchemaTableName
if
(select
count([Status])
from @TTName
where [Status]
= 0)
= 0
break
end -
How to compare 2 dates in SQL Server 2000 DB using Java?
How do you compare 2 dates in SQL Server 2000 DB using Java?
Let's say we have two fields: Date Reported and Target Finish Date.
Date Reported is 09-10-2004 09:55:55: PM
Target Finish Date is 09-12-2004 11:59:59: PM
What i want to happen is i want to convert both dates to days and get the difference of the two.
can SQL Server 2000 DB do this?it doesnt wrk.
ok here's what i did:
iv tested a simple code for this case.
I created a table name tblDate which has 3 columns namely date_ID, date_From (datatype datetime), date_To (datatype datetime).
I inserted 1 row: date_ID has the value 1, date_From has the value 10/22/2004, and date_To has the value 10/24/2004.
i run the java code below:
int days = 0;
String query = "SELECT date_From, date_To cast(date_From-date_To AS int) AS Diff FROM tblZoo WHERE date_ID = '1'";
try
DBConnect db = new DBConnect();
db.openCon();
ResultSet rs = db.execute(query);
while(rs.next())
days = rs.getInt("Diff");
db.closeCon();
catch (Exception ex)
System.out.println("Error on Execution: " + ex);
return days;___________
an error occurred: Error on Execution: java.lang.nullpointerexception -
Extract the data from SQL Server and Import into Oracle
Hi,
I would like to run a daily job that will export the table data from SQL server table (it will be only one or two table) and Import back into Oracle table (it might one or two table tables).
Could you please guide me that how can i do this using either sql server or oracle?
We have oracle 9.2 and sql server 2005.
Normally i do from flat file which is generated by source destination nand i dump into oracle using sql*loader but this time I have to directly extract/export the data from MS Sql server and load into Oracle table, mostly it will reload so i might doing any massaging data during the load.
If you show me the detail approach, it will be really appreciated.
I have access to Sql server but i don't how to use sql server to do this or using oracle as a daily job even becuase have to schedule the job for this as it will be a daily job.
Thanks,
poratipsUnless you can find an open source ODBC driver for SQL Server that runs on Solaris (and I wouldn't be overly hopeful there) Heterogeneous Services would require that you license something-- a third party ODBC driver, a new Oracle instance, or an Oracle Transparent Gateway.
As I stated below, you could certainly use SQL Server's ETL tool, DTS. Oracle's ETL tools would require additional licensing since you're just on 9.2. You could also write a small application (Java or otherwise) that connected to both databases and transferred the data. If you're particularly enterprising, you could load the SQL Server Type 4 JDBC driver into Oracle's JVM and write a Java stored procedure that connected to the SQL Server database via JDBC, but that's a pretty convoluted approach.
Justin -
Fetch the data from sql server table to array
In the following script i am fetching the servers details from text file. Please anyone help me to get the same information from sql server database table. with using this query
"SELECT DISTINCT [server_name]
FROM
Servers] where
Status='1'"
$ServerName =Get-Content "c:\servers\servers.txt"
foreach ($Server in $ServerName) {
if (test-Connection -ComputerName $Server -Count 4 -Delay 2 -Quiet ) {
write-output "$Server is alive and Pinging `n"
} else {
Write-output "TXUE $Server seems dead not pinging"i have tested it is not working..
=@"
SELECT DISTINCT [server_name] FROM Servers] where Status='1'
$connection
=new-objectsystem.data.sqlclient.sqlconnection(
"Data Source=xxx;Initial Catalog=xxx;Integrated Security=SSPI;”)
$adapter
=new-objectsystem.data.sqlclient.sqldataadapter($query,
$connection)
$table
=new-objectsystem.data.datatable
$adapter
.Fill($table)
| out-null
$compArray
=@($table)
##### Script Starts Here ######
foreach($Serverin$ServerName)
if(test-Connection-ComputerName$Server-Count4
-Delay2
-Quiet)
write-output"$Server
is alive and Pinging `n"
else{
$query -
Exporting data from SQL Server database to Oracle database
Hello All,
We need to replicate a table's data of SQL Server database to Oracle database.
Can this task be accomplished using Import/Export wizard or Linked servers?
Can help me regarding which Oracle data access components should i download to do this?
I am using SQL Server 2012.
And i have Oracle 11g release 2 client installed in my system.
Thanks in Advance.
Thanks and Regards, Readers please vote for my posts if the questions i asked are helpful.Yes you can definitely transfer data from SQL server to Oracle Have a look at below links
Export SQL server data to Oracle Using SSIS
Use OLEDB data provider to transfer data from SQL server to Oracle
Using Import Export Wizard
Similar thread
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
My TechNet Wiki Articles -
Error while reversing data from SQL Server to ODI
hi,
I was reversing data from SQL Server Java 1.6_022 in ODI Java 1.5, I was getting error Version Mismatch and I updated ODI Java version to 1.6_022.
And now, I am getting the below error while reversing the data from SQL Server database.
0 : 08001 : java.sql.SQLException: No suitable driver
Looking for the assistance on the same.
Thanks,
AbhayIf everything is fine the reversing should be fine. I would say check again if the Technology of the Model and the also the dataserver is created under the right Technology in topology too.
also if this doesn't help , Please tell us the steps you have carried so far . Also can you try selective reverse is it showing the tables. -
To fatch the data from sql to excel ??? any idea....
dear all,
my problem is - i want to retrive the data from sql server to excel sheet... can any one suggest the idea what to do ???
thanks.You can open two connections. One to SQL Server (you can use a thin or JDBC-ODBC bridge), the other to your Excel spreadsheet using the JDBC-ODBC bridge. You could query the SQL Server database, massage and format your data, then write it to Excel. Excel works with a very limited set of SQL. Here is a program from a post by Tim Vickers that others sounded happy to have. I'm reposting here for your convenience. I have not personally run this program, so please use it at your own risk.
import java.sql.*;
import java.io.*;
import java.util.*;
import java.text.*;
* Name: Excel.java
* Purpose: To demonstrate how to use ODBC and Excel to create
* a table,
* insert data into it, and select it back out.
* Version: Developed using JDK 1.3, but also works with JDK
* 1.2.2
* Instructions:
* 1) Create a new Excel spreadsheet
* 2) Create a new ODBC data source that points to this
* spreadsheet
* a) Go to Control Panel
* b) Open "ODBC Data sources (32-bit) (wording may be
* slightly
* different for different platforms)
* c) Under "User DSN" tab, press "Add" button
* d) Select the "Microsoft Excel Driver (*.xls)" and
* press
* "Finish" button
* e) Enter "Data Source Name" of "TestExcel"
* f) Press "Select Workbook" button
* g) Locate and select the spreadsheet you created in
* Step 1
* h) Unselect the "Read Only" checkbox
* i) Press "Ok" button
* 3) Compile and run Excel.java
* 4) Open Excel spreadsheet and you will find a newly
* created
* sheet, GOOD_DAY, with three rows of data.
* Notes:
* If you want to select data from a spreadsheet that was
* NOT
* created via JDBC-ODBC (i.e. you entered data manually
* into
* a spreadsheet and want to select it out), you must
* reference
* the sheet name as "[sheetname$]".
* When you create the table and insert the data using
* Java, you
* must reference the sheet name as "sheetname".
* Also, do not have the spreadsheet open when you are
* running
* the program. You can get locking conflicts.
public class Excel {
public Excel() {
setDefaults();
private static void m(String pMessage) {
System.out.println(pMessage);
private void setDefaults() {
setDriver("sun.jdbc.odbc.JdbcOdbcDriver");
setUrl("jdbc:odbc");
// ODBC data source named "TestExcel" defined from
Control Panel
setDataSource("TestExcel");
setTableName("GOOD_DAY");
public void openDatabase() {
String lConnectStr = getUrl()+":"+getDataSource();
try {
Class.forName(getDriver());
gConnection = DriverManager.getConnection(lConnectStr);
catch (Exception e) {
m("openDatabase(): "+e.getMessage());
private void closeDatabase() {
try {
getConnection().close();
catch (Exception e) {
m("closeDatabase(): "+e.getMessage());
private void createTable() {
m("createTable() begin");
Statement lStat = null;
try {
lStat = getConnection().createStatement();
lStat.execute("CREATE TABLE "+getTableName()+" ("
+" ID INTEGER"
+" ,NAME VARCHAR"
+")");
catch (Exception e) {
m("createTable(): "+e.getMessage());
m("createTable() end");
private void doInsert() {
m("doInsert() begin");
Statement lStat = null;
try {
lStat = getConnection().createStatement();
lStat.executeUpdate("INSERT INTO "
+getTableName()+"(ID,NAME) VALUES
(10,'KANGAROO')");
lStat.executeUpdate("INSERT INTO "
+getTableName()+"(ID,NAME) VALUES (20,'KOALA')");
lStat.executeUpdate("INSERT INTO "
+getTableName()+"(ID,NAME) VALUES (30,'PAUL
HOGAN')");
lStat.close();
catch (Exception e) {
m("doInsert(): "+e.getMessage());
m("doInsert() end");
private void doQuery() {
m("doQuery() begin");
try {
Statement lStat = getConnection().createStatement();
ResultSet lRes = lStat.executeQuery(
"SELECT * FROM "+getTableName()
ResultSetMetaData lMeta = lRes.getMetaData();
// print out the column headers separated by commas
for (int i = 1; i <= lMeta.getColumnCount(); ++i) {
if (i > 1)
System.out.print(", ");
String lValue = lMeta.getColumnName(i);
System.out.print(lValue);
System.out.println("");
// print out the data separated by commas
while (lRes.next()) {
for (int i=1; i<=lMeta.getColumnCount(); ++i) {
if (i > 1)
System.out.print(", ");
String lValue = lRes.getString(i);
System.out.print(lValue);
System.out.println("");
lRes.close();
lStat.close();
catch (Exception e) {
m("doQuery(): "+e.getMessage());
m("doQuery() end");
private void run() {
openDatabase();
createTable();
doInsert();
doQuery();
closeDatabase();
public static void main(String args[]) {
m("main() begin");
Excel lExcel = new Excel();
lExcel.run();
m("main() end");
System.exit(0);
public void setTableName(String pValue) {
gTableName = pValue;
public String getTableName() {
return(gTableName);
public void setSql(String pValue) {
gSql = pValue;
public String getSql() {
return(gSql);
public Connection getConnection() {
return(gConnection);
public String getDataSource() {
return(gDataSource);
public void setDataSource(String pValue) {
gDataSource = pValue;
public void setDriver(String pValue) {
gDriver = pValue;
public void setUrl(String pValue) {
gUrl = pValue;
public String getDriver() {
return (gDriver);
public String getUrl() {
return (gUrl);
private Connection
gConnection = null
private String
gDataSource = null
,gTableName = null
,gSql = null
,gDriver = null
,gUrl = null
} -
Loading data from SQL server 2000 to Oracle using OWB 10.2
Hi All,
I have to move data from SQL server to Oracle using OWB. Any idea how to connect to SQL Server thru the OWB design centre console. There is no detail available in the documentation. OWB cocumentation says that "OWB Integrator for Oracle DB & Apps 3.0" is available to connect to Non-Oracle Database (including Sybase, Informix, ODBC).Hi,
yes, you can use ODBC and configure HSODBC on the database server to create a database link to the sql-server. If your oracle server is microsoft based you are ready, otherwise you have to buy an odbc-driver for linux, unix or whatever you use.
Ciao Stephan -
Import data from SQL Server to Oracle
I have created a dblink in oracle to access the SQL database. I am able to run queries through the dblink and it works fine. I have created a test table on Oracle Server to import the data. The field named "description" has CLOB data type. The corresponding datatype on SQL Server is varchar(7000).
When I insert the data from SQL Server, it completes successfully without any error but it truncates the data on CLOB field.
If I run the select query in SQLPlus I can see the entire description.
Select "description" from sql_view@dblink;
-- the above works fine.
CREATE table test
(description CLOB);
INSERT INTO TEST
Select "description" from sql_view@dblink;
-- this works but it truncates the data after 256 characters
My question is, how to get the data from SQL Server without truncating characters.
Thanks in advance,
GopalI hear the same from other friend that sql server truncated the leading zeros from the id column.
I really don't have a solution for this but you can try the work around. Export the data to flat file and upload in oracle using SQL loader, as this would be much faster and efficient. -
The SQL statement is not valid - when importing data from SQL Server using a query
Hi there,
I am trying to import data from SQL to Power Pivot using a SQL query like below:
SELECT Score.FieldCount, Score.Record.GetAt(0), Score.Record.GetAt(1), Score.Record.GetAt(2), Score.Record.GetAt(3), Score.Record.GetAt(4)
FROM
SELECT * FROM dbo.CLR1(
dbo.CLR2('c:\FILES\Test.xml'),
'SELECT * FROM [dbo].[CXCustomer_Small]') Input
) Score
And when I tried to validate it, it returns
The SQL statement is not valid. A column name cannot be blank.
I ran the above SQL statement in Management Studio and it works without problem. Any idea?
Thanks!
Chu
-- Predict everything. http://www.predixionsoftware.comNever mind, I figured out - I need to give each column a name.
-- Predict everything. http://www.predixionsoftware.com -
How to only migrate data from SQL Server 2008 to Oracle 11?
According to our requirement, We need to only migrate data from a SQL Server database to an existed
Oracle database user.
1) I tried to do it with SQL Developer 3.0.04 Migration Wizard, But find an issue.
My SQL Server database name is SCDS41P2, and my Oracle database user name is CDS41P2;
When I used SQL Developer to do offline move data by Migration Wizard, I found all oracle user
name in movedata files which gotten by run Migration Wizard
is dbo_SCDS41P2. If the Oracle user name is not the same as my existed Oracle user name,
the data can't be moved to my existed Oracle user when I run oracle_ctl.bat in command line window.
So I had to modify the Oracle user name in all movedata files, but it's difficult to modify them because there are many tables in
databases. So could you please tell me how to get the movedata files which the oracle user name in them is my
expected Oracle user name?
2) I also tried to use the 'copy to Oracle' function to copy the SQL Server database tables data
to the existed Oracle database user. When clicked 'copy to Oracle', I selected 'Include Data' and 'Replace' option
But I found some tables can't be copied, the error info is as below:
Table SPSSCMOR_CONTROLTABLE Failed. Message: ORA-00955: name is already used by an existing object
Could you please tell me how to deal with this kind of error?
Thanks!
Edited by: 870587 on Jul 6, 2011 2:57 AMHi,
Thanks for you replying. But the 'copy to oracle' function still can't be work well. I will give some info about the table. I also search 'SPSSCMOR_CONTROLTABLE' in the target schema, and only find one object. So why say 'name is already used by an existing object'? Could you please give me some advice? Thanks!
What is the 'Build' version of your SQL*Developer ?
[Answer]:
3.0.04
- what does describe show for the SPSSCMOR_CONTROLTABLE in SQL*Server ?
[Answer]:
USE [SCDS41P2]
GO
/****** Object: Table [dbo].[SPSSCMOR_CONTROLTABLE] Script Date: 07/18/2011 01:25:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SPSSCMOR_CONTROLTABLE](
[tablename] [nvarchar](128) NOT NULL,
PRIMARY KEY CLUSTERED
[tablename] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
- what does describe show for the SPSSCMOR_CONTROLTABLE in Oracle ?
[Answer]:
-- File created - Monday-July-18-2011
-- DDL for Table SPSSCMOR_CONTROLTABLE
CREATE TABLE "CDS41P2"."SPSSCMOR_CONTROLTABLE"
( "TABLENAME" NVARCHAR2(128)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
-- DDL for Index SYS_C009547
CREATE UNIQUE INDEX "CDS41P2"."SYS_C009547" ON "CDS41P2"."SPSSCMOR_CONTROLTABLE" ("TABLENAME")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
-- Constraints for Table SPSSCMOR_CONTROLTABLE
ALTER TABLE "CDS41P2"."SPSSCMOR_CONTROLTABLE" MODIFY ("TABLENAME" NOT NULL ENABLE);
ALTER TABLE "CDS41P2"."SPSSCMOR_CONTROLTABLE" ADD PRIMARY KEY ("TABLENAME")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE;
Edited by: 870587 on Jul 18, 2011 1:42 AM -
How to copy the data from one database to another database without DB link
Good Day,
I want to copy the data from one database to another database with out DB link but the structure is same in both.
Thanks
NiharYou could use SQL*Plus' COPY command
http://technology.amis.nl/blog/432/little-gold-nugget-sqlplus-copy-command
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/apb.htm#sthref3702
Edited by: Alex Nuijten on Sep 16, 2009 8:13 AM -
Show data from sql server to oracle db
Hi,
I am using oracle 10g R1 on windows 2003 platform. On one machine database 10gR1 is running and on other machine sql server is running. I want to retrieve some data from sql server to oracle database. Please tell me how I can show data from sql server to oracle db.
ThanksTo make heterogeneous connection with oracle:
1.First make an ODBC connection, make entry in System DSN(to create a data source)
2.Make an entry in tnsnames.ora
3.Make an entry in listener.ora under SID_LIST_LISTENER
4.Make an entry in file named init<HS>.ora file located "oracle_base\oracle_home\db\hs\admin"
5.Restart the listener
e.g:
1. create a odbc system dsn named like 'sqlserver'
2. sqlserver= (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp) (HOST=xx.xx.xx.xx) (PORT=1521))
(CONNECT_DATA = (SERVICE_NAME=sqlserver))
(HS = OK)
3. (SID_DESC = (SID_NAME = sqlserver) (ORACLE_HOME = oracle_base\oracle_home\db) (PROGRAM = hsodbc) )
4.Create a file named initsqlserver.ora and make the following entry:
HS_FDS_CONNECT_INFO = sqlserver
Alternatively, you can copy the file named inithsodbc.ora and rename it to initsqlserver.ora
and edit as HS_FDS_CONNECT_INFO = sqlserver
5. lsnrctl reload listener_name
regards
adnan kaysar -
How to delete the Folder from sql server 2008
Hi all,
I was trying to delete the folder from sql server 2008 with the below script
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @cmd VARCHAR(8000)
DECLARE @folderName VARCHAR(256) -- filename for backup
SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112)) -- 7 days back date folder name
SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
SET @cmd = 'del ' + @path -- Delete
EXEC master..xp_cmdshell @cmd
--Print @cmd
This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.
Thanks,
Prasad R.I would notice you that T-SQL does not play well to do things like that. Do not you want using .net language to delete folders?
Old method is
declare @HR int, @CFOLDER varchar(255),@FSO int
set @CFOLDER='D:\folder\'
EXEC @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
EXEC @HR = sp_OAMethod @FSO, null, 'DeleteFolder', @CFOLDER
Now regarding to your second question please examine xp_fileexist system stored procedure
CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
RETURNS INT
AS
BEGIN
DECLARE @file_exists AS INT
EXEC master..xp_fileexist @filename, @file_exists OUTPUT
RETURN @file_exists
END
GO
-- test
SELECT dbo.fn_file_exists('c:\a.txt')
Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Maybe you are looking for
-
Dear Experts, How to add pushbutton in alv report..... *& Report ZTT_TEST_ALV REPORT ZTT_TEST_ALV. *data declarations type-pools : SLIS. * data : BEGIN OF wa_kna1, * kunnr type kunnr, * name1 type name1, *
-
When I edit mouse click in mouse properties, it doesn't always make the sound when it's checked (ticked), and sometimes makes a mouse click sound when it's not ticked. If you run it through again, it often responds differently. The same thing happens
-
ITunes has stopped working. Please Help Me!!
I'm having a huge problem, and I have tried everything I know to fix it. My iTunes was working fine up until a few days ago. I upgraded to the newest version..and when i went to add some files to my ipod a few days later this happened: iTunes will lo
-
H323 static Nat doesn't work fine on 3900 series router with IOS 15.2(3) T
Hi, I have a problem with static nat setting on my 3925 router with IOS15.2(3). The scenario is like this: I set a static nat between 172.16.1.2 and x.x.x.x(public IP address) using following command: ip nat inside source static 172.16.1.2 x.x.x.x Th
-
This thread attempts to tackle the issue of screen captures in FrameMaker. Please post questions about screen captures to the FrameMaker forum outside the FAQ thread using Add Topic. http://www.adobeforums.com/cgi-bin/webx?14@@.ee6b312 Please, post c