Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Monday, September 18, 2023

In SharePoint, understanding collections and schema is crucial when you want to migrate data to a SQL Server database

 In SharePoint, understanding collections and schema is crucial when you want to migrate data to a SQL Server database. Here's an overview of these concepts:


1. Collections:

   - In SharePoint, data is organized into collections of related items. The primary collection in SharePoint is the "List" or "Library." Lists are used for structured data, while libraries are typically used for documents. Each list or library contains items or documents, respectively. You can think of a collection as a table in a database.


2. Schema:

   - In the context of SharePoint, schema refers to the structure or metadata associated with lists and libraries. This includes information about the fields or columns in a list, their data types, and any relationships between lists. SharePoint allows you to define custom fields and content types, which are part of the schema. Understanding the schema is essential because it defines the structure of your data.


Now, if you want to migrate data from SharePoint to a SQL Server database, here are the general steps you can follow:


1. Inventory Your Data:

   - Start by understanding the structure of your SharePoint application, including the lists, libraries, and their schemas. Document the names of lists, the fields in each list, and any relationships between lists. This will be your data inventory.


2. Choose a Migration Approach:

   - There are several ways to migrate data from SharePoint to SQL Server:

     - Custom Scripting: You can write custom scripts or code (e.g., PowerShell, Python) to extract data from SharePoint using its APIs (e.g., REST API) and then insert it into SQL Server.

     - Third-Party Tools: Consider using third-party migration tools that specialize in SharePoint to SQL Server migrations. These tools often simplify the process.

     - SSIS (SQL Server Integration Services): If you're comfortable with SSIS, you can create packages to move data from SharePoint to SQL Server.


3. Map SharePoint Fields to Database Columns:

   - For each SharePoint field, determine how it maps to a column in your SQL Server database. Ensure that data types, lengths, and constraints are compatible.


4. Extract and Transform Data:

   - Use your chosen migration approach to extract data from SharePoint, transform it as needed (e.g., data cleansing, data type conversions), and prepare it for insertion into SQL Server.


5. Load Data into SQL Server:

   - Insert the transformed data into your SQL Server database. You can use SQL Server's tools or programming languages like C# or Python, depending on your preference.


6. Verify Data Integrity:

   - After the migration, verify that the data in SQL Server matches the data in SharePoint. Check for any discrepancies and resolve them as needed.


7. Schedule Incremental Updates (if necessary):

   - If your SharePoint data is actively changing, consider implementing a mechanism for regular updates to keep your SQL Server database in sync.


Migrating data from SharePoint to SQL Server can be a complex process, and the specific steps and tools you use will depend on your SharePoint configuration and requirements. Be sure to thoroughly test the migration process in a non-production environment before performing it in a production setting to ensure data integrity and accuracy.

Thursday, May 18, 2023

Oracle SQL developer Error : No warning message but its automatically closed during installation.

 If  you're experiencing issues with Oracle SQL Developer installation. Here are a few troubleshooting steps you can try:


- Ensure system requirements: Verify that your system meets the minimum requirements for Oracle SQL Developer. Make sure you have a compatible operating system version and Java Development Kit (JDK) installed.


- Download the latest version: Visit the official Oracle SQL Developer website and download the latest version of the software. Sometimes, older versions may have compatibility issues with certain operating systems or Java versions.

- Check Java installation: Ensure that you have a compatible JDK installed on your system. Oracle SQL Developer requires Java 8 or later. Check that the Java installation is properly configured, and the JAVA_HOME environment variable is set correctly.

- Review installation logs: During the installation process, check if there are any log files generated that provide information about the error. Look for error messages or exceptions that might help identify the cause of the issue. The log files are typically located in the installation directory or in a separate "logs" folder.

- Run as administrator: Try running the installation program as an administrator. Right-click on the installation file and select "Run as administrator" to ensure that the installation process has the necessary privileges.

- Disable antivirus/firewall: Temporarily disable any antivirus or firewall software that might be interfering with the installation process. Sometimes, security software can prevent certain components or processes from being installed.

- Clean installation: If you have previously attempted to install Oracle SQL Developer, uninstall any existing installations and perform a clean installation. This ensures that any conflicting or corrupted files from previous attempts are removed.

Can we connect Oracle Developer to a running instance of Mysql ?

 No, Oracle SQL Developer is primarily designed for connecting to and working with Oracle databases. It does not provide native support for connecting to MySQL databases.

However, there are alternative tools available that are specifically designed for connecting to MySQL databases. One popular option is MySQL Workbench, which is an official graphical tool provided by Oracle for MySQL database administration and development. MySQL Workbench allows you to connect to a running instance of MySQL and perform various tasks such as executing queries, managing database objects, and designing database schemas.

If you need to work with both Oracle and MySQL databases, you may consider using different tools for each database system. Oracle SQL Developer for Oracle databases and MySQL Workbench for MySQL databases. This allows you to leverage the features and capabilities specifically tailored for each database platform.

Does Oracle SQL Developer needs a running instance of the Oracle to be installed separately ?

 No, Oracle SQL Developer does not require a separate installation of the Oracle database server to be running. Oracle SQL Developer is a standalone graphical tool for database development and administration. It can be installed and used independently of the Oracle database server.

However, to connect Oracle SQL Developer to an Oracle database, you will need the necessary connection details such as the hostname, port number, database name, username, and password. These details are required to establish a connection to the Oracle database server from Oracle SQL Developer.

Once you have the connection details, you can configure a new connection in Oracle SQL Developer and connect to the Oracle database server to perform various tasks such as executing SQL queries, managing database objects, and developing database applications.

