C# Winforms - can't see my table when creating a data source - winforms

I recently installed Oracle XE 11g on my machine and am trying to make a connection to it from a winform project.
I have created a new table in sqldeveloper, the connection settings I used in sql developer are:
connection_name : xe
User : SYSTEM
password : **
host : localhost
port : 1521
SID : xe
In my WinForms project i have created a simple gridview and am trying to use the wizard to create a new data course but when I do, I get a bunch of tables but I cannot see my table I created.
Also, in sql developer i cannot see the JOBS, JOBS_HISTORY, etc tables but in the data source wizard they appear in the list of available tables.
I suspect I have somehow made a connection to the wrong database! If someone could kindly tell me what I'm doing horribly wrong I would be very grateful as I'm hitting my head against the wall on this as it does not make much sense to me.

Ok i stupdily didnt realise i needed to create a new users and then create a table under that user.
Once i did that i could see the table in the data source in visual studio. I'm guessing tables owned by the System user cannot be seen to other people/application and is only visible to the administrator?

Related

RDS can't create a database

I am trying to create an SQL Server database under the free tier options in AWS.
After going through the standard options - database name, password, public/private access, etc.. I press the create database button. I get the following screen.
But the database never gets created. I saw multiple tutorials.. but I haven't seen a similar problem. Does anyone have a clue what am I doing wrong?

how to mirror a whole database cluster in postgresql

I'm using a postgresql (9.6) database in my project which is currently in development stage.
For production I want to use an exact copy/mirror of the database-cluster with a slightly different name.
I am aware of the fact that I can make a backup and restore it under a different cluster-name, but is there something like a mirror function via the psql client or pgAdmin (v.4) that mirrors all my schemas and tables and puts it in a new clustername?
In PostgreSQL you can use any existing database (which needs to be idle in order for this to work) on the server as a template when you want to create a new database with that content. You can use the following SQL statement:
CREATE DATABASE newdb WITH TEMPLATE someDbName OWNER dbuser;
But you need to make sure no user is currently connected or using that database - otherwise you will get following error.
ERROR: source database "someDbName" is being accessed by other users
Hope that helped ;)

Connecting to Pervasive 11 with Odbc

For a client I had developed years ago an application that uses an existing database on Pervasive 10. The database itself is used by a propriety application. After a full server re-install Pervasive 11 was installed and somebody did a migration. I am not sure what exactly was performed but I do observe that the propriety application actually is working, so the connection to the Pervasive DB works.
The objective is to get the ODBC connection working again.
My observations so far:
When I login in the control center I notice two main items, a Local Client with a MicroRouter and server instance containing three databases (DEFAULTDB, DEMODATA, TEMPBDB). I have the impression that the customer database is missing here.
When I open the Software Monitor I notice that the MicroRouter is active and points to local .btr files which look like the tables from the database .
How can I have a ODBC connection pointing to the database? Normally the DSN references the database name.
To connect through ODBC, you need the data files and DDFs (FILE.DDF,FIELD.DDF, and INDEX.DDF at a minimum). Once you have the DDFs that describe the data files, you can create a Database in the Pervasive Control Center. When creating the Database, you can select the option to create an ODBC DSN.
You should be able to right click on the "server" in the Control Center and select New Database. From there, you'll set the Database Name and set the Dictionary (points to the DDFs) and Data Path (points to the data files,usually the same directory where the DDFs are).

Create database and add to Visual Studio solution

I am creating a database with Entity Framework 4 and Visual Studio 2010.
I am fine with the first steps - I am going model first, so I successfully created the model and now there is a valid .edmx file in my solution.
My goal is the following: I want to generate the database and add it to the solution so I can give the solution to another person and they will be able to build it and run it - I do not want the database connection be dependent on any of my local settings, and I do not want them to have the need to recreate the database, it will have some 'seed data' in it. That should be possible, I saw similar solutions.
I would appreciate advice on how to do that.
Use SQL Server Express and put database files to App_Data directory (for web application) or make them solution items copied to output for other application. Change connection string to attach the file - it should look something like:
AttachDbFileName=|DataDirectory|\YourDB.mdf;Initial Catalog=YourDB;Integrated Security=SSPI

How can I use a SQL Scripts in a Database Project with the System.Data.SQLite data provider?

I've got a project where I'm attempting to use SQLite via System.Data.SQLite. In my attempts to keep the database under version-control, I went ahead and created a Database Project in my VS2008. Sounds fine, right?
I created my first table create script and tried to run it using right-click->Run on the script and I get this error message:
This operation is not supported for the provider or data source you are using.
Does anyone know if there's an automatic way to use scripts that are part of database project against SQLite databases referenced by the databases, using the provider supplied by the System.Data.SQLite install?
I've tried every variation I can think of in an attempt to get the script to run using the default Run or Run On... commands. Here's the script in it's most verbose and probably incorrect form:
USE Characters
GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'Skills')
BEGIN
DROP Table Skills
END
GO
CREATE TABLE Skills
(
SkillID INTEGER PRIMARY KEY AUTOINCREMENT,
SkillName TEXT,
Description TEXT
)
GO
Please note, this is my first attempt at using a Database, and also the first time I've ever touched SQLite. In my attempts to get it to run, I've stripped any and everything out except for the CREATE TABLE command.
UPDATE: Ok, so as Robert Harvey points out below, this looks like an SQL Server stored procedure. I went into the Server Explorer and used my connection (from the Database project) to get do what he suggested regarding creating a table. I can generate SQL from to create the table and it comes out like thus:
CREATE TABLE [Skills] (
[SkillID] integer PRIMARY KEY NOT NULL,
[SkillName] text NOT NULL,
[Description] text NOT NULL
);
I can easily copy this and add it to the project (or add it to another project that handles the rest of my data-access), but is there anyway to automate this on build? I suppose, since SQLite is a single-file in this case that I could also keep the built database under version-control as well.
Thoughts? Best practices for this instance?
UPDATE: I'm thinking that, since I plan on using Fluent NHibernate, I may just use it's auto-persistence model to keep my database up-to-snuff and effectively in source control. Thoughts? Pitfalls? I think I'll have to keep initial population inserts in source-control separately, but it should work.
I built my database using an SQLite SQL script and then fed that into the sqlite3.exe console program like this.
c:\sqlite3.exe mydatabase.db < FileContainingSQLiteSQLCommands
John
Well, your script looks like a SQL Server stored procedure. SQLite most likely doesn't support this, because
It doesn't support stored procedures, and
It doesn't understand SQL Server T-SQL
SQL is actually a pseudo-standard. It differs between vendors and sometimes even between different versions of a product within the same vendor.
That said, I don't see any reason why you can't run any (SQLite compatible) SQL statement against the SQLite database by opening up connection and command objects, just like you would with SQL Server.
Since, however, you are new to databases and SQLite, here is how you should start. I assume you already have SQLite installed
Create a new Windows Application in Visual Studio 2008. The database application will be of no use to you.
Open the Server Explorer by pulling down the View menu and selecting Server Explorer.
Create a new connection by right-clicking on the Data Connections node in Server Explorer and clicking on Add New Connection...
Click the Change button
Select the SQLite provider
Give your database a file name.
Click OK.
A new Data Connection should appear in the Server Explorer. You can create your first table by right-clicking on the Tables node and selecting Add New Table.

Resources