Imports System.Data.OleDb
Public Class Log
Private mConnectionString As String = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=1521)))(CONNECT_DATA=(SID=xxx)(SERVER=DEDICATED)));User Id=xxx;Password=xxx;"
Dim ds As New DataSet
Dim da As New OleDbDataAdapter
Dim dr As DataRow
Dim Connection As New OleDbConnection(mConnectionString)
Dim Command As OleDbCommand
goes on...
That's the code, and it works great on our development machines. We all have the Oracle providers installed on our machines. Now I tried using this code in an app on another machine that does not have the Oracle software installed and it doesn't work.
Now I know I can install the Oracle providers on these other machines and it will work. Problem with that is A) there are many of them and B) I'd have to go through our IT department and it would take six months for them to do it. So my question is, can I connect to this Oracle database from a machine without the Oracle providers installed? I thought Microsoft had it's own Oracle provider but it doesn't show up under System.Data. The .NET version is 3.5 if that helps. Any ideas?
I've had fairly good luck with the Oracle Instant Client and ODP.NET, which is pretty much a straight XCOPY deploy (if you don't need ODBC).
IIRC, you do need to modify the PATH environment variable, but that's relatively painless - especially compared to the hoops Oracle used to make you jump through.
The problem is actually you started a project without discussing the infrastructure needs with your company's IT/DBA team. This is not a technical problem but a process problem.
That being said here is a possible solution (although I haven't used personally).
http://devart.com/dotconnect/oracle/
I'm pretty certain you have to install the Oracle provider in order for this to work. OleDb can easily connect to SQL Server and Access and so on, but only because these providers come pre-installed in Windows.
I think your only option (other than installing the Oracle provider on every machine) is to create a SQL Server "front" database that includes pass-through tables to each Oracle table you need, and then get your data from SQL Server instead of Oracle.
Actually, another option would be to have your client applications get their data from an intermediate web service instead of connecting directly to the database, but this would probably entail a major re-write.
Would it be possible to find and include the Oracle DLLs with your app instead of installing them?
Related
I"m using LINQPad since a long time. Now I've updated my work stations to version 6 and then i realized i could also use a demo database the same way i do on my home/fun development laptop since an year. But i have no idea how i initially discovered such a database exists at all.
Could anyone point me to simple path or documentation explaining the presence of the demo databases for LINQPad? Probably more LINQPad rookies could be missing such a valuable option.
REMARK: The demo databases are located under C:\Users[current user]\AppData\Roaming\LINQPad
When you first run LINQPad 6, it extracts the DemoDB.sdf database and creates a connection in the Schema Explorer on the left. The database is based on a Microsoft demo database for SQL Server.
The database requires SQL CE, so when you expand the connection, LINQPad will ask if want to download the NuGet package for SQL CE if not present. The reason for using SQL CE is that it doesn't require installation or configuration, and unlike SQLite, it supports a full range of data types.
I need a database for a web project (and for off-line projects as well). The problem is I don't know where to start and googling returns more advanced stuff. Where do I start?
I already have Visual Studio 2010 and Visual Web Developer 2010 installed (both – the express version). I'm not sure I have what is needed for SQL (which, correct me if I'm wrong, is what I need for databases). In my start button I have two folders named "Microsoft SQL Server 2008" (one of them with an "R2" at the end). But my computer isn't a server, just a PC. Am I supposed to install something on my PC? If so – which of the two? (The one with the "R2" or the one without it)
All I need is to create a simple database so I can store and retrieve information easily instead of reading a text file....
well, you need SQL Server installed. Try searching your computer for it, you may have it installed. The easiest way is to run services.msc and look for SQL Server.
See here, I have 3 instances installed but just one running (INSTANCE2008 is the name I gave to it, you will probably have SQLEXPRESS or MSSQLSERVER):
If it is installed you will need SQL Server Management Studio to create your database. You will probably have it under:
once you access it, just connect to your server (usually called localhost), right click on the database folders and select "new database"
from that, it is really easy to create your DB, just follow the steps
Sounds like you have all the tools you need to get started, however you might also need SQL Management Studio as well.
But "How to start creating and using databases?" is sort of a broad question. If your question is really about application design, then you would start 'creating databases' when you've defined your model. Once your model is defined, then you can start creating the database.
If your question really is about creating and using databases, SQL Management Studio should get you on the right track. It's a point n' click way to creating databases, tables, stored procs, etc.
Using the database... hmmm. The easiest way is to integrate Microsoft's Enterprise Library 5. Again, point n' click interface to setting up the connection in your web.config (or app.config) and plenty of examples.
You can import the System.Data and System.Data.SqlClient library in your application, like
using System.Data;
using System.Data.SqlClient;
and research about the SqlConnection class.
about SQL Statements, the W3Schools has a good reference.
A simple method sample that has a connection
protected void connection()
{
using(SqlConnection conex = new SqlConnection("your_connection_string"))
{
SqlCommand comand = new SqlCommand();
comand.CommandText = "SELECT * FROM Table";
comand.CommandType = CommandType.Text;
comand.Connection = conex;
conex.Open();
comand.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(comand);
DataTable dt = new DataTable();
da.fill(dt);
}
}
You will be having your database on your server. You can directly connect to that database with just a slight configuration in web.config.
OR
If you found "SQL Server Management Studio" in your Microsoft SQL Server 2008 R2 click on it and login to the sql server / express instance of the sql server.
Create the database there.
I'm writing a desktop application that uses the main access database that will be hosted on a central server, but there will be a laptop with the app on that has an offline mode so records can be created offsite. When the laptop returns I want it needs to be synced back to the main database.
Has anybody got any pointers on a way to do this, I've briefly read about JRO but is there an alternative / better method?
Originally, I was just going to write some custom code to do this, but thought I'd check to make sure there wasn't something already out there.
Jet Replication is a perfect solution for this kind of scenario, because you can use the simplest form of it, Direct Replication, and don't need to have any outside dependencies.
Assuming your server is named \HomeOffice\ and the database is named "MainDatabase.mdb" and is stored in the \AccessDatabases\ folder, you could use this code behind a command button to synchronize from the laptop to the server:
Dim dbServer as DAO.Database
Set dbServer = DBEngine.OpenDatabase("\\HomeOffice\AccessDatabases\MainDatabase.mdb")
dbServer.Synchronize CurrentDB.Name
dbServer.Close
Set dbServer = Nothing
Now, there's no error handling, and you haven't checked for conflicts, so you'd need to do more than that, but that would get you started with the basics.
See the Jet Replication Wiki for lots more information on Jet Replication.
Access (at least through 2003) has built in capabilities to replicate a database that would be far better to use than rolling your own.
Here's some documentation on that feature: Database Replication
MS Sync Framework could be the answer, but it's a bit tricky to set up... http://msdn.microsoft.com/en-us/sync/bb821992
There is the Microsoft Sync Framework that is compatible with ADO.NET and MS SQL Server / SQL Server Compact, but that's not a small component, more like a multi-component framework.
I'm connecting my application to a SQL Server 2008 database.
What is the difference between the following providers: System.Data.SqlClient provider and SQLNCLI10.1 if there is any?
Which one should be used to connect to a SQL Server database and why?
Thanks,
System.Data.SqlClient is a managed provider. SQLNCLI is an OleDB provider. Which means they are as distinct as it gets. Nothing in common, really, besides the fact that they're both connecting to SQL Server. But using completely different and unrelated technologies. In your applications you should use SqlCLient when writing managed code (.Net). OleDB is for native applications (C++).
I would guess that the only difference is that the latter specifies a specific version (which may or may not be present as the code moves from server to server or the box is touched by software updates etc). The former just says "get the current version" and in my mind is safer.
Back in the classic ASP days I vaguely remember that specifying the most recent version explicitly (e.g. Provider=SQLOLEDB.1) seemed to work better than just Provider=SQLOLEDB but I don't recall the specifics. I do remember that some web hosts didn't have up to date stuff, and the explicit request for a more recent version would fail there with something similar to "provider not found."
Here's task: We have an sql server database. which is hosted at our server. What we need to do is: we need to create a non-techy-users interface (basically insert/edit forms) and let these non-techy-users to install this database locally, since they are located in the areas without internet connection. Then when they're done using the database we get the data from them and inster it in our database.
The biggest concern is that it is not trivial for non-it people to install sql server. Can you please advise me what solution should I choose? Simple Access should work fine, but i really do not want to mess with it and have data conversion back and forth between engines.
Sync Framework for SQL Server: your application uses a lite weight, embedded SQL Server CE (no installation, just a couple of DLLs deployed along with your app) and the sync framework manages the synchronization with the 'mother ship' SQL Server.
Out of interest, why do they need their own installation? Can't you create a new database on your existing instance?
If you're looking for an easy way to create insert/edit forms on your database, have you considered looking at Microsoft's new LightSwitch product (currently in Beta) or Microsoft's Dynamic Data?