database

Check database connectivity using Shell script

I am trying to write a shell script to check database connectivity. Within my script I am using the command sqlplus uid/pwd@database-schemaname to connect to my Oracle database. Now I want to save the output generated by this command (before it drops to SQL prompt) in a temp file and then grep / find the string "Connected to" from t...

Whats wrong with this bcp utility?

I am trying to export data into into a text file using bcp utility? I could n't figure out what i am doing wrong here:- Declare @Cmd nvarchar(1000) Declare @Query nvarchar(1000) Declare @Path nvarchar(500) Declare @ServerName nvarchar(500) Declare @UserName nvarchar(50) Declare @Password nvarchar(50) Declare @Delimiter char(1) SET @Pat...

How can I find the error in my SQL prepared statement?

try { pst=con.prepareStatement("insert into stud values(?,?,?,?,?,?,?,?,?)"); pst.setString(1,s1); pst.setString(2,s2); pst.setString(3,s3); pst.setString(4,s4); pst.setString(5,s5); pst.setString(6,s6); pst.setString(7,s7); pst.setString(8,s8); pst.setString(9,s9); int val=pst.executeUpdate();...

Securely storing database connection details. Why use .inc at all?

I am always reading that you should always store your database credentials outside of your document root because normally you would have them set to db.inc or something similar. I can understand this and naturally it makes perfect sense. What I don't understand is why you are making the file into one that you either need to set apache ...

show duplicate records

I have this query SELECT id, timeOrdered, order_desc, firstname, lastname FROM `db`.`myTable` WHERE `myTable`.`customer_number` IN (100, 101, 102, 103, 104, 105) I am trying to find which are duplicate records. If the timeOrdered, order_desc, firstname, lastname are same then its dupe. What would be the query for that Thanks ...

How to set up Database for ASP.NET MVC Application

I created an data driven ASP.NET MVC Application locally and it works fine. Within my App_Data Folder of my project i see two databases: ASPNETDB.mdf and myProjectDatabase.mdf. I uploaded my project files an the webserver, so that I can actually open the website. But I couldn't figure out how to connect my Database that I created locall...

ASP.NET: How to support two database types in one application? (Access, MS SQL Server 2008 Express)

The ASP.NET web application I am developing needs to support two different types of databases, namely Access and MS SQL Server 2008 Express. I already have connection strings for each database type stored in web.config, and I have another web.config value that specifies which one to use. So I can get the proper connection string with no...

How can dbms_metadata from Oracle produce constraints seprate from the table schema files?

Why is dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'CONSTRAINTS_AS_ALTER', TRUE) not generating constraints in separate files? At this moment this pl/sql pastes the constraints after the table schema definition files. What flag do I have to use to achieve this separate constraints schema definition directory? ...

create data patch for database (synchronize databases)

There is 2 databases: "temp" and "production". Each night production database should be "synchronized", so it will have exactly same data as in "temp". Database sizes are several GB and just copying all data is not an option. But changes are usually quite small: ~100 rows added, ~1000 rows updated and some removed. About 5-50Mb per day. ...

Best way to iterate through all rows in a DB-table

I often write little Python scripts to iterate through all rows of a DB-table. For example sending all to all subscribers a email. I do it like this conn = MySQLdb.connect(host = hst, user = usr, passwd = pw, db = db) cursor = conn.cursor() subscribers = cursor.execute("SELECT * FROM tbl_subscriber;") for subscriber in subscribers: ...

importing CSV file into sqlite table

I've imported a CSV file into an sqlite table. everything went fine except it included quotes " " around the data in the fields. not sure why because there are no quotes in the CSV file. anyone know how to avoid this or get rid of the quotes somehow? Here's a screenshot from the firefox sqlite import settings I'm using: thanks for a...

linq to entities 3.5 across multiple databases in same engine

Hi, What do i need to do in order to be able to query across multiple databases which are in the same db engine? I have added the .edmx file of 1 database, but i only need 1 view from another db. Thanks in advance! ...

Is database index useful if query returns all rows ?

If I used an Index column in a query which returns all the Rows, is it advantageous to use the Index column in the where clause ? For eg. select * from table1 where Salary > 1; If the salary of all the employees is greater than 1, is it advantageous to use the Index column in the where clause ? Are Indexed a big overhead while inserti...

How to send ALL XML messages that were sent when the database was down TO PeopleSoft after database picks up?

Hello, I am working on a project using MULE ESB. The present scenario in the application I am working is From the first application we are able to send xml msgs to peoplesoft (its acting as the second application) directly but it is not guaranteeing that all the messages will be received at the peoplesoft end. so we decided using MUL...

What are best practices for database queries?

Hi, I would like to know what are best practices for database queries. I am using C#, mysql database. I have one application in which I had hardcoded all the database queries. Now client has modified database structure. So I have to again modify those queries and as all the queries are inside code, I need to test application, build it...

MS Access Query "WHERE" Exception

I am writing an application in C# that reads info from a .mdb file using the System.Data.OleDb namespace. The table I am reading from contains information about a sample (number, index, date, etc). The number and date are required entries when a new item is added to the table, but the index is optional, so some samples do not have an ind...

Creating Custom Module Fields in SugarCRM over SOAP Interface

Hi all, we're using SugarCRM as the back-end for a web application. We automatically generate Java client-side stub SOAP classes using Apache Axis, and using these classes we are able to login through Sugar, create new Contacts, change field values, etc. (All using the SOAP interface.) We will be using a number of different SugarCRM ins...

Need Advice: Is this a good use case for a 'NoSQL' Database? If so, which one?

I have recently been researching NoSql options. My scenario is as follows: We collect and store data from custom hardware at remote locations around the world. We record data from every site every 15 minutes. We would eventually like to move to every 1 minute. Each record has between 20 and 200 measurements. Once set up the hardware rec...

Storing big int array partially in database , to reduce memory in java

Hi Experts, I have a class that has int[] members. The arrays grow very big, about 56M in size.(arrays are expandable with implementation similar to arraylist). Now I want to partially store the array in database, to improve memory. I have oracle database at my disposal. I would also like to cache more used indexes. I am wondering if ...

Have a mysqldump with Indexes. How do I import it by disabling them?

I am trying to import a large database but because there's an index, it is taking forever to import the database. I tried copying the raw files to a different machine but for some reason, the largest table is not being read giving me an error: can't read file: 'tablename.MYD. So I mysqldumped my old database but it did so with an index. ...