I want to add a new Informix sever entry into sqlhosts, but I'm not quite sure how it will impact the existing connection.
Currently sqlhosts contains only one server entry...
dbserver onsoctcp 111.111.111.20 7101
The database handle is created within an existing perl module (db is a database on the server)...
my $dsn = "DBI:Informix:db";
my $dbh = DBI->connect($dsn,"user","password");
Notice that "dbserver" is never referenced.
I want to add a test server to sqlhosts. Something like this...
dbserver onsoctcp 111.111.111.20 7101
dbserver_test onsoctcp 111.111.111.21 7101
With only one entry in sqlhosts, everything has been working fine. But my connection never references the server name in sqlhosts.
So, my question(s)...
Does Informix just try to use the only one available?
Will adding a second server entry in sqlhosts force me to include the server name in the connection string?
Thanks!
Informix client uses environment variables to resolve hosts and other configuration; check that INFORMIXDIR is set to the path where Informix CSDK is installed (I assume it is), and set INFORMIXSERVER to point to the new entry in sqlhosts. See this article in IBM knowledge base.
Alternatively, use db#server data source format:
my $dbh = DBI->connect("DBI:Informix:db#server", "user", "password");
Maybe it is a permissions issue? From the documentation:
Note that you might also be able to connect to other databases not
listed by DBI->data_sources using other notations to identify the
database. For example, you can connect to "dbase#server" if "server"
appears in the sqlhosts file and the database "dbase" exists on the
server and the server is up and you have permission to use both the
server and the database on the server and so on. Also, you might not
be able to connect to every one of the databases listed if you have
not been given at least connect permission on the database. However,
the databases listed by the DBI->data_sources method certainly exist,
and it is legitimate to try connecting to those sources.
http://search.cpan.org/~johnl/DBD-Informix-2013.0521/Informix.pm
Related
This is a newbie question - don't overthink it!
I'm trying to make a connection from perl to a remote server's MySQL database that I can connect to just fine from PHP or from TOAD, so I know clearly what my host, dbname, username and password are.
But when I try to do this from my new installation of Strawberry Perl using the Padre IDE, something somewhere ( probably some config file ?) keeps insisting on adding '#localhost' to my username.
Oh, I'm using perl, v5.10.1 (*) built for MSWin32-x86-multi-thread.
I'm trying:
my $DBHOST = "50.88.64.41";
my $DBNAME = "keystrokes";
my $DBUSER = "wade\#'50.88.64.41'";
...
# MySQL database configuration
my $dsn = "DBI:mysql:database=$DBNAME,host=$DBHOST,port=3306";
So I get this output ( slightly sanitized for privacy):
DBI connect('database=keystrokes,host=50.88.64.41,port=3306','wade#50.88.64.41',...) failed: Access denied for user 'wade#50.88.64.41'#'localhost' (using password: YES) at C:\Bitnami\wampstack-8.0.8-0\apache2\htdocs\perl\firstscript.pl line 2.
Whether I put in my username as "wade" or as "wade#50.88.64.41" or "wade#'50.88.64.41'" SOMETHING then adds "#'localhost' to it, then tries to use that as the username, which of course fails, because I'm not on that machine and it is not my localhost.
Any ideas how to fix this? I couldn't find any explicit answers in this forum.
Thank you!
I think your problem is the exact opposite of what you think it is. MySQL is doing the right thing by adding '#localhost' to your username. What you don't need is the `#50.88.64.41' that you add. I've been connecting Perl programs to MySQL databases for fifteen years and I've never needed to add something like that to a username.
The '#host' that you'll see in MySQL connection messages is added by the MySQL client library when making the connection - by looking at the IP address that the connection request is coming from.
So just change your code to:
my $DBUSER = 'wade';
and it should work.
Traditionally, you'll see two rows for each user in the mysql.user table. One with a host of localhost and the other with a host of % (which means "any other host"). That makes it easier to control access to the database - it's common that you would only allow access to users who are on the same server as database.
I am new to Oracle databases(I am using Oracle Database 11g Express Edition) and sqldeveloper. I have this doubt
When creating a new connection in sqldeveloper what is actually happening?
Creating a new database or connecting to an existing databasE?
If I create multiple connections are they pointing to a single database or different databases, if the later then how to choose a database name while creating a connection
You are establishing a connection to user (i.e. schema) which resides in an (Oracle) database. One database contains many users, so - create one connection per user.
Creating a connection does NOT create a new database; it is done differently. I don't think that 11gXE offers that option; you'd need a Standard or Enterprise Edition.
No problem if you use multiple databases (most of us do). I prefer keeping them in TNSNAMES.ORA file, in a directory used by the TNS_ADMIN environment variable. Currently, there are 94 databases I have access to, each of them having many users.
In your case, 11gXE is (probably) installed on your own computer, and you'll use one of its users (HR?), so - just connect to it. If it is locked, you'll have to unlock it first, though - in that case, create connection to SYS (don't forget to connect AS SYSDBA), then
ALTER USER hr ACCOUNT UNLOCK;
ALTER USER hr IDENTIFIED BY hr;
and then create connection to "hr" whose password is now set to "hr" (all lower case).
I just imported data dump through below command:
IMPDP user/pass FULL=Y DUMPFILE=BIRDV24012014.DMP LOGFILE=BIRDV24012014.log;
The dump has been restored the issue is i dont know how to connect to this database that i just imported, what service or TNS does it resides and how can i query it?
You didn't import a database, you imported the contents of your file into your existing database. If you could successfully run impdp user/pass then your ORACLE_SID etc. is already set and you should be able to log in and query with sqlplus user/pass.
If you've come from another RDBMS background you may be confusing 'database' with 'schema'. Depending on what was in the dump, you've probably created a load of schema objects and data under the USER schema or whatever your real 'user' value was).
The import makes no difference to this, but if you want to access the database from another client (e.g. from another machine, or over JDBC) then you'll need to check your listener configuration to get the hostname/IP address and port it's listening on, and get the service name for the database; all of which can be obtained from lsnrctl services if you have permission to run that. You can then use those values for a JDBC URL, or in a tnsnames.ora entry, or ODBC, etc.
Look at your ORACLE_SID environment variable. There you'll find the instance ID. If you ran the IMPDP tool as user Oracle, you should also be able to connect to the database using
sqlplus / as sysdba
If all fails, look at your /etc/oratab file to see which instances are available on this host.
On another note, your command seems incomplete. Datapump requires a DIRECTORYparameter to know where to look for the dumpfile you specified.
I working on Creating a replication Between sqlserver on a non-trusted domain.But i have come to realize that i can only use the servername instead of the ip address of my server.I tried using the current server name i got from the sysadmin.But still connecting with the servername still display the same error:
sqlserver replication requires the actual servername to make connection
Connection throught a server alias,IP address, any other alternate are not supported
Specify the actual server name,'WIN-2JQ9ZRN3T'.(Replication.Utitilies).
I ran a script to show my server name:
Select ##SERVERNAME
The result was:WIN-2JQ9ZRN3T.This is very strange for me.I cannot connect with name i got from my sysad throught management studio,but on remote desktop i can remote connection using that name.
Now i want to update my servername using this script i came across on the internet:
sp_dropserver old-server-name
go
sp_addserver real-server-name, LOCAL
go
But i don't know what the impact would be because my predecessor configure a linkserver on the same server.Please advise
You have proposed a good solution: you have to update the server name accordingly and restart SQL Server, otherwise you'll not be able to use replication.
On the other hand, please check the replication component is installed, this will save you to make another restart.
Regarding your concern with linked servers, please run
SP_LINKEDSERVERS
and check if old server name appears in SRV_DATASOURCE column.
Another option could be to setup a sql server alias:
http://www.mssqltips.com/sqlservertip/1620/how-to-setup-and-use-a-sql-server-alias
Two developers often share the same system, and both have local copies of the project and try to connect to a local database. Both users can see the database, but tables and their data are only visible to the database's original author.
We've tried giving all permissions to both users, but it seems the only thing that works is to duplicate the database.
Is there a way around this?
Thanks in advance!
You would probably be better off hosting a separate MySQL instance on it's own machine, and then configure your code to connect to that database instead of the MAMP-hosted one. That being said, you will need to open the port on the firewall of the MAMP(0) for the MAMP-MySQL (usually port 8889). Then, the script on the MAMP(1) needs to be configured to connect to MAMP(0) database on the newly opened port.
You will also need to GRANT privileges for user(1) on the MAMP-host(0) database.
A connect string from MAMP(1) would look like:
$db_url = 'mysqli://user:password#mamp0.local:8889/es_forms_drupal';
Hopefully that makes some sense.