Wednesday, January 25, 2023

what is the difference between using the SolrJ and Data Import Handler to synchronize Solr with the datatabase ?

SolrJ is a Java client library for communicating with Solr, while the Data Import Handler (DIH) is a module within Solr that allows for importing data from various data sources, including databases, into Solr. The main difference between the two is in how they import data into Solr. SolrJ allows you to interact with Solr using a Java API, allowing you to add, delete, or update documents in Solr directly from your Java code. This can be useful if you have a custom data pipeline or application that needs to update Solr in real-time. On the other hand, the DIH provides a way to import data into Solr from various data sources, including databases, without writing any code. The DIH can be configured to periodically fetch data from the database and update Solr, or it can be triggered to run on demand. It also supports incremental updates, so it only imports the data that has changed since the last import. SolrJ is a Java client library for interfacing with Solr, while the Data Import Handler (DIH) is a feature provided by Solr for indexing data from external sources such as databases. Pros of SolrJ: Provides a Java API for interacting with Solr, allowing for easy integration with other Java-based systems Allows for fine-grained control over how data is indexed and queried Can handle large volumes of data Cons of SolrJ: Requires code to be written to interface with the data source and index it into Solr Can be more complex to set up and maintain than using the DIH Pros of Data Import Handler: Can be configured through the Solr web interface, making it easy to set up and maintain Can handle a variety of data sources, including databases, XML, and CSV files Can schedule regular imports of data to keep the index up to date Cons of Data Import Handler: May not provide as much flexibility as using SolrJ to index data Can be less efficient than using SolrJ for large-scale data import. So, in summary, SolrJ is a way to communicate with Solr using Java API and update it in real-time, while DIH is a module within Solr that allows you to import data from various data sources, including databases, into Solr.

Friday, May 29, 2020

Dev Tips#43 Connect MYSQL to a Jasper report in Java and JDBC

In this tutorial, I show you how to retrieve data from MySQL to a Jasper Report in Java. JDBC is used to get an instance of the connection and passed to the jasper report engine...
Settings.xml:
   
    <mirrors>
        <mirror>
      <id>mirror1</id>
      <mirrorOf>central</mirrorOf>
      <name>mirror1</name>
      <url>https://repo.maven.apache.org/maven2/</url>
        </mirror>
    </mirrors>
   
  
POM.xml:
   
<dependencies>
        <dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>6.8.0</version>
    <type>jar</type>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <artifactId>commons-collections</artifactId>
            <groupId>commons-collections</groupId>
        </exclusion>
        <exclusion>
            <artifactId>commons-beanutils</artifactId>
            <groupId>commons-beanutils</groupId>
        </exclusion>
        <exclusion>
            <artifactId>commons-digester</artifactId>
            <groupId>commons-digester</groupId>
        </exclusion>
        <exclusion>
            <artifactId>commons-logging</artifactId>
            <groupId>commons-logging</groupId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
<scope>compile</scope>
<optional>false</optional>
</dependency>
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.6</version>
</dependency>
    </dependencies>
   
  
Main Java Class:
  package com.mycompany.mavenprojectdemov1;

import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader; 
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
 
/**
 * Hello world!
 *
 */
public class App 
{
        
    public static Connection getDbaseConnection(String HOST_NAME, String DBASE_NAME,
        String USER_NAME, String USR_PASS) throws SQLException,
        ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        //String connectionURL = "jdbc:mysql://" + hostName + ":3306/" + dbName;
        String CNTION_URL = "jdbc:mysql://" + HOST_NAME + "/" + DBASE_NAME;
        Connection conn = DriverManager.getConnection(CNTION_URL, USER_NAME,USR_PASS);
        return conn;
    }
    
    public static void main( String[] args )
    {
        //Database credential
        String hostName = "localhost";
        String dbName = "springboot";
        String userName = "springboot";
        String password = "springboot";
        
        //Jasper file location
        String fileNameJrxml = "E:/Jasper/jasperv1.jrxml";
        String fileNamePdf = "E:/Jasper/jasperv1.pdf";
 
        try {
            //Getting a connection instance
            Connection connInstance = getDbaseConnection(hostName,dbName,userName,password);                   
            System.out.println("Loading the .JRMXML file ....");
            JasperDesign jasperDesign = JRXmlLoader.load(fileNameJrxml);
            System.out.println("Compiling the .JRMXML file to .JASPER file....");
            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
            System.out.println("filling parameters to .JASPER file....");
            JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperReport, null,connInstance);
            System.out.println("exporting the JASPER file to PDF file....");
            JasperExportManager.exportReportToPdfFile(jprint, fileNamePdf);
            System.out.println("Successfully completed the export");

        } catch (Exception e) {
            System.out.print("Exception:" + e);
        }

    }
}


  

Sunday, September 13, 2015

Android reload database on resume or restart.

This scenario happens when , say we have two activities A and B.
From A we go to B and update the database. Then when we comeback at A
we notice that the A is not updated.
We have to implement the OnRestart in A, so that when the BACK button is pressed our
database is reloaded.

      @Override
    public void onRestart()
    {
        super.onRestart();
        finish();
        startActivity(getIntent());
    }

  


You can also try OnResume too



     @Override
    public void onResume() {
        super.onResume();  // Always call the superclass method first
        finish();
        startActivity(getIntent());

    }

  

This is just a trick, hope it paved your way out. 

Tuesday, December 9, 2014

Distributed database vs Distributed DBMS

Distributed database: a collection of multiple, logically interrelated databases distributed over a computer network.
However,
Distributed DBMS: the software system that permits the management of the distributed database and makes the distribution transparent to the users.